To start off- I’ve done a bit of searching, but wasn’t able to find too much information on earlier conversations about z-levels, multistory buildings, etc. I don’t know how controversial this topic is or how much effort has already been put into some variation on this idea, but I feel like that adding multistory buildings to the game would add a lot to gameplay. I’ve got no idea what any of these proposals would do to performance, game balance, etc. at this time.
I’m a developer by trade but I’m not intimately familiar with the codebase for the CDDA project. Anything below is based on a week or two playing .9+ and a few wandering investigations of the github repository.
My intention is to start a discussion on how currently existing features could be leveraged to add more depth to the game map.
The big thing I think most people could agree on is that to add any sort of z-levels you don’t want to overhaul the current engine or mapgen process. Discarding already existing content due to changes in the engine would also be right out. Underground area generation is simplified because everything can be populated “freeform” and doesn’t require a priori knowledge of the contents of upper or lower z-levels beyond transition points (staircases, manhole covers, etc.) I’ve been thinking on how we could re-use existing systems to expand the world of cataclysm without a massive re-work, and in no particular order here are some talking points:
Proposal 1- where does all this second-story content come from?
Copy z=0 maps to z=1+ for appropriate map blocks after z=0 has been generated. This is similar to the current system for labs, sewers, basements, etc. but will ensure a matching floor footprint. For example, if an “up” staircase exists in a house, copy the dimensions of that z=0 floor and use that to generate the second story. For now lets not worry about things like exterior doors and whether or not people should have kitchens upstairs. This simplifies the map generation process since we already know we have a logical construction footprint. The current JSON map system could also be easily expanded to cover custom upper stories if that’s deemed worthwhile. The immediate impact of this is multilevel buildings (albeit somewhat janky ones) without much development effort beyond adding stair placement logic.
Proposal 2- but what about the massive amounts of data?
Only generate Z>0 map content for appropriate locations. As I understand it, the current system uses a mapblock or chunk system to generate map regions. This proposal is just that a given Z level will not be added to the map unless there is a building with a floor at that level. Tower blocks might end up ~10 levels high, but the adjacent block with a couple houses and a store would not need to be generated above 2 stories. This cuts down on the amount of data to save and process, as the system won’t need to generate and track all the “empty air” above buildings. Areas like forests would remain largely the same.
Proposal 3- what the heck is outside the second story?
Above z=0, exterior map squares (as in not “floor”) adopt the contents, type, and appearance of z=0. I don’t know what this implies in the code, but ignoring the z-level when retrieving square contents seems to make sense. I don’t know if this is feasible, but hey- it’s a proposal.
Proposal 4- The nitty-gritty of interacting with exterior squares above ground
This builds off of (1). Implement air as an area affect/trap that is applied to a map square. A teleport trap, to be precise. I believe this is already available in the current code in the form of a teleporter or explosive trap that displaces objects. When a character, monster, NPC, or item enters a square with the “Open Air” trap, they are teleported to (i,j,z=0) and take some amount of damage as deemed appropriate by the devs. Something like (20-STR)(Zstart-Zend)^2 damage to each zone would imply that a one-or-two story leap is survivable but dangerous but a 3+ story fall is probably deadly. Items take (weight)(Zstart-Zend) damage or something like that, destroying large glass containers and the like. As with other traps, there should probably be a “are you sure you want to walk into open air?” warning and certain items or skills would reduce or negate the effects- similar to wearing rubber boots and walking through spitter acid (that’s a thing, right?). If possible, the trap/template should also restrict retrieving items and exploring the square, so things can only be “dropped” and “viewed”. The trap should also apply a visual modifier to the square (gray background or something) similar to the acid splash or electric cloud effect. The perception requirements to perceive it’s a trap could be set arbitrarily high so that the player doesn’t see “it’s an open air trap” or something like that.
This seems like a nice way to implement falling as it’s easy to understand and still applicable even if there are eventually wacky scenarios like hot air balloons or helicopters or something. By default this could be applied to any map square above z=0 that isn’t “floor”.
Proposal 5- ranged weaponry
Targetable range is not affected by z-level, but accuracy/hit chance is. I’ve not looked at the ranged weapon code, so I’m making the assumption that the range is calculated again based on the map square distance after the fire action has been selected. I would imagine having squares above ground “adopt” the contents of the ground-level square as per proposal (3) would simplify this.
That obviously doesn’t cover everything, but hey- I figure it’s enough to start a conversation on the topic. I’ve been loving this game but I was pretty bummed when I found out office towers only have one story and a massive parking garage below ground. I’d also be more than happy to contribute to seeing this done if it’s something the community thinks is worth tackling.
Thoughts?