Procedural Generation of a Cityscape – Proposal

Outline

My project will attempt to use PCG (Procedural Content Generation) to create a city-like environment. I will begin to explore different algorithms and methods and analyse the generation time as well as the representation of a feasible city landscape.

The city should be generated at runtime and each execution should generate a different city for the user to explore. The end result will be a full formed 3D environment that is able to be explored by the player in a first-person perspective.

Rationale

Procedural Content Generation has been an aspect of games that has interested me for a long time. It has been a part of games for a long time ranging from level generation to difficulty scaling to item stats.

Having PCG incorporated within a game gives it more of a mystery and extends the level or replay ability for the users.

Areas for Investigation

There will be numerous areas for me to research over the time of this project.

  1. What algorithm/method will be the fastest to generate a city landscape?
  2. Alongside the speed of generation, I have to also consider which algorithm will give me the most realistic layout of buildings that it actually seems like a modelling city rather than a generated one.
  3. I must investigate whether generating the whole city upon game start will be more beneficial to the player or if it will carry on to generate as their location becomes closer to the edge.

Knowing the best approach based upon these three questions will be beneficial to my project making the generation ideal and the game more enjoyable to the player.

Background Research

So far in my project I have done background research on Procedural Content Generation in general and the algorithms that are used most commonly. My starting point will be to explore the use of L-Systems to generate the city. I will also see how a grid based system could be of use in this circumstance.

I have also had a look into existing games that already use PCG such as Path of Exile, Diablo, Doom 2 where the levels are generated. Games like Minecraft and Terraria where the initial level is generated upon start and extended as the player explores. The Left 4 Dead series uses PCG to place items, Borderlands goes a step further with this and also uses PCG to generate the stats placed on the items found by the player. The Elder Scrolls III: Morrowind uses Procedural Content Generation in a less prominent way to create the water effects on the fly.

Literature Review

Journals or Surveys that investigate the wide variety of uses of Procedural Content Generation in games [5] will help me to better understand why they are such a key part in today’s industry.

For the generation to feel like an authentic and realistic city, trying to understand different layouts for real cities [6] would be a huge benefit and could be used in the generation rules.

Any other journals or websites that can give me any knowledge about Procedural Content Generation in games [3][7] will be a huge help or how Procedural Content Generation can be used to render whole cities. [1][2][4] This will give me a starting foot and to see what different approaches have already been taken.

Methodology

To start the project I will begin to develop the Procedural Generation method so that it generates a 2D city layout without actual buildings. Once this has been successful and I have explored different approaches and algorithms, I will build upon what I have with the chosen method and transform it into a 3D cityscape.

The development method I have chosen is ‘Agile’ with 2 week iterations. I have chosen this method as I have experience with it in industry and have a good understanding in how to use it so it will benefit me with my product. Using Agile development will allow me to keep track of key areas that need to be done and gives me an idea of how fast I am working through features.

My product will be created in Unity using C#.

Research Ethics

There are no ethical aspects of my project that I will need to address and there should be no clearance needed in this area.

Project Plan

My product will have a few different stages of development for me to focus on. The first is the 2D rendering with the chosen method, the second is the 3D rendering build on top of the 2D aspect. Finally there is the user input and UI elements.

So I have enough time to complete the project I will aim to have the 2D city layout and a solid method for generation completed and the conversion to 3D started by late December with full 3D rendering completed by February.

Two days a week will be spent on the project, with every other day of the week being focused on a different module that I am also studying. Sundays will be left clear of work as it is American Football game day which will require my attendance.

Project Deliverables

My project will be a 3D procedurally generated cityscape that can be explored in first person. The city will be generated and rendered upon application start and each successive restart will generate a brand new layout for the city.

References

[1] LECHNER, T. & WATSON, B. & WILENSKY, U. & FELSON, M. (2004) Procedural Modelling of Land Use in Cities [Online] Available from: https://ccl.northwestern.edu/papers/ProceduralCityMod.pdf

[2] PARISH, Y I H. & MÜLLER (2001) Procedural Modeling of Cities [Online] Available from: http://www.cs.berkeley.edu/~sequin/PAPERS/Parish_Mueller_Cities.pdf

