AI:Development: Difference between revisions

From Spring
Jump to navigationJump to search
mNo edit summary
mNo edit summary
 
(23 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Engine_Development|Development]] < AI Development
=How to write a Skirmish AI for Spring=
=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==
==Quick Start==
Please choose your preferred programming language:
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:


* '''[[AI:Development:Lang:Cpp|C++]]'''<br>
* '''[[AI:Development:Lang:C|C]]'''<br>
* '''[[AI:Development:Lang:Java|Java]]''' ''(up-to-date as of 10-2014, SpringRTS v98)''<br>
* '''[[AI:Development:Lang:Lua|Lua]]'''<br>
* '''[[AI:Development:Lang:Lua|Lua]]'''<br>
* '''[[AI:Development:Lang:C|C]]'''<br>
* '''[[AI:Development:Lang:Python|Python]]'''<br>
* '''[[AI:Development:Lang:Cpp|C++]]'''<br>
* '''[[AI:Development:Lang:CSharp|C#]]'''<br>
* '''[[AI:Development:Lang:CSharp|C#]]'''<br>
* '''[[AI:Development:Lang:Java|Java]]'''<br>
* '''[[AI:Development:Lang:Groovy|Groovy]]'''<br>
* '''[[AI:Development:Lang:Groovy|Groovy]]'''<br>
* other -> have a look at '''[[AI:Development:Interface|AI Interfaces & Wrappers]]'''<br>


For a general explanation about Springs AI API, see [[AI:Development:System|the introduction to Springs AI interface system]]. Though, an AI dev does not have to know about this, and should just follow the link to his preffered language from the list above.


==I have setup my AI dev environment, what now?==
==I have setup my development environment. What now?==
 
* '''[[AI:Development:System|SpringRTS <-> AIs architecture]]''' - architecture of SpringRTS and how it interacts with the AIs.
* '''[[AI:Development:TheMaps|The mappings provided by the AI Interface]]''' - how the engine maps the game area and how the interface exposes those maps.
* '''[[AI:Development:MonitorAndDebug|How to monitor and debug your Skirmish AI]]''' - How to monitor and debug your Skirmish AI.
* '''[[AI:Skirmish:List|AIs for Spring]]''' - list of some of the Skirmish AIs that have already been developed for SpringRTS.
 
 
==Overall AI ideas, practical examples, useful resources==
 
* '''[[AI:Links|AI related links]]''' - ranging from how to conceptualize AI agents all the way down to how to tackle very specific problems like pathfinding.
* '''[[AI:GameInferences|Useful inferences]]''' - how to infer where the opponents might have started, where on the maps can your units go, etc..
* '''[http://springrts.com/phpbb/viewforum.php?f=15 Springs AI dev forum]''' - comunity's forum dedicated to AI development.
* '''[[AI:Development:Interface|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"'''
http://springrts.com/phpbb/viewtopic.php?p=463953#p463953<br>
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:
<code><pre>
/aireload
/ailist
/aikill
/aicontrol
</pre></code>
 
 
*''' Lua<-->AI communications [in Spring 0.83+]'''
http://springrts.com/phpbb/viewtopic.php?f=15&t=26298
He shall say that only it once!
 


It may be a good idea to look at some of the other [[AI:Skirmish:List|AIs for Spring]],
*''' Link to source code of the Interface, engine-side'''
to check out the [[AI:Links|AI related links]] page and visiting [http://springrts.com/phpbb/viewforum.php?f=15 Springs AI dev forum].
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):<br>
https://github.com/spring/spring/blob/develop/rts/ExternalAI/AICallback.h<br>
https://github.com/spring/spring/blob/develop/rts/ExternalAI/AICallback.cpp<br>


[[Category: AI]]
[[Category: AI Dev]]
[[Category: Development]]

Latest revision as of 00:45, 23 October 2014

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"

http://springrts.com/phpbb/viewtopic.php?p=463953#p463953
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:

/aireload
/ailist
/aikill
/aicontrol


  • Lua<-->AI communications [in Spring 0.83+]

http://springrts.com/phpbb/viewtopic.php?f=15&t=26298 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):
https://github.com/spring/spring/blob/develop/rts/ExternalAI/AICallback.h
https://github.com/spring/spring/blob/develop/rts/ExternalAI/AICallback.cpp