Cows and People and Trees oh my!

4 12 2011

Uppppdate!

Things done:

  • Path finding
  • Getting it to render the terrain fast (super fast!)
  • Wildlife classes including some cows to show it off (they just wander about stupidly, i love them)
  • GUI.
  • Dwarf/Citizens/People follow your orders so you can make them dig places.
  • Small amount of work done in room placement, nice little grid thing which shows you where is valid and where isn’t.
  • Trees (man they look shit, the Unity tree creator is fiddly!)

Next on the agenda:

I keep wanting to add more wildlife stuff (flocking and the like) but i really should put in a game first so I’m gonna work on the room building, do a bedroom and maybe a store room and then make the citizens get sleepy/hungry, I can see that being pretty fun!

Anyway, enjoy the picture! Notice the specular shininess on the terrain, I quite like that and might keep it, makes everything look plastic but in a good way!  First picture is using the in game cam with the GUI and that blue block is the cursor. Second pic is from a custom cam in the editor.

ImageImage





TERRAINARAMA

6 09 2011





We built this city

5 04 2010

Busy week my friends! Such a busy week! So, I’ve not had much time during the week to get much done with Cityscaper because of unplanned Tag visits, slightly more planned Leamington Spa visits, totally unplanned Newcastle visits and even less planned Edinburgh Waverly visits. But lo, this weekend I’ve stormed through and added loads of things! I think I shall put them in bullet point form for easier digestion and then expand a bit:

  • All geometry moved to Vertex Buffer Objects on the graphics card rather than display lists.
  • More efficent handling of generation so roads aren’t all generated at once.
  • Generation techniques seperated into 4 templates: Height based, grid based, radial based and organic.
  • Property Flags.

So, the first point is pretty self explanatory and has improved the framerate of the application quite a bit! Happy days! The second point I cheated a bit and put a limit on how far the framerate counter can go so all the roads aren’t given a tiny framerate and compensate by generating all their road at once which they used to do all at the same time leading to ugly spikes.

Different templates are now used. Grid is slightly improved now as it is locked to compass points rather than straight lines and perpendicular offshoots, this means that if a road stops being grid based and then starts again they can still follow on the same grid pattern. Height based is what the last post was about and is just building the roads based on the line of least inclination. Organic is the basic generation with few limits to where the roads can go so they appear to wander in a nice (organic) way. Radial is a template I just implemented in the past hour and is far from finished yet but it’s a good start. For the radial template roads try to form a circle around some middle point, well they should in theory, at the moment they just seem to spiral into it.

Finally Property Flags. This is what I’m most excited about. Property flags are user defined points with a user defined radius around them that hold settable properties for all the roads that come within the radius of these flags. This leads to super varied city structures with the ability to combine different templates and attributes for roads at different places on the map! Here’s some screenshots to show the flags:

Property flag around hill.

Property flag round hill with generated roads.

Here's a roadmap with a few different flags on it.

Road map with 2 organic flags one rather large and obvious the other much smaller!

And that’s that! I don’t think the screenshots really do the system justice cos it really is pretty darn nifty. Anyway, for the next week I shall:

  • Fix the radial template
  • Add in proper UI support for the Property Flags.
  • Make the road collisions a bit prettier.

You may have also noticed that there aren’t any buildings in the screenshots well I’ve decided I’m not too happy with them and they distract from the majesty of the road structure being formed so I’ve decided to leave them for a bit and redo them when I’ve got the roads out of the way. Until next time blog fans.





Don’t you remember?

19 03 2010

Quick update which is really just me wanting to post some lovely screenshots. Anyway, I rewrote the roads in a more object orientated manner so now there are seperate classes for the two (will be three) seperate types of road and you can adjust the characteristics of each one seperately. So, for example, if you wanted lovely big wandering winding roads but grid patterned smaller roads you can now do that by clicking on the desired road!

I also made the terrain get height function much more accurate which allowed me to create a rather lovely algorithm that finds the best direction for the road to continue on that will see it going up the least steep inclination. Anyway, it’s easier to see with screenshots (of which I have plenty!)

