3
\$\begingroup\$

There is a game called Against The Wall, developed by Michael P. Consoli. It's a fantastic game, as I've always been stumped at how the game creates an infinitely spanning wall.

In the game, you can fall forever, and the wall will keep spanning. I can fall as long as I like, and still be able to climb back to where I was before. The game is developed in Unity.

How can a game do this without crashing, or creating some kind of memory overload?

\$\endgroup\$
1
  • \$\begingroup\$ It probably starts paging out to the disk at some point. \$\endgroup\$ Commented Nov 11, 2012 at 5:48

1 Answer 1

8
\$\begingroup\$

There's no need for the wall to actually be infinite in the implementation itself. Games are 99% smoke and mirrors. The game could easily be despawning bits of wall that are too far away and recreating them on demand.

Doing so with the right algorithmic approach would make the wall generation "stable" (that is, if you fall enough and then climb back up, it'll be the same wall layout and not a new random layout). There would be some kind of limit to that based purely on the limits of integer sizes, but this limit can be large enough that it is effectively infinite in practice. If the world eventually wraps (no idea if it does) you can even avoid ever showing the player any "edge" to the world.

The game also possibly moves the wall rather than the player. If the player moved, then eventually the player would move to some coordinate where floating point inaccuracies and imprecision would cause severe errors. Keeping the player at position 0,0,0 and them moving the wall avoids that, as the walls are despawned from memory before they get too far away from the origin.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ This does not answer the question xD \$\endgroup\$ Commented Nov 11, 2012 at 6:49
  • 3
    \$\begingroup\$ @J.C.Leitão I'm not clear on how this doesn't answer the question... it seems to me like it does. \$\endgroup\$ Commented Nov 11, 2012 at 7:48
  • 1
    \$\begingroup\$ I think it would be better to describe the wall generation as "deterministic" rather than "stable." \$\endgroup\$ Commented Nov 11, 2012 at 7:49
  • \$\begingroup\$ I tend avoid labeling algorithmic randomness as non-deterministic from a CS purist point of view (since it is quite deterministic, technically speaking; same seed and same series of calls results in the same output), but you're probably right that it's a better term here since that's what most people interpret it to mean. :) \$\endgroup\$ Commented Nov 11, 2012 at 8:09
  • 2
    \$\begingroup\$ @J.C.Leitão: hey, even if it was "how can the game" it'd still be a valid answer, since it's it's one way the game can do it. Now, if it were "how specifically did this game exactly do it," it'd maybe be a bad answer, but then I'd vote to close since the question would be localized and off-topic for GDSE. :p \$\endgroup\$ Commented Nov 11, 2012 at 9:05

You must log in to answer this question.

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