Advertisement

Where to put a building?

Started by July 24, 2010 05:53 PM
0 comments, last by IADaveMark 14 years, 6 months ago
Hello! I was wondering if you could help me out with a problem:
I need to find the best place on a map(2D,like a grid) to put a building considering that units created there have to go through the highes amount of nodes in the map in the shortest time.

Is there any technique, algorithm that you can suggest me?.
I have an idea but i think it's not the best one: Influence map + A*Star to find out the path to the nearest node, and from there repeat the same process (nearest node).

Well, any ideas will be welcome :).

Byes!.

P.S.: sorry for my bad english.
Many RTS AI agents use a build template of sorts on existing maps. That is, they say "when you build that barracks, this is where it should go." Obviously, this is somewhat problematic on truly random maps since you can't look up a build template. In that case, base areas are often not completely random while the rest of the map is. That way, inside the base building area, you can still follow a general template and not cause problems.

However, to specifically answer your question, a lot of times the influence map/pathfinding solution is the way to go. In generally, you can run a series of pathfinds across the map early on. Run them from your base to the edges of the map, etc. These will tell you where the main exits and thoroughfares are. Use that information to populate an influence map. You can then bias your building locations to stay OFF those paths so that you aren't forcing your units to go around them all the time.

By combining that influence map with one that incorporates information about your existing town (i.e. stay close to the center of mass as your build), and the environment (e.g. build resource gathering buildings near resources), and the world (e.g. put military buildings towards the front, tech buildings towards the back), you can find the optimal locations for each new construction. Again, the A* runs at the beginning are only necessary to lay out your initial traffic flow and perhaps once in a while after that. (For reference, Empire Earth did this on random maps.)

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

This topic is closed to new replies.

Advertisement