Advertisement

City AI

Started by June 28, 2002 12:24 PM
1 comment, last by tkmagic55 22 years, 4 months ago
Hello I''m working on a game similar to transport tycoon and other games in that genre. Especially the city construction AI is of interest. What''s the best approach if I want the city to construct houses + roads that follow a certain style. Houses should be built in blocks with 1 to 4 buildings. Then roads should be built round the blocks. The problem appear when a human player remove roads / houses that the city have built. The city has to adjust the construction of new buildings / roads to the new situation. Thanks / Tommy
If your question refers to the movement of the vehicles in the city (ie along roads) then I think the answer to your question lies in graph theory (ie construct a tree, store crossroads etc) which you can then search for routes. When a road is deleted, this means updating or removing a node from the tree. Check out "travelling salesman" problems on the net for determing the best route.


If the question refers to the actual city construction well you simply have to define your rules (ie housing blocks of max 4 width) and then create a map following the rules (ie after you have constructed housing construct roads or whatever) You can use a random seed of some sort to make sure the city isn't always the same...

And if you don't want the AI to build on specific squares (those the player has built on for example) just use some sort of flag to identify these tiles and don't let the AI build there.

and otherwise I don't understood the question, maybe you want to rephrase it?

[edited by - sjm on July 3, 2002 5:45:15 PM]
Advertisement
It might work to partition the City AI into a Block AI, and rig each block to develop itself based on what''s in or around it. Something like an A-Life sim (if tile has x adjacent houses, and block is STATE_Y & STATE_Z) for the city generator. Blocks would have given zoning and growth conditions, maybe land value. Look at some articles on city planning and some zoning ordinences (any large city website will do, like Portland, OR) to get some ideas for this. Or play SimCity for a while.
If you''re using classes (Cpp), consider which routines would have road building access.

-Sta7ic

This topic is closed to new replies.

Advertisement