[3] PCG BOOK (2014) Procedural Content Generation in Games [Online] Available from: http://pcgbook.com/ [Accessed: 23rd October 2014]

[4] GREUTER, S. & PARKER, J. & STEWART, N. & LEACH, G. (2003) Real-time procedural generation of ‘pseudo infinite’ cities [Online] Available from: http://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0CDAQFjAB&url=http%3A%2F%2Fprocedural.googlecode.com%2Fsvn-history%2Fr118%2Ftrunk%2Farticles_cities%2Fgreuter-03-real-time.pdf&ei=I4BJVI6rAsqS7AbP04DIDQ&usg=AFQjCNHY4zGOqb93SESqBV98V1poVwOdwQ&sig2=bmDP0kIkAj_wEOZQxllMWQ&bvm=bv.77880786,d.ZGU

[5] HENDRIKX, M. & MEIHER, S. & VAN DER VELDEN, J. & IOSUP, A. (2013) Procedural content generation for games: A survey [Online] Available from: http://www.pds.ewi.tudelft.nl/~iosup/pcg-g-survey11tomccap_rev_sub.pdf

[6] MOTHERBOARD (2014) There Are Only Four Types of City in the World, Says Math [Online] Available from: http://motherboard.vice.com/read/there-are-only-four-types-of-city-in-the-world-says-math [Accessed: 23rd October 2014]

[7] GAMES BY ANGELINA (2013) The Saturday Paper – A World Just For You [Online] Available from: http://www.gamesbyangelina.org/2013/07/the-saturday-paper-a-world-just-for-you/ [Accessed: 23rd October 2014]

Homicidium – Finishing Touches

The basis of the game has been completed and can be played with two players. The only things left to do for the hand in are small, finishing touches, mainly to do with the visuals.

The first task was to add lights to the map. As we were doing this, we encountered a problem with shadows from the main directional light in the scene. All of the shadows from the models cut off half way through, as if they were intersecting the floor plane. It took a while to find the source of this problem, but it ended up being the bias being set to 2 instead of 0.

To make the application look professional, we added in a custom icon for the task bar along with a mouse pointer.

On the main menu, we added in a section for controls where it displays an image of the mouse, keyboard and a controller for the user to view. This is accompanied with annotations detailing what each of the buttons do once in game.

Particle effects were also added to the map. A combination of fire, smoke and ambers were created and pieced together in the braziers by Gary for extra visual effects. I also created a small script that is placed on to Point Light objects that make their intensity change at randomly intervals to create a flickering effect.

The last particle effect that was added was dust. I played around with some values to create a kind of whirlwind visual with dust particles swirling around the outside of the Colosseum. This small touch added to the atmosphere and instantly made the game look much more player and appealing.

There are many more features that we are hoping to add into the game such as networked games, 4 player co-op, a new camera system, soft locking when in combat, weapon pick ups, more characters, more maps, level traps the list goes on.

Homicidum – Final Models, Textures and Animations

Today we replaced all the models and textures with the final, updates version. The animations for the characters were also added to the game including attacks, cheers, ducks and idles.

Once all of the models were in the Unity project, I assisted with piecing together the map. The models for the map are all individually modelled, down to each crate and barrel. This task was frustrating as this was the Level Designers job and it was left to a Programmer and an Artist with no input from the Level Designer at all.

Even so, the map was created quite quickly and started to take shape with all the textures and detailed models.

To get the game to a standard that is suitable for the hand-in, there are a few more finishing touches that need to be implemented such as lighting and little configuration changes.

Homicidum – In-game UI

After the main menu was completed, the next piece of UI that needed to be completed was the in-game HUD for the players. This was not thought about in much detail as we were told by the UI Designer that he had it under control. We did manage to come up with a simple and clean layout that had all the essentials displayed.

The health bar is displayed in the bottom left of each players screen and is rendered on a dark background. No value or percentage is shown, this is to keep players guessing on how much more damage they can possibly take steering away from hiding away from the action.

