High Level Goals
I've been thinking about the end goal of 3DWorld's procedural city and buildings system. I feel like this is still many years away, and I have lots of crazy ideas that will take hundreds or thousands of hours to implement. I really plan to make procedural cities and buildings only a small part of the overall procedural universe.
The long term goal is to have a set of galaxies with solar systems, stars, planets, and moons. The player can land on each planet and moon, and these can contain various biomes with vegetation, cities, etc. depending on their parameters (radius, temperature, atmosphere, amount of water). Each city will have buildings, road networks, vehicles, people, etc. I want to have land vehicles, air vehicles, and water vehicles. People (or some type of sentient organism/being) will be in the vehicles, in the buildings, on the sidewalks, and walking on the terrain.
I actually have most of these individual pieces by now. I have the universe/galaxy/solar system/star/planet/moon code in my universe mode with its own ship battle gameplay. I have limited cities with a grid of roads, where each city is connected to its neighbors by longer roads. I have cars, trucks, and helicopters. I have people on city sidewalks and inside buildings. I also have buildings with full interiors in both the city blocks and surrounding suburbs. These are a mix of houses, small commercial office buildings, and larger office towers. I have procedural terrain with a generated heightmap, erosion, water, grass, trees, and plants. What I'm missing are all the pieces to tie these different parts together, plus many bits of missing functionality. For example, I have yet to add roads connecting secondary buildings and people in cars. I also don't have a continuous transition from space to heightmap terrain.
Anyway, that's all a long way off. Right now I plan to add some type of incremental gameplay with these procedural buildings. I want to keep it relatively simple and try to use as much existing code as possible without having to implement many new large systems. That means it has to be done with the existing cities, buildings, cars, and people, plus whatever incremental additions are needed. I prefer to have more of an open world game, so that means it should use the secondary buildings rather than being constrained to the smaller gridded city blocks. That also means I can take advantage of the higher detail and better window placement/drawing of the smaller buildings.
I'm not too interested in the difficulties of multiplayer gameplay, and I have no idea who I would play against. Therefore, it should be a single player game. The existing people I have in buildings can be the enemies, since they already have a basic AI that can navigate the building and find the player. I was leaning towards making those people zombies so that I can get away with their current state of poor AI and poor animation. It's much more forgivable to have a zombie (rather than a normal person) running into walls, getting stuck on furniture, taking the long way around, and only moving their legs. I prefer not to write a complex animation system. Maybe if I can put their arms out in front rather than having their arms in the T-pose that would look okay.
My goal is to have some sort of open world game where the player is encouraged to explore the buildings with some form of excitement. Maybe I can have it be some type of survival game where the player collects food from refrigerators and bottles from the tables/desks/counters to drink. I can add some secondary goals such as collecting items from desk and dresser drawers, or maybe rescuing people. Item collection could be in the form of robbing the house of valuables, something like breaking-and-entering mixed with zombies. I can't say I've ever played or seen a game like that before. The player must complete these tasks while zombies are trying to catch and infect them. I can also add other damage types such as fall damage from the roof, stairwells, and elevator shafts.
Zombies track the player based on a combination of sight and sound. They'll wander around the building randomly until they either see or hear the player, then they'll converge on the player's location. One touch from a zombie and it's game over. Or maybe there's some chance of pushing the zombie away, with a cool down timer. The idea is to keep the player moving and force them to pay attention and avoid getting surrounded or trapped in a dead end room. The more time spent in any one building, the more dangerous it gets. It's up to the player to know when to give up searching and make a run for the exit. I'm not sure if I'll add dangers out in the open between buildings.
I haven't yet decided if I want the game to be funny, scary, or a bit of both. I'll just have to experiment to see what I like best. I don't plan on adding combat with zombies or any sort of violence. This is a survival + stealth + run-and-hide game, not a combat game or shooter. The goal is to outsmart the zombie hoard rather than defeat it.
Here are some details for how gameplay may work. This is the first draft and is subject to change. The player can control building lights, close and lock doors, use elevators, and create distractions.
Lights: Room lights start randomly on or off. The player can only search a room for items when the lights are on. However, zombies can see the player from a greater distance if the lights are on, or maybe if the player is lit by at least one light (not fully in shadow). Zombies will also be attracted to the area if they see a light switch on or off. The player can also have a flashlight that can be use for a limited amount of time and has less of an effect on zombies. The player can only inspect items in their flashlight beam, but zombies will react with rage when the flashlight beam hits them.
Doors: Most interior building doors start open. The player can close doors at any time. Closed doors block line-of-sight for zombies and make it easier for a player to sneak around. Closed doors muffle sounds behind them. They also stop zombies for a few seconds while they figure out how to open doors, making this an effective way to slow them down. However, opening and closing doors will make noise that draws the attention of nearby zombies. So it's a choice the player has to make. I would also like to add the ability for the player to lock doors. This takes some time, maybe a few seconds. It will them slow zombies down as they take time to break through. Once a door is broken it can no longer be locked. But be careful - it takes a few seconds to unlock a locked door, so you better not accidentally lock the door to your escape route!
Closets: Closets have doors that can be opened and closed as well and act like tiny dark rooms. The player can enter the closet and hide there. Zombies will rarely look in closets, unless they see a player enter one. But be careful, there's no way to see what's outside. Maybe a zombie is standing right outside the closet door!
Noises: Zombies can hear player movements from a distance that depends on the sound level. Opening and closing doors makes a lot of noise and can be heard from far away. Opening and closing drawers makes somewhat less noise. Picking up items make a bit of noise, and even walking makes a small amount of noise that can be heard by a zombie in the same room. Standing still is the only way to be completely quiet.
Distractions: The player can pick up items they find such as the existing books and bottles I have scattered around on tables, desks, and counters. These go into one or more inventory slot(s). Then they can be thrown into a room to make a noise that distracts nearby zombies. Need a quick exit? Throw a bottle to the end of the hallway opposite the exit door.
Elevators: The player can use an elevator if it's stopped on the correct floor and they avoid falling down the elevator shaft. Zombies can't use elevators. This is a good escape route for office buildings. I'm not sure if I want to allow zombies to fall down the elevator shaft after the player.
I think those items could make for some pretty fun and interesting gameplay.
Keep in mind that zombies are relatively slow compared to the player, maybe half the player's speed. They're easy to outrun (and lose) if you know where you're going and don't get stuck. They're still dangerous in a variety of situations:
- When you're not paying attention while searching and a zombie sneaks up behind you
- When a zombie corners you in a dead end room with no exit to escape through
- When multiple zombies approach from different sides and you have nowhere to run or hide
- When you turn the corner or open a door and run into a zombie
The good news is that I have almost all of the code setup to do this. Building exteriors and interiors should be complete enough for gameplay. The player almost never gets stuck, and 95% of buildings should be fully accessible (all rooms can be reached). The AI I have for people may already be sufficient for zombies. I have the random walking and logic to have them converge to a particular location or room. That allows them to navigate to the location of a sound and follow the player. I already have items such as bottles, books, and office supplies that can be collected or thrown as distractions.
I just recently added sounds for light switches, door opening and closing, and walking. I can add sounds for zombies as well. The door and light switch sounds can easily be hooked into the AI alert logic to have them converge on the source of the sound.
I already have a key command that the player can use to switch on and off both ceiling lights and lamps in rooms. This affects the ambient light level in the room. I have light ray casting setup so that it should be easy to tell if the player is lit vs. in shadow. AI people can also turn lights on when entering a room, and similarly turn the lights off if they're the last person to leave the room. I don't expect zombies to turn lights on or off though - they just don't care.
Exterior doors automatically open and close when the player enters and leaves the building. I just recently added the ability for players to open and close interior doors. There's a new open_probability parameter that will control what percentage of doors are initially open, and I plan to keep it near 1.0 (100%). When closed, the door acts as a collider to block both the player and other AI people inside the building. I should be able to do a visibility ray cast that handles doors as well. The AI path finding/navigation system understands closed doors and has a flag that can either tell the person to go around or open the door and walk through.
The player can also already open closet doors and enter closets. I haven't worked out the logic for what happens if they close the closet door and lock themselves inside yet. I'll have to make the closet dark inside so that the player must use their flashlight to look around.
It might be interesting to add basements to houses. These work like normal floors, except they have different room type assignments with different objects and no windows. The lack of windows means that they're extra dark, to the point where the player can't see where they're going without a room light or flashlight. One difficulty of basements is that they're below terrain level, so I'm not sure how I can make that work in the current buildings system.
Finally, I already have tiled terrain mode hooked into the existing ground mode gameplay system with a health bar, fall damage, death tracking, etc. I have onscreen text and bar displays for all of this. And I have collision detection with people implemented. Those are some of the core components needed for gameplay.
That's almost all I need for this proposed game. I just need to implement the item collection system, hunger, thirst, stamina, etc. meters, the high-level gameplay logic, inventory system, zombie activation logic, etc. It shouldn't take too long to complete all of this as these are all incremental tasks. Of course I'll probably get distracted by trying to fix dozens of other things in the process. Hopefully this won't put me too far out of the way for reaching my longer term goals.
Sorry, there were no screenshots or videos in this post. I'm just doing some thinking. At least it's not very technical. I'll continue with plenty of screenshots next time.