• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Small AI problem.

Status
Not open for further replies.
Level 13
Joined
Oct 16, 2010
Messages
737
In my current project I'm making an AI system and it's pretty much done now.
The basics:
The AI will build structures in random places of a specified region to defeat whatever the opponent has built.
Problem:
After a while they run out of space, and hence aren't able to build anymore which usually means that they lose.
Question:
How can I solve this problem? I was thinking of something like the buildings are removed from the game after a while or attempting to make them build in a more orderly fashion. Any ideas?
 
Level 8
Joined
Jul 3, 2011
Messages
251
Why would they lose from running out of space? Surely thats a good thing meaning their base is advanced? Unless you mean they need to destroy some structures for more advanced ones? Have some way to detect when an AI can build a better structure then make them kill the old ones.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
If buildings become redundant after construction (generally a sign of poor game design) you just need to detect when the AI is starting to run out of room (maybe if the AI starts to fail many placement itterations) and get it to allocate some units to garbage collection (they are ordered to attack a redundant building to "free" space.

If buildings are always useful, you will need to create a more advanced building layout system. Model the build area as a grid (which it is) and make every building have a certain grid size (remember to factor in movement space between buildings). You then proceede to fill in the grid with these blocks in an orderly fassion. Remember to factor in space being freed in the case that an enemy kills a building (so the AI can reuse the space).

Remember that rows or collumns might be the most efficient allocation of space. Avoid mixing stuff of different pathing types next to each other. Only production buildings need room for units to walk from and get to combat. Although support buildings (such as a human farm) do not need walk access, it is advisable to supply some to avoid the buggy case that someone snipes a building that can not be replaced unless other buildings are demolished.
 
Status
Not open for further replies.
Top