World architecture and internal construction?

I have a WorldMap class that currently stores arrays of Rooms, Regions, and Connections, kinda like a big node-looking map.

  • Rooms are more broad than a house room, a room can be thought of as any one screen, or one level, but much less complex at the moment.
  • Connections connect two Rooms at specific points. The entrances have specific styles associated with them (fancy, plain, (boss!), etc).
  • Regions are simply a bucket of Rooms that will later provide rendering details (styles, etc), so rooms within a Castle region will have brick walls (probably).

My question is, what would JGO recommend when it comes to just how stuff is structured internally? The ideas I have in mind are:

  1. see the above, basically the world is a big bag of everything. Objects have a global identifier instead of more localized ones. Arguably with this approach, I could get rid of Regions and instead make rooms self-contained with stuff for styles and traps and everything else. It feels a lot closer to entity-component-based design at that point, unless I’m crazy, which could potentially work very well for whenever I decide to add dungeon traps and loot and everything else that a game could probably have, since stuff is “decoupled” so to speak.

  2. The world stores an array of regions and an array of connections between regions. The regions store a collection of rooms and a collection of connections between those rooms. The objects would instead have a local identifier value, instead of one as it would be in the entire world. This feels more like regular object-orientated, inheritance-like (or at least tree-like), since the tree of objects is world, region, room. (Connections kinda exist in limbo like branches, whatever) This approach is kinda nice since I won’t have spare rooms floating about that I forget to attach or something. I also don’t want to slip into the mindset that I should try to fit everything into ECS design, because there are some things that I feel just don’t quite jive with it.

  3. Kinda weak-feeling, but posted for the sake of completeness: make each room self-contained, with references to its own paths and the region it is in, along with whatever else might come along. The only problem is that I feel like this is inefficient, not in an optimization sense, but in the sense that I need to store objects repeatedly in different objects and have multiple references. It sounds like a web instead of a well-ordered chaos, and potentially very messy.

Any feedback is appreciated! I’m not looking for hard answers, just for some feedback for those that have likely been doing this for probably quite a bit longer than I have.

[EDIT]: Now that I think about it, this probably belongs in Game Design. Kinda muddled.

I don’t really have an answer, but since you haven’t gotten any replies yet I’ll go ahead and mention a couple things.

People may be slow to respond because it would probably take more of an ‘inside’ view of the problem (which only you have at the moment) to know what solution would be optimal. But, I’ll go ahead and put in my usual plug for data-driven design.

I guess the question I’d ask is if there’s anything about the ‘region’ concept that really needs to be represented at the code level. Would it be sufficient for that distinction only to exist at the data level? For example, the idea of per-region styles sounds like something that could be handled at the data level with proper support. Rooms could just have string tags (‘castle’, ‘dungeon’), and these could be used along with abstract material tags (‘wall’, ‘floor’) to choose specific materials (‘castle wall’, ‘dungeon floor’). And so on for other aspects of the design. Adding a scripting system (if you don’t already have one) might further reduce the need for hard-coding aspects of the world design.

Anyway, that may or may not be helpful, but that’s what comes to mind.

Your WorldMap would have a list of Regions. Each Region has a list of Rooms and Connections between rooms. This is your current design, and it should work pretty well for what you want.

Think of each Region as a universe. The WorldMap has a lot of universes. The universes don’t interact with each other, but they’re all in an area where they’re contained.

The Regions are universes. Each one has Rooms and Connections. Think of Rooms as galaxies and Connections as a wormhole found in the centre of each galaxy. Each wormhole can only go to one galaxy, but they you can potentially have multiple wormholes to multiple galaxies.

I don’t know if that space analogy helped. I hope it did ;D

EDIT: more detail below

Rooms could be generic. They get rendering data from its region (so a brick wall theme for castles, etc.). Connections would do the same. You could also make rooms unique and have subclasses of Room for each rendering type that implement an abstract rendering method for different designs. You can also customize each room (different traps, loot) and make it more immersive that way.

I propose: There are only Regions. Regions have connections, and can contain Regions.