From Spring
Jump to: navigation, search

Development < AI Development

How to write a Skirmish AI for Spring

This section gives help on how to create Artificial Intelligence agents that control teams (as if a player) - "Skirmish AI".

The SpringRTS engine interacts with the Skirmish AIs through an "Interface". There are stable (10-2014, Spring v98) interfaces for the languages C/C++ and Java (not currently sure about the others but I think Lua too).

Quick Start

See these pages for tutorials on how to setup a development environment, connect to the appropriate "Interface" and how to build your first example Skirmish AI:

I have setup my development environment. What now?

Overall AI ideas, practical examples, useful resources

  • AI related links - ranging from how to conceptualize AI agents all the way down to how to tackle very specific problems like pathfinding.
  • Useful inferences - how to infer where the opponents might have started, where on the maps can your units go, etc..
  • Springs AI dev forum - comunity's forum dedicated to AI development.
  • AI Interfaces & Wrappers - semi-technical description of the Interfaces that expose the SpringRTS engine to the AI agents.

Other hints, tips and interesting infos

  • AI "frame skipping"
As in: if a Java/C/C++ SkirmishAI gets delayed responding back to the Interface, the SpringRTS engine will wait on the AI. Thus delaying the game, thus not having the AI "skip" frames.

  • Engine commands to control the AIs

In spring you have some control over AIs with these commands:


  • Lua<-->AI communications [in Spring 0.83+] He shall say that only it once!

  • Link to source code of the Interface, engine-side

Chances are you'll have doubts about what exactly the commands abc(), qwe() or xyz() do. Asking in the AI forum is a good way to clarify. The most reliable is probably to look at the source code (if you're able to navigate the maze of C++ code in all its glory, that is):