This repository has been archived by the owner on Apr 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
AI Rules
Joshua Soberg edited this page Oct 17, 2016
·
65 revisions
The following is a set of possible tactical and strategic rules for the AI to be built.
To view rules that are being implemented or have already been built, see Concrete AI Rules
#Difficulty Legend# In an attempt to try and project how difficult each rule will be to implement, we're going to mark each rule with one of three difficulties:
-
- Fairly simple to implement; code to do this already exists, or would be trivial to write.
-
- More difficult to implement, but not impossible.
-
- Much time and thought must be put into implementing.
Note: these are just projected difficulties based on the current code/ our thoughts. Once we start actually trying to implement each rule, these could prove to be off.
#Possible Rules#
- Never have an empty build queue.
- As long as Ore refineries exist, Harvesters should never be idle.
-
Ore refineries should be placed as close to resources as possible.- Question: In order for optimal resource placement initially, the MCV will have to search a bit for resources, since they are often not always at the exact spot where the MCV is placed. Should we use the MCV to search for the closest resources before building the initial command center, wasting precious time but giving us more optimal resource gathering?
- Question Response: My own observation is that there is usually an ore field very close to where the MCV is placed when the game starts. Since the MCV is slow, moving it just wastes time that could be used for building up infrastructure. Fast, low cost actors (scouts) should be used to locate other ore fields. Dogs are great for this purpose (cheap, fast and lethal to infantry).
- - Agreed ^. This should be fairly trivial to implement. It's basically a matter of finding the nearest resources, and finding the closest location to those resources to place the refinery.
- Repair damaged items whenever feasible
- - This is simply a matter of saying "this unit is at x% health, return to service depot/heal". However, we can add other factors to this so that we aren't running away from every attack, i.e maybe we don't care about repairs until we have a certain number of losses from an attack, which may increse the difficulty of implementing this a bit.
- Try to assume where the opponent will be (scout).
- It is easy to assume that the player will lie somewhere along the edge of the map, more than likely directly across from where the player is. Scouting these areas first will hopefully save time and allow a strategy against the opponent to be built earlier. -Consider X scouts build, send in 360/x angle directions towards edge of map, should uncover resources and enemies. If they reach destination, then head to destination of next scout on clockwise order
- - Generally it seems that scouting will be fairly difficult to implement when considered to be a part of general enemy assessment. We want to be able to scout an opponent's base, and from that information build a strategy around that scout assessment.
- Use less important buildings as a buffer.
- If unnecessary or duplicate buildings are built, they should be placed on the outskirts of the base in order to act as a buffer against an attack. This will give the AI more time to defend the important buildings (Construction Yard, Ore Refineries, Power Plants) in the middle.
- Alternate approach: Why not just use defenses as a buffer? I've found artillery to be excellent for this purpose as it can hit incoming forces well before they get close enough to take out buildings.
- Spread out locations of power plants.
- This will make sure that if the base is attacked/ nuked, not all power will be lost at once.
- - In line with the tunable power plant rule below. Shouldn't be too difficult to say "find a location for new power plant that is x distance away from other power plants".
-
Name:
BuildPowerPlantIfBelowMinimumExcessPower- In-Game Variable: MinimumExcessPower
- Description: Build a new power plant if power drops below XX power.
- Gene Values: 0 to 500, increments of 50.
- - Self explanatory and already implemented.
- Observations that deal with mobile forces should timeout or fade over time; observations about fixed structures need not time out (unless those structures are destroyed)
-
Name:
ShouldProduceScoutBeforeRefinery-
Description: Determines whether we should build a scout before we build our first ore refinery (since we immediately have enough resources to build a barracks/kennel and a scout).
- Pros to building refinery first:
- Immediately begin farming resources to further our economy.
- Cons to building refinery first:
- Refineries, compared to barracks/kennels, take a relatively long time to build, so scouting is pushed back a bit.
- Pros to building scout first:
- Scout leaves the base quicker, and can build the strategic world view earlier in the game.
- In the case of small maps, the scout may reach the enemy base and be unopposed, meaning it could destroy harvesters (fairly crippling in the early game).
- Cons to building scout first:
- Loss in initial resource gathering.
- Pros to building refinery first:
- Gene Values: 0 (scout first) and 1 (refinery first)
- - A simple check after we build our first power plant for what to build next.
-
Description: Determines whether we should build a scout before we build our first ore refinery (since we immediately have enough resources to build a barracks/kennel and a scout).
-
Name:
NumberOfScoutsToProduce- In-Game Variable: NumberOfScoutsToProduce
- Description: Number of scouts to produce to search the map for enemies.
- Gene Values: 1 to 10
- - Just a matter of producing as many scouts as the GA decides.
-
Name:
NormalBuildingPlacement- In-Game Variable: NormalBuildingPlacement
- Description: Where to place normal buildings (not Ore Refineries or Defensive buildings).
- Gene Values: TBD: 0- Farthest from predicted/found enemy locations, 1- Randomly dispersed
-
Name: AmountOfResourcesToHaveBeforeNextProduction
- In-Game Variable: AmountOfResourcesToHaveBeforeNextProduction
- Description: Amount of resources to have before we execute the next production (unit or building).
- Gene Values: TBD: 0 (build whenever we want) - 500 (have 500 resources on hand before we execute the next build order).
- - Self explanatory, we just need to check available resources before we decide to build next.
- Enemy assessment.
- Number of scouts to use to explore, how quickly to begin scouting, etc.
- Note: Dogs are cited as being one of the best scouting units (github.com). While they are relatively weak defensively, they are quick and cheap to build.
- - This is going to end up being a lot more than just scouting; We're going to have to build strategies based on the enemy units that are being built, what we know about, etc. While it may not be extremely difficult, it's going to take some thought.
- Number of scouts to use to explore, how quickly to begin scouting, etc.
- Variables for base expansion.
- When to build another construction yard. *When rate of income is below X (suggests ore field have been depleted)
- - This is just a matter of knowing when to expand and sending out a new construction yard.
- Units/buildings to sell if immediate resources are necessary.
- Sell defensive structure if not used for XXXX ticks
- Impact of environment (maps)
- Small maps favor a rush with cheaper offensive units early on (Soldier's Rush)
- Large maps favor slower-paced games. Favors offense with more technologically advanced units later (Knight's Rush)
- Turtling is a strategy to defense against a Soldier's Rush and can enable an eventual Knight's Rush
- One paper claimed that maps are "unbalanced"; that is, some starting locations are superior to others.
- Environment assessment could prove to be a great asset, both for offense and defense. If we build our base with only one real entrance/exit (e.g a peninsula), we are fairly well defended from soldier units without having to spend any resources.
- - While this seems like it might be one of the most useful rules, all of the options that have to be considered when assessing the environment indicate that this will be fairly difficult to implement, and take some time.
-
Name:
PercentageOfResourcesToSpendOnDefensiveBuildings- In-Game Variable: PercentageOfResourcesToSpendOnDefensiveBuildings
- Description: Determines the percentage of resources to spend on defensive buildings when producing buildings.
- Gene Values: TBD, 0-50% possibly?
- - Just a matter of deciding upon a proportion of resources to spend on static defense.
-
Name:
DefensiveBuildingPlacement- In-Game Variable: DefensiveBuildingPlacement
- Description: Determines where we should place defensive buildings.
-
Gene Values: TBD; 0- Closest to construction yard, 1- Outside base perimeter, 2 - Distributed among the "most important" structures (refineries, the construction yard, etc.)
- Should defensive building be placed so that they have no overlap, some overlap, majority overlap, etc. Scattering defensive buildings with no overlap, and placing defensive buildings with no real strategy could end up making them effectively worthless (Barriga et al.).
-
Name: PercentageOfUnitsKeptForDefenseIn-Game Variable: PercentageOfUnitsKeptForDefenseDescription: Determines the percentage of units to keep as a base defense (unused for attacks)Gene Values: 0 - 50% (percentage of units to keep at base)- Deprecated; This is no longer necessary now that we have the lethality metric.
- Whether or not/ how much to spend on wall defenses - Currently, the HackyAI can't place concrete walls, but they prove to be very useful for defending your base and are cheap.
-
Name: SquadComposition
- In-Game Variable: SquadComposition
- Description: Determines (somewhat) what our offensive squads should be composed of, at least until we have a better indication of world state.
- Gene Values: TBD, perhaps; 0- completely random, 1- mostly infantry, 2- mostly vehicles, 3- mostly air, 4- equal distribution
- - Not too difficult, we would just need to check the distribution and find a good medium between our strategic state and this determined rule.
- Squad size.
- Kill box (lure enemy defenders into kill heavy kill zone)
- Multi forked attacks
- Attack when enemy attacks
- Or...right after an enemy attack is repulsed?
- Attack timing
- In some scenarios, a rush is more feasible than in others (see observances page).
- Every attack should have a goal
- Goal should drive force size [harvester-small force; construction yard - large force]
- Formations
- I found a highly effective formation was simply to have about 6 mammoth tanks backed by 8 v2 rockets, I placed them near the enemy and they slaughtered anything that came by, if a unit was damaged I'd repair it, then return it. When the squad grew to 10 mammoth and 12 v2's, I built 6-8 migs, and launched my nuke on their defenses, migs cleaned up teslas, troops went in, game over. The attacking troops attacked without coordination making them easily slaughtered. Next time I play I'll keep a few faster tanks to take out the enemy v2 rockets. Also I grouped my forces into close combat and ranged, and ensure the ranged were in back, then had every unit target the same enemy unit in turn, from heaviest to weakest.
- One of the best unit formations in Starcraft when playing the Terran (human) race was known as the "Bio-Ball" technique. This technique consisted of building a closely formed squad with infantry,medics, and the corresponding small tank-like class. This was one of the most effective formations that I (and many others) used, and it has a lot of advantages (units are cheap, self-healing, and available very early in the game). If we fill in the small tank for rifle infantry (so that the medic could heal), I think that we could use the same technique in RA.
- - This will likely not be difficult to implement per se, but will take some thought/ testing to fine tune.
- Enemy unit targeting?
- Always protect the construction yard.
- If there is only one construction yard and it is under attack, put all forces on defending it.
-
- - If we get the callback that the construction yard has been damaged, call all troops to the yard and start defensive maneuvers.
- Make destroying harvesters/ refineries a priority.
- Destroying the enemy's economy will often lead to victory.
- - When launching an attack, make destroying harvesters and the command center the most priotized units to target at any given time.
- When attacking the enemy base, the Construction Yard should be the main priority
- Invest a few extra $$ in stealth, as its far more survivable. A stealth pillbox is much better than a regular pillbox, even though it costs more.
- If possible, avoid ore fields where harvesters have been killed.
- Send units to kill long range units that are bombarding your base
- The HackyAi is very stupid in this way; many times I've seen the enemy AI send over a long range unit that bombards the defending AI's base, with no attempt from the defending AI to take the long range unit down. Visual example (yellow is enemy, blue is defending; units are readily available that can take down the long range launcher, but still nothing is done):
-
Name: MinimalAttackForceSize
- In-Game Variable: MinimalAttackForceSize
- Description: Determines the minimum attack force size before we launch an attack, before factoring in the enemy's current strategic state.
- Gene Values: TBD, could be a ratio of our attack size to known enemy units, but most likely a static number (1-20 units?).
- - Simple check before we launch an attack.
- When a squad should retreat.
- Amount of damage to be inflicted before we should retreat to heal, etc.
- Ratio of enemy to attacking force. Retreat when sufficiently outnumbered and more than TBD distant from goal
- Do not retreat if attacking the main goal
- - retreat after X members of squad killed, x damaged inflicted, etc.
- When to attack.
- How many squads/units before an attack.
- Possibly ties in with the "Enemy Assessment" strategic rule from above.
- Collect stats on weapons that are most effective in the current scenario (max kill; min death, cost). Build more of those.
- - This will just be a matter of keeping track of the kill cost made by each unit type. This rule could be tuned to the effect of how much we reference this data when creating units.
-
Name: ScoutRecommendationImportanceMultiplier
- In-Game Variable: ScoutRecommendationImportanceMultiplier
- Description: Determines the multiplier used to suppress/enhance the scout report recommendation value (up to 2x).
- Gene Values: TBD: thinking 1 - 20 (divided by 10 to be a multiplier of .1 to 2).