November 14, 2017
Discover How Frogwares' 'City Generator' is Saving Valuable Time During Development of 'The Sinking City'
As with any open world game, one of the main challenges is to create a world that doesn’t get boring - both from a gameplay and visual point of view. Today, we want to talk to you about a solution that we created in Unreal Engine 4 that will help us with the latter. A tool that helps us create visually varied streets and city districts, with just a simple click of a button. We called it the “City Generator”, and we would like to tell you how it works.
So imagine this problem. You are creating an open world game which is set in a city. Now, if you take 1km by 1km of a city, that’s 17km of streets. If there are house on both sides of the street, that is 34km of building space. An average house has 20 meters, so 34km divided by 20 meters equals 1,700 houses. And apart from houses, you need landmarks, public spaces, street furniture (lamp posts, bins, benches, advertisements, etc etc). And that’s just ONE SQUARE KILOMETER!
Now, it gets better. Part of our city is flooded, so elements of decay and water come into play. Also, the city is divided into specific districts, such as different neighbourhoods (ie, poor area vs rich area, etc) and districts, meaning, different building will be present in those areas. As you can see, a rather big problem arises - you need a lot of time and money to create a lot of assets. Or, you can use a tool that we developed, and let it do 90% of the job for you.
You’re probably thinking “well that’s all fine and great, but how does it work”? Well, let us tell you a bit about it. We created this tool which is built around what we call “The six steps of happiness” (the name is still pending :) ) - the six steps of generating ready-made streets with varied buildings and other elements. And let us break down these steps... step by step ;)
Step 1 - So the first step that we do is we create elements of buildings. These elements will include things like doors, archways, pivots, sockets, windows, etc etc - elements that will make up your building. These elements of buildings will be for both commercial and livable/normal houses. All of these elements are created by hand, and also follow the 16 architectural styles and types of buildings that we found existed in the 1920’s in around the Boston area (that’s where our game is set). Once we have a database of individual elements, we move on to the next phase.
Step 2 - Create prefabs. Prefabs are what you might call presets of an area type/the buildings you might find in a given neighbourhood. So, what we do is we create prefabs of building types that have their own specific rules, such as rich houses, poor shacks, destroyed, full, specific architectural style, commercial, housing, etc. We build these prefabs based the library of elements that we created in step one. And once we created our prefabs, that’s when the magic will slowly happen…but, there’s just one more step to the finale.
Step 3 - Create a City Grid. Based on our research, concept pieces, narration, and our very own architects, we create a 2D vector of a city grid. Within it, we also specify the different area types, such as “in this area of the city, that’s where the rich area is, while over here, that’s where the commercial zone will be” (this is a very simplified version of the long discussions that we had on this topic, but we hope you know what we mean). And now, for the trick.
Step 4 - Generate the City. So, once we created all our elements, followed by our prefabs, and once we created our city grid, we press a button. And from there, our tool, with the help of UE4, generates the whole city by itself. All the buildings, all the districts, areas that are flooded, areas which you can access by foot, different building architectural types, street furnishing, road types, etc. All this hard work that would take a numerous people to do has been done by the tool and the engine itself - it’s kind of magical when you see it, and feels a bit like playing a city sim game. Now, to be fair, we do have to go “inside” the city, and provide a few human touches, but 90% of all the work has already been done for us - we just go in, and do the last 10%. However, the need for creating and placing thousands of buildings by hand is gone.
Step 5 - Insert Gameplay Elements. Once the city has been generated, we then look at our story and start placing “life” within it. What we mean by that is we start to populate the city with people, NPC’s, creatures, passers by, etc. We’ve made our life easier by being able to assign specific buildings to specific NPC’s, such as “this building belongs to a specific NPC, and she will be in this building for these 12 missions”. We can do the same with creatures, and other “living subjects”. This is the part where we make the city come to life and give it “fun”.
Step 6 - Optimization. The last feature of our tool might not be as sexy as the rest of it, but it’s important and makes our lives easier. As production goes on, the city itself might change - it’s the way gamedev works. So what we’ve done is we created full flexibility within our tool, meaning that throughout the course of production, we can modify our city dynamically. We can shape and mold our city like clay, changing its dimensions, arrangement, etc. It’s a godsend, because any changes that we deemed are required doesn’t mean that previous work goes out the window - we can play with the city to our heart’s content.
To say we are happy with our city generating tool is a bit of an understatement - we’re genuinely ecstatic and proud of it. However, this tool would never be possible if it wasn’t for the ease in which it can be implemented and developed within Unreal Engine 4. Everyone talks about and praises the visual aspect of UE4, but for us, apart from that, it’s the ease in which we were able to develop our tool that made us fall in love with it even more.
Right now, we have created over 4,000 buildings, created streets with their own individual names, saved hundreds and hundreds of hours of work, and our City of Oakmont is slowly taking shape. However, there is still a bit to go, and we will keep you in the loop on how our game is progressing.
Thanks so much for reading about our tool that we’ve made and how it helps us in creating The Sinking City. We are working hard on our game as we speak, but thanks to Unreal’s engine and help, we can make our vision stronger and on a much larger scale. We always want to keep the horror within our game, and not in our workflow. Thanks to our tool and UE4, we can certainly do that :)
If you want more info on our game The Sinking City, you can follow us on Facebook, Twitter and YouTube.