Roads going round the hill!

As you can probably see from the screenshot the road follows the edge of the hill rather than going over it! Anyway, some more screenshots:

Roads going up a hill with buildings

Roads winding up a hill

2 shots from the same perspetive. One with buildings one without. Shows the roads kind of snaking up hill and avoiding the steeper area on the right hand side.

And now for a couple of bmp outputs using my lovely bitmap output tool thingo of generations I left on and forgot about. The bitamp doesn’t output the height yet (it will though, it should be pretty easy since it’s loading the height from a bitmap to begin with! anyway, you can clearly see on the following couple of pictures that roads are following some kind of contour. It looks damn pretty too! Think I’m going to get one of these tattoo’d on my back I love them so much!

Roads on the map, birds eye view.

Same again from a different generation, same parameters as above though!

Anyway, that is all, hope you enjoyed that blog viewer!





Listen to the radio!

16 03 2010

So, because I was in a video making mood (check the past projects page!) I’ve made a video of city scaper, just to show it off a bit!

Here it is:

Apologies for the music! Was listening to stuff whilst Fraps was doing it’s thing, forgot it recorded sound too!





Marconi plays the mamba!

13 03 2010

Soooooo, a week of progress. Before some lovely screenshots I shall list whats been done:

1. Fixed the building to an acceptable degree (i.e. they don’t bloody go across roads). They look pretty snazzy now (well, snazzy for grey cubes). Think i need to tweek the scaling though, it’s a bit off, the roads are bigger than most buildings! Weird.

2. Put in a rather nice profiler that, at the mo, tracks the amount of buildings, the amount of roads and the framerate. It’s helped me realise I need to make the thing a damn sight smoother cos at the minute there is a big bottleneck every 2 seconds where all the roads make new roads. Should be pretty easy to sus that.

3. Made a bitmap output button that outputs all the roads onto a bitmap. Helpful for identifying patterns! Anyway, pictures!

Anyway, for the weekend I haven’t really decided what to work on. I may tweek the roads a bit so they actually stop at the edges of other roads not the middle. I also might fiddle with the scale a bit to make it a bit more believable.

Until next time blog fans!





MATTROPOLIS!

28 02 2010

Soooo, a weekend of solid work that found me working on getting some nice debugging features in rather than actually tweeking the existing ones. Anyway, I put in some nice features such as:

Spruced UI – I actually made the UI look rather snazzy! It’s not perfect yet but it looks ok if you ask me.

Road Selection – you can click on specific road sections now to view details about it

Road hilighting – If you click on a road it will show you which road that road is connected to.

Colidable set highlighting – The collidable set is a list of roads that each road could collide with, it is possible (when the option is selected) to hilight all these roads.

Context sensitive menus – click on a road and it’ll bring up options for the road, click on a building and…it wont do anything but could if it wanted to!

Parallel roads – The program can now work out with roads close by are parallel, hopefully i can use this feature to make roads follow each other.

Anyway, pictures say a thousand words and all that:

Picture showing the new highlighting and context sensitive menu

Mattropolis is an awesome name.

Shows the snazzy new GUI, has transparency and stuff,

That is all for this weekend. Next i’m going to fix up the buildings a bit cos at the mo they are annoyingly rubbish.





Update

27 02 2010

I’m about to commence a day of work now that all my other coursework commitments are out of the way but I thought I’d start by updating my neglected blog with an update of where I’m at. I haven’t done much but I have a pretty solid foundation for laying the roads and some nice joining algorithms. Anyway, probably best explained through the power of pictures:

Generation with buildings off and grid pattern disabled

Generation with Buildings on and grid pattern enabled

As you can see in the photos I have already achieved one massive technological leap that no other procedural generator can lay claim too: I’ve fashioned the ugliest GUI known to man.

Joking aside it is very early days, the buildings may look nice but if you really look close you’ll see they’re far from perfect. They bump into each far too much and are often stupid shapes.

Today though is not about the buildings, today I’m going to get the roads joining up in a nice manner.





Project Proposal final

9 02 2010

Introduction

The city is one of the most complex manmade creations on the planet. Taking shape over decades, if not hundreds of years, no two are the same and each is home to thousands, sometimes millions of people. In today’s game marketplace there are an abundance of video games that use the city as a setting. Many of these games, such as the hugely successful Grand Theft Auto franchise (Rockstar North, 2008) let the player loose to wander about the city as they choose. The cities involved in these games have been hand crafted by a huge team of artists and level designers at a very high financial cost and take many man hours to complete. This project will look at techniques to generate a city setting algorithmically, easing the burden on content producers and allowing for near infinite level variation.

Motivation and Purpose

The game industry is presented with a major challenge in trying to create content that uses the full potential of the hardware on offer, a common approach to this problem being simply to increase the number of artists working on the game to produce more of the content required (Kelly and McCabe, 2007). This project presents procedural techniques as a way of combating this problem in an urban based game. Procedural generation techniques are algorithms that create content algorithmically through preset instructions. Procedural techniques can be utilised to create near infinite variety in content, in this project they will be used to create an urban environment with the purpose of that environment being its use in a 3D open world game such as the aforementioned Grand Theft Auto franchise.

The project will focus on how viable such procedural techniques are within an actual game application. To clarify: the goal is not to create a tool for content producers but to make an automated system that can be placed inside a game for the creation of unique levels. The underlying algorithms will be the same for both a tool and an automated system however since the application is being designed for use within a game the amount of user input needs to be minimal after generation has taken place so good results need to be obtained without the need to edit the output afterwards. If successful these techniques could be used to make a game where each player has a unique version of the game world leading to massively increased replay value in open world city games.

Related Research

There has been some research and development in the area of procedural cities. Most of this focuses on a broad target market and not specifically on games. Procedural Inc, creators of CityEngine, state that their product can be used for: Film & TV, game development, architecture, archaeology and simulation (Procedural Inc, 2010). CityEngine uses extended L-Systems and geo-statistical image maps to produce its cities (Parish and Müller, 2001). L-Systems are commonly used to generate the geometry for organic objects like plant life. Parish and Müller (2001) define an L-System as “a parallel string rewriting mechanism based on a set of production rules”. L-Systems use strings to represent the production rules with each string consisting of a number of different modules; each module includes a set of commands and parameters that are used within those commands. In CityEngine L-Systems have been extended to follow global and local constraints. Global constraints include street patterns and population density while local constraints are things like local streets, land/water boundaries and elevation (Parish and Müller, 2001).

A template based approach is suggested by Sun et al (2002) whereby a predefined pattern is imposed on road creation. Using these templates various categories of cities can be produced that have recognisable real world characteristics. For example using a grid like template would give a city layout resembling Manhattan.

Another example of a procedural urban generation tool is CityGen though this isn’t commercially available. CityGen uses a combination of a template based approach and the L-Systems presented by Parish and Müller (2001). CityGen endeavours to be an ‘interactive’ city generator in that the user can change generated node positions to get the desired outcome.

Addressing the Question

Can procedural techniques be used to create a realistic cityscape to be used in a game application by procedural generation of its transportation network?

To address this question a demo application will be made. The application will not be designed to be a tool used by content creators but instead show off procedural techniques with a high level of autonomy that can be run from within a game application by the end user. Having this autonomy would lead to the game being able to generate unique cities for its players without the need for any extra input. This autonomy is a key design goal of the project.

The slowest changing aspects of a city are its networks, such as transportation and utility networks, its land use and housing (Wegener, 1998). For this project the primary focus will be on the generation of the road network. The road network is the most important for a player navigating the city at street level since it is the space that the player will inhabit. The road network also helps dictate the overall character of a city (Kelly and McCabe, 2007).

For generation of the road network two different types of road will be required, primary roads and secondary roads (Kelly and McCabe, 2007). Primary road networks are the main roads within a city; these roads have a strong influence on the character of a city and define its constituent elements such as neighbourhoods and districts (Whelan, Kelly and McCabe, 2008). The secondary road network is used to connect the main roads to the individual lots. Using different techniques to generate primary and secondary road networks leads to increased variation in the cities’ structure.

The L-System method represented by Parish et al will be used to generate both the primary and secondary road systems. A global shape template will also be imposed on the primary network (Sun et al, 2002). Using this template based approach an overall pattern can be imposed on the main roads of the city while still allowing variation. A raster pattern for example would generate a grid like city similar to that of Manhattan whilst an organic pattern would generate a city similar to Paris.

Many of the methods used in similar city generation application use input data in the form of 2D images to control the behaviour of the generation system (Parish and Müller, 2001). This data can include the elevation map, population map, street patterns or height maps. For this project the only input necessary will be the height map of the terrain that the city is to be rendered on. The inclusion of a height map instead of the city being on a flat plane opens up new development opportunities where the road network can adapt to the height of the landscape.

This combination of the template and L-System based approach is similar to that present in the CityGen application (Kelly and McCabe, 2007), in that application however they give the user the tools to edit the resultant road map manually. For this project the application will be fully automatic once the user has specified a few parameters before generation (such as the template being used). This is to ensure that the results rely entirely on the algorithms being used so that the procedural technique could be used in a game application without any need for the player to be involved with the creation of the city.

After the transportation network has been created lot division will take place. Lot division involves dividing the space between the roads into lots that buildings will fit into. Lot division can be achieved easily by simply dividing the space along each road into blocks and then scanning for overlapping lots that need either joining or repositioning. After lot division has taken place rudimentary buildings will be placed into them. The buildings will simply be rectangles fitting into the allotted space. The inclusion of rendered buildings in the visualisation will increase the realism of the city and, by making it more believable, will make it easier to judge the outcome.

To be a viable generation technique to be used within a game application and not just as a tool the generation techniques utilised must be fairly quick to produce decent results. Multithreading will be utilised to speed up city generation, L-Systems in particular lend themselves well to parallel processing. The vertex count will be kept deliberately low at the rendering stage by having simplistic buildings so that the entire generated environment can be viewed in real time.

The criteria on which the demo application will be evaluated will be the detail, complexity, heterogeneity and realism of the output (Kelly and McCabe, 2007) as well as the time it takes to generate good results. A planned schedule for the project can be seen in the appendix.

Summary

In summary the main objectives of this application will be:

  • Using procedural techniques to create a coherent and believable cityscape.
  • Primary and secondary road systems (main roads and utility roads).
  • High level of variation in outputs
  • Rudimentary buildings set out into lots.
  • 3D real time rendering of generated city with user controlled camera.
  • Minimal data input
  • Some customisability via user interface
  • Small generation time

Resource Requirements

The demo application produced should not need an abnormally good PC to run on. A standard desktop should suffice with the only requirement being able to run multithreading technology to aid in quick generation. As multi-core CPUs are standard on modern PCs this shouldn’t be an issue.

References

Procedural Inc. 2010. [online]. Available from: http://www.procedural.com/industries.html [Accessed 07 January 2010].

M. Wegener. Operational Urban Models: State of the Art 1998.

J. Sun et al. Template-Based Generation of Road Networks for Virtual City Modeling, 2002

G. Kelly and H. McCabe. Citygen: An interactive system for procedural city generation. 2007.

Rockstar North. 2008. Grand Theft Auto IV. [Disk]. Xbox 360. Rockstar Games.

G. Whelan, G. Kelly and H. McCabe, Roll Your Own City, 2008





Quick Tree Vid

22 10 2009

Here’s a video of the tree generation, I was experimenting with making it animate the growth since that’s what I hope to do with the roads in my city (much like the Subversion video). Anyway, the vid:

My next small mini project will probably be making a wandering path algorithm so that a line joins two points but meanders in an organic looking way.  I’ll also try making my project proposal a damn sight better.








Follow

Get every new post delivered to your Inbox.