datalurkur / Mountainhome

A detailed and intricate worldsim borrowing from the Dungeon Keeper-style dungeon-building mechanic
You're lookin' at it.
6 stars 2 forks source link

Separate the concepts of 'World' and 'Terrain'. #52

Closed StLoch closed 14 years ago

StLoch commented 14 years ago

This has been a source of confusion for a bit now. We need to solidify the concept of Terrain as the actual ground in the world and the World as the actual overarching object that maintains all actors, the terrain, the cameras, etc...

And just to clarify:

World contains camera, terrain, and objects and provides the basic container for typical world state and an interface that the EventTranslator and various ruby scripts can call into to affect the world in various ways. It's essentially the object that the user works on when he's doing stuff.

datalurkur commented 14 years ago

I'm thinking we should try storing the terrain in a 3-dimensional array once more. Hopefully we can store all the information we need in very little space (basically, a type, which I imagine will fit into a byte; we can always promote to short later if we need to).

Something else I've been thinking about is how to handle liquid. We definitely need to decide whether liquids are Objects or Actors. One could argue that liquids have more of a direct effect on the things they touch than tiles do (such as water eroding a tile it passes over or lava melting a dwarf who falls into it), which would seem to suggest that it needs to be an Actor. If that's the case, we need to discuss whether we'll allow the TerrainBuilder to use Actors to erode itself, or if it will just use some pseudo-water/-lava algorithm instead.

datalurkur commented 14 years ago

Something else to consider is the effect of large bodies of water on performance. I think we should consider treating liquids specially and have a concept of liquid "pools". Basically, we keep track of contiguous pools of liquid and treat them like one actor, checking the edges to see if things enter/exit/affect the pool. If we're clever enough about it, we might even be able to use this to simulate things like pressure.

StLoch commented 14 years ago

"I'm thinking we should try storing the terrain in a 3-dimensional array once more. Hopefully we can store all the information we need in very little space (basically, a type, which I imagine will fit into a byte; we can always promote to short later if we need to)."

This is already how we're doing things. I have other suggestions as to how to actually store things. They should be ACCESSIBLE as a 3 dimensional array, but it's unlikely this will be the actual representation within the Terrain object. I'll expound on this in a separate comment or ticket.

Liquid won't be an actor. It will be handled separately. Actors are for objects in the world like plants, trees, dwarves, doors, etc...

I'm also tempted to consider liquid as just a property of tiles, simply tracking how much liquid is in a given tile, sort of how DF does it.

datalurkur commented 14 years ago

Issue description updated to reflect the progress that has been made.

datalurkur commented 14 years ago

Loch, can you explain a bit more indepth the relationships between MHSceneManager, TestSceneManager, and Terrain in this new implementation you're describing? I'm not sure I grok why you want to subclass TestSceneManager from Terrain. In our current implementation, the World class creates the Terrain object, so am I to assume that either World has knowledge of the TestSceneManager (mixing gamestuff and renderstuff?) or the Terrain object is created externally and passed in as a pointer to World?

datalurkur commented 14 years ago

Issue updated to indicate that MHTerrain now populates the MHSceneManager directly, rather than via TestSceneManager.

datalurkur commented 14 years ago

Loch, currently MHSceneManager doesn't do much scene managing. The method we use to keep track of entities is basically attaching them to the root node in SceneManager. Do we want to just bypass SceneManager's code and write the octree in MHSceneManager without regards to its superclass, or properly abstract SceneManager and make MHSceneManager a concrete implementation of it?

StLoch commented 14 years ago

Nuked it.