World Simulation Mechanics

Posted by Castypher on Aug. 8, 2012, 4:21 p.m.

Not an interesting title, sure. But all this talk about procedural generation has gotten me back into Lixim, where I face a problem that's been barring me for ages. And only now have I come up with a solution, but I want to see what everyone else has to say first.

Look at each of the bolded problems and think about it for a moment. I have a potential solution for each one. Check the validity of the solution and maybe offer one of your own. I'd just love to see these bars removed or at least remedied.

Huge Living World

Lixim's world lives and breathes while you aren't around. It evolves around you as time passes, so climates can change, for example. As such, the world needs to be simulated all at once. But this has the potential to cause major slowdown.

Solution?

The world is divided into environments, like biomes in Minecraft. I could separate these into similar "chunks", unload the chunk and deactivate it, use a timer to keep track of how long the player has been away, and simulate plant growth and animal movement when the chunk is reloaded.

AI Moving About Non-Existing Chunks

So let's say I choose to simulate like this. The AI still gets fucked up once it walks into an unloaded chunk, and simulating it is no small matter. It's hard enough to do it when it's on-screen, let alone when it's in a void. While I could address enemy and animal AI by simply changing its position based on the time the chunk was unloaded, Lixie AI isn't so simple. They dynamically make choices, their bodies deteriorate, they get hungry, they drown, they eat.

Solution?

This is a tricky one that I still haven't put my thumb on yet, and this is where I need the most help. I've thought about having a system that periodically (once per ten seconds or so) updates the Lixie's position and their stats. The update occurs more often the closer the player is to the unloaded chunk. That's great, but this doesn't accommodate for the environment.

Deactivated AI Accommodating for the Environment

When a Lixie is in an unloaded chunk, its position might be updated once in a while to say it might have moved to another chunk, potentially one that the player's in and is thus loaded. After that, it'd update normally. Simulating AI is hard enough as it is, and environments are dangerous whether you're there or not.

Solution?

I've considered doing temporary chunk updates that simulate any chunk a Lixie is in for a brief moment. Unfriendly creatures and environmental hazards would be checked against its position, and would update themselves as well, resetting the chunk unload timer.

I know this has been kind of a rant, but I need to write out my ideas before they make sense to even me. I know half of you probably won't read this but to those of you who do, I'd like some feedback on how you'd handle AI in a large world, all while avoiding the otherwise inevitable framerate drops.

How do the professionals do this anyway? If any of you have played the Creatures franchise, you'll know exactly what I'm talking about. But those games were done back in the 90s, and they were so terribly complex for their time.

By the way, separate rooms per biome isn't an option, as you can't simulate objects outside the current room. I've considered replacing that with a set of variables but that simply would be too complex.

See my problem yet?

tl;dr narwhal

Comments

JuurianChi 12 years, 3 months ago

Quote:
AI Moving About Non-Existing Chunks
You could create a system that saves the position of the AI and then redraws them as per a certain parameter. For example All AI adheare to the same movement/evoloution rule but special ones like NPCs can multiply those same numbers to make them seem more advanced.

A short scale numbers system that's only as big as your chunk sets.

Castypher 12 years, 3 months ago

Quote:
A short scale numbers system that's only as big as your chunk sets.
I'm not sure I follow.

As for the rest, I guess I should've mentioned that while a chunk is unloaded, nothing in it can interact with anything. While I'm sure you could've gotten that yourself, it's kind of an issue regardless. This means no collisions, only a system of estimates that waters down the AI to provide a fake sense that it's actually moving and doing something.

The good news though, is that I actually plan to be doing this in Unity. But I want to prototype it in GM first so I can learn how to optimize this and make it the most efficient (or at least close) that it can be.

Sadly, it seems a system that fakes AI is the only way to go about this.

BP Scraps 12 years, 3 months ago

omg narwhal

Moikle 12 years, 3 months ago

Quote:
use a timer to keep track of how long the player has been away, and simulate plant growth and animal movement when the chunk is reloaded.
heh, this is the exact same idea I had come up with but never actually bothered to put into practice.

Pirate-rob 12 years, 3 months ago

If the reason you have unloaded chunks is to save on update time then you could do this: When an AI walks into and Unloaded chunk, load the chunk and create a mock version of the chunk then unload the chunk. Then use the mock chunk as a reference for the AI because the mock chunk doesn't need to be updated regularly. Then every now and again reload the chunk so you can update the mock chunk.

Also, Creatures FTW!

Juju 12 years, 3 months ago

Is this a top-down game or platformer?

Castypher 12 years, 3 months ago

This is a platformer.

Juju 12 years, 3 months ago

Hmn, let me sleep on this.