I’m a 3d modeller and with my little team, Artistic Minds, I’m working on STAR SHIFT, a space combat simulator for which we have recently started a kickstarter campaign. Our aim is to immerse the player in a compelling story to accomplish as well as to make possible free to “wander around in the space” … and discover new quests not directly related to history.

Our programmer  kindly explained a little trick used to make STAR SHIFT’s scenes “infinite”. Let’s read together:

Points in space are identified using the classic XYZ coordinates system, the so called vector numbers. These numbers are specifically floating point values, which means they can have a variable amount of float numbers, those after the decimal dot. They have a size limit, as every type of data in programming; this means that even if they could reach high values, they can’t be infinite. One of the problems in this kind of games’ development, where you have big explorable maps, is the limitation of these coordinates and therefore the resulting approximation when you go beyond these limit values (high or low).This numbers’limit is an obstacle in every programming language and in every engine.

This limited number is an obstacle in every programming language and in every engine. If a camera or a 3D object is too far away from the scene origin point <0,0,0>, its geometry (its vertices position), begins to lose placement precision in the 3D space, along with its shadow. This will cause the camera to capture flickering or shaking objects/images. So, the further the distance from this point, the more the rendering will be inaccurate, showing a bad looking behavior.

This is an issue to consider carefully in video games like STAR SHIFT. Maps for a portion of planetary land could seem very wide, but they’re nothing in comparison to an environment that contains planets billions of miles apart from each other.

Spaceships move at very high speeds, soon reaching the scene’s limits. For instance, a STAR SHIFT’S spaceship, at its maximum speed, can take 90 seconds to fly across a distance such as the whole map of a game like Skyrim. For this reason, in many space simulators, you often find an invisible wall which limits your freedom and the realistic experience of space that a video game of this genre needs. In STAR SHIFT this doesn’t happen and you can wander around in the space through infinite distances. Obviously, the need to route the player back to a playable area arises, ensuring that you don’t lose track of where the true action takes place.

To solve the limits of these float numbers, we use a simple yet smart method. When the camera moves beyond a limit point in space (near to the value that causes the scene to give precision issues), every root object moves along, relative to the coordinates that began to be out of the allowed boundaries. To make this possible, it is necessary that all the objects in the scene stay still at their mutual relative distances, to visually match the previous frame. This happens in a single frame, so it’s invisible to the player and it doesn’t cause any delay. This is the function that makes it possible:

FindObjectsOfType<GameObject>().

This function is really fast regardless of the number of objects involved, as opposed to the infamous GameObject.Find(“ObjectName”);

This fast command can be used on every frame, but it’s usually not the case. This way, STAR SHIFT’s scenes are virtually infinite. Every time you get too far, the distance value gets immediately reset, starting all over again from coordinates <0,0,0>.

More issues arise as we use this method, and they must be solved one by one, like for instance the placement of particles in the scene, which use global coordinates rather than local, such as the “Trail Line”.

This is just a simple explanation of how it is possible to avoid the limits that float numbers put before us. Hopefully, it is enough to understand the basic principle behind it to work in the right direction.

We are the Artistic Minds, and for more information about our project you can check our pages:

http://www.artistic-minds.it/ 

https://www.facebook.com/starshiftvideogame

http://www.indiedb.com/games/star-shift

And support us on Kickstarter!

You can also download here our prototype scene!

Comment using your Facebook account
Liked it? Take a second to support ladyjey on Patreon!