The players score is displayed in the bottom right of the screen and is accompanied by a label, ‘Score’.

In the top right there is the timer, which displayer the pre-game and main time depending on what is relevant. Above the timer is the minimap which I started to develop. At the moment it is just a birds-eye view of the map with the players not being rendered by it. This will eventual be changed to a radar style map showing the locations of players, we made this decision after testing the gameplay and finding it fairly difficult finding the other player when there is only two.

Homicidium – New UI System

Since our UI Designer has not produced any work so far after 6 months of development, the responsibility has fallen to me to create it.

We decided that the temporary UI system was not sufficient for the final game as it was too buggy. Instead we used the new UI tools that were added to Unity 4.6 and change the main menu to be mainly 2D based.

The menu can be navigated with both the keyboard-mouse and controller inputs which is suitable for all players. The character select screen with the 3D models being highlighted by spotlights is functional but does not currently allow the player to selected a character.

This new menu runs a lot smoother, is more stable and looks much cleaner and appealing. The menu buttons were made by Gary and the main background was creating by Sary.

Overall this new menu seems to fit the game better then the last one and does everything that is needed at this time.

Homicidium – Merging in the Combat

Today we merged in Richards work on the combat into the game structure I had previously set up. It seems to work very well with the IInputs that is used to control the players.

The combat works with a new method of using an event type system.

Implementing this system with the game mode structure that was added to the game last week was an easy task and makes the game playable. Some testing and experimenting with weapon damages and player healths still needs to be done to configure the gameplay.

Homicidium – New Input System

The input manager that comes built in to the Unity engine is very limited for what we want to do. It requires a fair bit of modification in both the editor and code every time we want to change a control around.

I did some research into this and found that it was quite complicated and required extensive work to implement our own system, so instead we managed to find a free framework made by somebody else that was fairly easy to extend and modify for our own needs.

Using this system made the input much more stable and easy to modify when we need to.

Homicidium – Game Modes

The game modes have now been set up and use a common interface. This allows us to implement whichever class is needed. At the moment only the Headhunters game type is implemented but a Last Man Standing template is present to show the process of creating new game modes.

The Headhunters game mode has a pre-game timer (where the players cannot move as the game starts), a game timer and once the game is over, there is 5 seconds where movement is disabled and the game displays the winner.

A score limit is stored but is not used at the moment, this will be implemented when the game types eventually get more complicated with assists or team points being included rather then just the kills.

Procedural Generation of a Cityscape – Fly-Away Controls

I have managed to implement simple ‘fly-away’ controls for the camera. This is just to make it easier when exploring the city and to monitor the outcome. Clamps have been implemented on the Y axis to stop the user being able to rotate the whole way around, this will come in useful when the camera view is changed to be first-person with gravity.

Before I change it to first-person I will looking into adding in some kind of algorithm to consider a ‘centre’ of the city. This will add in a percentage chance of picking out each type of building (Large, Medium and Small) so that Larger buildings are more congregated towards the middle of the centre whereas the smaller buildings will appear more towards the edges of the city.

Homicidium – Huge Improvements

Since my last blog post, a lot has been implemented.

The temporary game menu now also has fully implemented controller support so there is no more need to use the mouse to get into the game if the player intends on using a controller to play. From the main menu the user can currently use the left and right bumpers on any connected controller or the ‘1’ and ‘2’ keys to specify how many local players will be playing. Once this has been picked the game will add in the chosen number of players, splitting the screen horizontally in half if playing split screen. For balancing purposes we have decided to force the players to user a controller when playing split screen as we see this as a controller based game primarily.

Spawn points have been placed around the track so when spawning a player, it picks a random spawn point and assigns that as the starting position.

We have another presentation on the 24th February, 10 days time, where we will present the game in its current state at the time. I am still waiting on the new improved map and updates horse and chariot models, hopefully all of them will have colours on them, even if it is just block colours and not just textures.

Our next step will be to implement game types using the game state (this has been started with simple timers but nothing more advanced then that so far) as well as starting on the combat system since we have the ability to test collisions between 2 players now.