Strategies

From Gladiabots Wiki
Revision as of 20:48, 27 December 2017 by LuBeNo (Talk | contribs)

Jump to: navigation, search
Information.png This page needs improvement, you are welcome to contribute.

Best practices for AI design

Some best coding practices from software development also apply to AIs in Gladiabots. The following rules can help improve the quality of AIs, enhancing both the initial development and subsequent maintenance of the AI.

Information.png
Divide and conquer. 

Break down a problem into two or more sub-problems and solve each of them separately. Complex sub-problems can again be divided. In Gladiabots this could be done by creating sub-AIs for each sub-problem. The complexity is reduced leading to a better maintainability.

Information.png
Readability first. 

AIs are written once, but read many times. Overlapping nodes, links crossing each other and great distances between linked nodes are difficult to read and should be avoided. AIs should have meaningful names revealing their purpose. One should consider to align nodes to the grid.

Information.png
Don't repeat yourself. 

Avoid using the exact same set of nodes in several places. Sometimes duplicate nodes can be prevented by using bot specific filters or additional conditions. If its not possible to prevent duplicate nodes in the first place one can try to move them to sub AIs.

Information.png
Keep it simple. 

The size of an AI has a significant effect on the error rate. A simple solution should be preferred over a complex one leading to the same or very similar results. One should ask the question: "Has this AI been implemented with the least amount of nodes necessary?". The more complex the AI is the more likely it is to be buggy.

Information.png
Test, test, test. 

"If debugging is the process of removing bugs, then programming must be the process of putting them in." (Edsger Wybe Dijkstra) As no developer is perfect, new nodes should be tested and debugged right after they were added.

Useful resources

There are several places to discover new strategies, learn tactics of other players or ask questions:

  • Check the community forum. Also "old" topics there can give nice information.
  • Check the chat groups on telegram and discord.
  • Check the wiki itself to learn about game mechanics and bot programming and their sub topics. There are several nifty details to discover.
  • Check the changelog or roadmap to learn about recent or planned changes and adjust your AIs according to them.

Last but not least one should play the game. Especially lost games show flaws of the AI, that need to improved. Try to analyze the strategy your enemy used.

Simple bots

One can learn of bots with few nodes that have a pretty good performance in the game. They are a great base to start optimizing for beginners but also for advanced players to test their AI against.

Ultimate AI for beginners (16 nodes)

PEW presented this Ultimate AI for beginners in the forum.

Ultimate AI for beginners - Higher resolution (2236 × 1228 pixel)

The AI is split into this main modules:

  • Blue: The retreat module
  • Yellow: The shooting module (with high priority)
  • Green: The resource module
  • Red: The pushing module
  • Pink: The shooting module (with low priority)

Grand Master League Bot (30 nodes)

LuBeNo presented this Grand Master League Bot in the forum.

Ultimate AI for beginners - Higher resolution (2276 × 986 pixel)

The AI is split into this modules:

  • Defense
  • Shotgun
  • Offense
  • Dancing

Ideas worth implementing

Retreating

Information.png
Retreat at shield level other than 0-25%. 

Retreat early when being attacked by several units at medium range. Don't wait until your shield is 0-25%, otherwise those enemy units attacking you at medium range will continue to attack you as you move into long range, which is something you want to avoid with such a low shield. If you're being attacked by a machine gun and a sniper at medium range then you'll probably want to retreat at all shield/health levels.

Information.png
Only retreat as long as someone is attacking. 

Don't retreat because your shield is low, but because someone attacks you. If no one attacks you anymore stop the retreat process.

Attacking

Information.png
Minimize the time spend switching attack targets. 

Usually a bot should continuously attack the bot it started to attack. (by filtering a target attacked in the previous tick) Create strict rules for when to switch targets. For the sniper and machine gun, whose reload time is quite long, it's especially important.

Information.png
Focus fire. 

Prioritize enemies that are already being attacked by your allies.

Information.png
Focus the enemy sniper. 

Pay a lot of attention to your opponent's sniper. Your sniper should prioritize attacking the enemies sniper. If your sniper hits the opponent's sniper then it's probably worth changing the attack target of all your nearby units to it, even if they are attacking medium range units. (and only if it is safe/worthwhile doing so)

Information.png
Shoot medium range 

Aggressively push to medium range. Little damage is done at long range, so pushing to medium maximises your damage and also pushes your opponent, especially if you have many pushing at once. Careful, a bad push can be a big risk too.

General

Information.png
Ignore tagging 

New players can totally ignore tagging. (especially for combat) They will probably waste a lot of time (ticks) using them.

Information.png
Start experimenting. 

Don't follow rules. Sometimes you have to break rules to dominate.