Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  Anko Jul 19 '13 at 10:37
    
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. –  G. Davids Jul 19 '13 at 11:54
    
FYI, Minecraft does not simulate anything when the player is out of chunk-loading range (which is the same as “Far” view distance). –  Kevin Reid Jul 19 '13 at 23:17
    
Understood. It gives that illusion. The question is how? –  G. Davids Jul 21 '13 at 8:35
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Accepting as its the only answer after some time. –  G. Davids Aug 12 '13 at 14:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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