Generating Cyberpunk Cities

 

c2f2e34f72eca9c006e1d2484cdfbf48

Rogue Process is a game about running through cyberpunk cities and making a huge mess of them. The prototype for the game was an endless runner, where buildings were only seen for a few seconds and then thrown away, but now the game has a very different flow and so it needs a different kind of building. Now you break into skyscrapers, plot paths through security, steal targets and execute an escape. Buildings aren’t just important – they’re almost the entire game. So I thought I’d talk for a bit about how I’m creating the buildings in Rogue Process and why it might let you design your own.

View post on imgur.com

I spend a lot of time writing procedural generators in my day job as a games researcher. When I started making Rogue Process, I planned out a few things that were really important for the systems I wanted in the game. First, they had to look like buildings. Games don’t need to be realistic to be fun, but in Rogue Process I really wanted you to feel like these skyscrapers were complex places that had been designed intentionally. So the buildings had to make sense, rooms had to be in the right place, things need a reason to be where they are. Second, I wanted the generator to be easily modified. I want the generator’s buttons and knobs to make sense, to make it easy to change and tweak, and maybe even make it accessible enough that modders could change the generator on their own.

Just like building a real skyscraper, Rogue Process goes through a few different phases – first we put up the walls and basic skeleton, then we fill in the different rooms, and then lastly we bring in the decorators and interior designers. Putting the walls up is quite simple – we give the generator empty room blocks of different sizes and ask it to stack them in a tower – a bit like filling in a Tetris grid. At this point we don’t really mind what the generator comes out with, but we might throw in a few rules – like “every building has to have at least one big room”, or “don’t fill the building with more than a third 1×1 rooms” (they’re really boring rooms).

Click to see a big version!
Click to view an enormous version!

Once we’ve got our skeleton ready, we need to fill the empty room blocks with interiors. The rooms are there partly to make the levels feel nicer – to give the buildings a sense of variety and place – but we’re also adding in mechanical purpose to them too. Surveillance rooms might have centralised servers that control cameras across entire buildings, for example, or a CEO’s office might have keycard access to the Level 3 Research Labs. We’re still adding a lot of this in, and it’s a huge art challenge as well, but you can start to see room identities coming through in the gifs and screenshots.

The upshot of this is that we have certain rules about how we want these rooms to be arranged, but we don’t care about the layout beyond that. As long as the rules are met, any combination of rooms should be fine. We specify rules using a logical kind of language that can require all kinds of different things. Here’s a few examples:

  • Executive offices must always be on the top two floors (CEOs always get the best views)
  • Vault rooms must be connected to only one room, and that room must be some kind of security-based room
  • Elevators and corridors must connect two important rooms together (i.e. they can’t be dead-ends)

Each room has its own little list of rules and specifications that we wrap up into a catalogue. Then, when we want to generate a skyscraper, we choose one of the catalogues and ask the generator to only use rooms from there. So we can have a catalogue for generating buildings with lots of research labs and experimental testing areas, and then for the next building we can swap it out for a different combination of rooms and rules, which might have the occasional lab but is mostly executive offices and board rooms.

screen2

Once the rooms are all in place they call one of a number of ‘room decorators’ which are bits of code that know how to lay out a particular room. Research labs have their own tileset, always have lots of machines in, sometimes have prototype items in them – all of this is handled by the decorator. The great part about this system is that all of the functionality – from rules to decorating a room – are all written away in separate bits of code, and all you need to do to create a new kind of building is write a new room catalogue. I’m going to write a few for the game’s different city sectors, but I’m seriously considering opening up the specification so that players can write their own room catalogues using existing rules, room decorators, and so on. Then you’ll be able to craft your own little block of buildings with a unique personality and set of challenges, but still different and new enough for you to play yourself.

The generator has some quirks to it: right now there’s technically a chance that it could take until the heat death of the universe to generate a single building. But that’s pretty unlikely, and I’ve got some failsafes planned to make sure you don’t have to wait more than a second, let alone a universe-lifetime. In practice it takes just a few frames, which is great news, and there’s lots of interesting variety emerging from these simple rules. Once the rooms have more mechanical character to them, we should see some really interesting scenarios emerging from each and every building!

That’s all for now. I have some future blogs posts planned about how we’re generating evil corporations, how the game’s evolved since the jam, and how we’re planning to open our game up to everyone. Something in particular you’d like to know about Rogue Process? Let me know in the comments or on Twitter. Thanks for reading!

Screen Shot 2016-02-02 at 04.37.39

Leave a Reply

Your email address will not be published. Required fields are marked *