1
\$\begingroup\$

I am concerning a 3D Scroller game which is like Subway Surf or Temple Run. The thing I am confused about is their way of generating 3D environment. For example for 2D games like Flappy Bird, there is a camera and player which have fixed positions respect to the X axis. And the environment is being generated, moved into camera's viewport, and finally gets destroyed after getting out of viewport. I mean, player and camera does not move in general, the environment does.

Is this approach efficient by means of performance for 3D scrollers? Do they use a box which covers the camera's viewport, and when objects get out of the box, destroy them? Or do they create the environment via code as the player goes further, then make the camera follow the player and they are moving both? Is this a valid approach and what are the advantages or disadvantages of these implementations?

Thanks in advance!

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Either one is valid. It is not a performance concern.

If you play for a very long time (or go very fast) while moving the player instead of the world you might run into floating point accuracy troubles. But 'very' back there was something of an understatement.

Its a personal preference more than anything. Some developers like intuitive movement, some like the game to fit neatly into a little space instead of running off into infinity.

\$\endgroup\$
1
  • \$\begingroup\$ You wouldn't run into floating point problems until you were traveling distances that put the Earth-Moon distance to shame. gamedev.stackexchange.com/questions/75537/… 0.015 is enough precision for fast-paced player movement (60 fps). Ok, a bit of a hyperbole, you'd still be good to out to over 500 km (each unit in Unity being a meter). \$\endgroup\$ Commented Jun 5, 2017 at 20:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .