Archived

This topic is now archived and is closed to further replies.

City AI

This topic is 6005 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

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

Share on other sites
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]

Share on other sites
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

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• Forum Statistics

• Total Topics
633678
• Total Posts
3013290
×