City Generation

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

Post Reply
Message
Author
Lap
Cornac
Posts: 40
Joined: Sun Aug 29, 2010 1:31 am

City Generation

#1 Post 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?

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: City Generation

#2 Post 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.
<DarkGod> lets say it's intended

Lap
Cornac
Posts: 40
Joined: Sun Aug 29, 2010 1:31 am

Re: City Generation

#3 Post by Lap »

Yea I already have it separated into commercial, residential, and industrial at the moment, with some tiles being allowed in every theme.

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: City Generation

#4 Post by darkgod »

Yes sounds quite sane to me too!
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Lap
Cornac
Posts: 40
Joined: Sun Aug 29, 2010 1:31 am

Re: City Generation

#5 Post 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.

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: City Generation

#6 Post by darkgod »

Nifty!
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: City Generation

#7 Post by yufra »

I am anxious to see this Lap! Are you keeping to code somewhere that I can peek? :D
<DarkGod> lets say it's intended

Massimiliano Marangio
Sher'Tul
Posts: 1120
Joined: Mon Sep 30, 2002 9:52 pm
Location: Germany

Re: City Generation

#8 Post 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

Post Reply