Page 1 of 1

City Generation

Posted: Tue Sep 07, 2010 2:45 pm
by Lap
Right now production is being held up by me trying to figure out the best way to make the maps.
To get the detail I want I think I'm going to try using tiles. Any city generator we make needs a lot more guidance than the average landscape creator because of how much detail we expect from a city. So here's my current plan.
1. The game looks at an street map file that may or may not be randomly generated. It looks something like this:

Image

A more blown up example [of a different map]:

Image

Each one of these streets is a representation of far more tiles. A '+' might actually be a block of tiles like:

|
|
--+--
|
|

These streets do not contain sidewalks, curbs or anything, but asphalt.

2. The game then calculates the space in the open plots.

Image

3. All available premade tiles for this district/theme that fit the dimensions of the plot will be gathered and one will randomly be chosen.

A plot tile might for a suburban house might look like:

Image

4. The plot tile is randomly rotated and placed to fit in the plot, in game looking like:

Image

5. The plot is filled with whatever random elements it comes with (random litter, trash cans, doodads)
Thoughts?

Re: City Generation

Posted: Tue Sep 07, 2010 9:33 pm
by yufra
Sounds like it could work. There should probably be some way of grouping plots together, marking a region as "residential - suburban" or "commercial - dense", a bit like SimCity. An easy way of doing that would be to have each zone have a similar theme of plots, similar to how NPCs are currently separated (mostly) by zone in ToME.

Re: City Generation

Posted: Wed Sep 08, 2010 12:20 am
by Lap
Yea I already have it separated into commercial, residential, and industrial at the moment, with some tiles being allowed in every theme.

Re: City Generation

Posted: Wed Sep 08, 2010 8:51 am
by darkgod
Yes sounds quite sane to me too!

Re: City Generation

Posted: Sat Sep 18, 2010 5:49 pm
by Lap
I have some code that generates a rough city map like this:

Image

Seems to be working pretty well. I'll post some screenshots later.

Re: City Generation

Posted: Mon Sep 20, 2010 2:22 pm
by darkgod
Nifty!

Re: City Generation

Posted: Mon Sep 20, 2010 4:42 pm
by yufra
I am anxious to see this Lap! Are you keeping to code somewhere that I can peek? :D

Re: City Generation

Posted: Mon Sep 20, 2010 8:39 pm
by Massimiliano Marangio
yufra wrote:I am anxious to see this Lap! Are you keeping to code somewhere that I can peek? :D
Check out the Crimelike module: http://doku.t-o-m-e.net/t4modules:crimelike

There is a screenshot at Blogspot and code committed in the SVN repository (http://crimelike.svn.sourceforge.net/vi ... a?view=log).

More houses (tiles) for the generator can be found here: http://76.26.38.52/crimelike/index.php?topic=86.0