How would one manage the state of static living things like trees in a large sandbox world? Trees in Minecraft, for example: They grow even when the player is far away.

One way is to save them with a timestamp as they go "out of range" and stop updating them in the usual way. Then re-instate them with a sensible state by running an update with a delta time of the time elapsed since that saved time.

I'm planning a new prototype but this has me a bit stumped.

  • \$\begingroup\$ How complex are your distant objects? Using delta time works if your objects do simple things, like grow or move back and forth. If your distant objects are player-rivalling AI entities, they'll need periodic updates to approximate their normal "nearby" behaviour. \$\endgroup\$ – Anko Jul 19 '13 at 10:37
  • \$\begingroup\$ Very simple. Pretty much growing things or similar with simple states. I wont make more complex things like units at first. Also thanks for the edit. \$\endgroup\$ – Gerhard Davids Jul 19 '13 at 11:54
  • \$\begingroup\$ FYI, Minecraft does not simulate anything when the player is out of chunk-loading range (which is the same as “Far” view distance). \$\endgroup\$ – Kevin Reid Jul 19 '13 at 23:17
  • \$\begingroup\$ Understood. It gives that illusion. The question is how? \$\endgroup\$ – Gerhard Davids Jul 21 '13 at 8:35

You can make fewer updates on the objects depending on the distance. For example near objects could be updated every 0.1 seconds, while objects that are a bit away could be updated every second (that's a speed up of about 10x already!), and very far away objects could be updated every 10 seconds (~100x speed up).

The small time steps in games are usually just so that the player doesn't notice them directly. Once you are outside of the view of the player you can simulate much more sparely and you will still get proper results. You can also approximate more, for example for the path-finding or the AI. The player won't notice.

Now, if you want to save memory it gets a bit more tricky, since in that case you want to approximate the state of the object too. That means that you would need two different ways to store your object, and approximate the values you haven't saved once the player approaches them.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.