Using Spring for AI research

Using Spring for AI research

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Eggerslolol
Posts: 4
Joined: 28 Jan 2014, 17:37

Using Spring for AI research

Post by Eggerslolol »

Hi, I'm new to this forum so hopefully I'm posting this in the right place.

I'm in my final year of uni studying Computer Games Development and I've chosen to look at dynamic learning algorithms in games for my final project. I was going to use Stratagus after reading about it in another paper but I recently learned of Spring and I'm wondering if it's a better alternative. I've made minimal progress with Stratagus so could feasibly make the switch but whichever path I go down I'm going to be doing lots of learning etc.

Basically I'm wondering if I can take a shortcut here and get some answers to a few pressing questions:
- to confirm - AI in Swing is scripted? Is Spring well documented, will I be able to get to grips with it in a short space of time?
- is there a free game that I can use with Spring and easily alter the AI in?
- it is easy/possible to have AI vs AI?
- will it be possible to turn off rendering for quick simulations of games?
- for convenience will I be able to debug the whole thing, through VS or some other IDE?

I'm sorry that I clearly haven't done much looking into Spring, I just don't want to potentially waste my time by looking down a dud avenue when I could start getting stuck into Stratagus instead.
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Using Spring for AI research

Post by Anarchid »

The short answer to most of your questions is "yes"; in fact, Spring has been used for works like yours quite a few times.

There exist several AI interfaces, and it should also be quite possible to set a whole "grid" of games running one AI against another.

There's a "headless" build version that runs without rendering just for that purpose (but i also think it's used by some autohosts).

There are multiple completely free (as in beer and as in speech) games available.

I can't say anything about the current state of documentation, though, because i never personally dabbled in making native AI's for Spring. Somebody more knowable should answer this and other questions in greater depth >.>
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Using Spring for AI research

Post by FLOZi »

Key people to talk to here are AF (who used Spring for exactly this purpose) and probably Hoijui about the interfaces (afaik he was the last dev to actively focus on AI)
Eggerslolol
Posts: 4
Joined: 28 Jan 2014, 17:37

Re: Using Spring for AI research

Post by Eggerslolol »

Okay, this sounds like a hopeful avenue. Is there any game in particular that I should try out? If I can get Spring and a game all set up by the end of tomorrow then I'll probably bite the bullet and make the switch.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Using Spring for AI research

Post by FLOZi »

Kernel Panic springs to mind as a game that has been used previously (there is some university online AI course that used it or something) that is AI friendly (in terms of not requiring excessive interaction with complicated lua-based mechanics) and is 100% free.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Using Spring for AI research

Post by knorke »

http://springrts.com/wiki/AI:Development
What language?
I would recommend Lua because it is actively being used for AIs.

For other languages too many threads like these seem scary:
http://springrts.com/phpbb/viewtopic.php?f=15&t=28235
http://springrts.com/phpbb/viewtopic.php?f=15&t=28124
http://springrts.com/phpbb/viewtopic.php?f=15&t=27471
("always" something being outdated)
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Using Spring for AI research

Post by gajop »

knorke wrote: ("always" something being outdated)
I don't know about that, I usually just need to make a few updates when something drastically changes, and last I checked mine worked: https://github.com/gajop/MyAI, note that the last commit was 2 years ago..

@OP: Spring is one of the best options as far as creating RTS game AIs goes, as it's pretty easy to automate testing and run games at huge speeds, and that helps development a lot. Also consider looking at this to automate games even more (pretty unstable atm though..) : https://github.com/gajop/springgrid/tree/pylons.

As far as Java goes, the main flaw is that due to a bug, you can't have two AI bots from the same package (there is only one instance per package).
Eggerslolol
Posts: 4
Joined: 28 Jan 2014, 17:37

Re: Using Spring for AI research

Post by Eggerslolol »

Language-wise lua would be fine. I'm not too familiar with it but I can get familiar, its come up a lot recently so I should add it to my toolkit really.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Using Spring for AI research

Post by zwzsg »

Lua is rather easy to learn, all you need to know fits on one (web) page: www.lua.org/manual/5.1/

Just have to be careful at first with index starting at 1, 0 being true, and the difference between ipairs (for arrays-like tables) and pairs (for hashes-like tables).
Eggerslolol
Posts: 4
Joined: 28 Jan 2014, 17:37

Re: Using Spring for AI research

Post by Eggerslolol »

Hmm I think maybe I was being a bit ambitious. Seeing as I have already got Stratagus set up I think it'd be more sensible for me to use that at this point.

Thanks for all your help though, it allowed me to seriously consider this as an alternate venture.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Using Spring for AI research

Post by PicassoCT »

well, its understandable- i mean, for a short university project, the third dimension and a complex ingame economy hold some perils..

Good luck with strategus
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Using Spring for AI research

Post by Anarchid »

a complex ingame economy
Um, that said, the suggested game (kernel panik) has no economy.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Using Spring for AI research

Post by PicassoCT »

It has geovents to be converted, it has units you can build, making time a ressource. It has player attention.

Two ressources detected.
Your argument, on a plate.. i shall get salt and pepper. :)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Using Spring for AI research

Post by AF »

C++ OO API

Use Shard as a base, tear out any logic you don't want. the Lua VM in Shard is optional.

C++ Legacy API

There are several AIs that function on this API, but it's deprecated, and the AIs haven't been updated in any meaningful sense in a long time. They may be good demonstrations of how to use the API but they are not good demonstrations of a functioning and competitive AI. They were once, perhaps you'll gain insights.

Lua Shard

You could opt to only use the lua part of Shard, this is the most active area of native AI development ( even though it's a scripting language ). Take a look at the BA logic in Shard as it has been heavily updated over the last few months.

Java

????????? I honestly couldn't advise here, or if this API actually works, but people seem to like to try

Game based Lua AI

Pure lua, no native code of any kind. There are advantages and disadvantages here:
  • Upto date and actively used
  • Trivial access to game specific lua logic in comparison to the other options
  • APIs are more likely to be used and tested by game developers themselves
  • Seamless reliable access to the VFS
  • Some of the niceties of the dedicated AI interfaces are missing, such as basic building placement algorithms and the need to package AIs as a part of a game
  • No Visual Studio debugger
  • Performance will never be as good as the C++ APIs
It should be noted that the APIs for native AIs aren't in the spring source, and are auto-generated by AWK springs on build. As a consequence the documentation isn't the best


There is a final option, Shard AIs running in game based lua, but some preparation work will be necessary to get that working. If you do, then some people here will be very happy, and you'll be able to borrow from both Shard AIs and other AIs such as CAI PM me for more information on the 'how' part.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Using Spring for AI research

Post by knorke »

Some of the niceties of the dedicated AI interfaces are missing, such as basic building placement algorithms
The zK AI has some functions that could be re-used. Like functions to make a metal extractor, function to make nanoturret near factory, function to run away from enemy etc
http://code.google.com/p/zero-k/source/ ... AI.lua#916
User avatar
hughperkins
AI Developer
Posts: 836
Joined: 17 Oct 2006, 04:14

Re: Using Spring for AI research

Post by hughperkins »

I was thinking of doing a phd in game AI last year, before I got offered a salary I couldnt refuse to work instead. I asked around a bit, and the consensus was that doing game AI is fine in itself, but one should make sure that the research will have impact. Specifically, one should be able to measure the results in some clearly recognized competition.

My own conclusion at that time was that two games where one could make a clear impact are:

- Go. Computers last year were just beginning to be able to beat the best humans, not quite, but nearly. There are a couple of laboratories doing research on this, one in Alberta (I think), and one in Paris (I think, possibly, somewhere francophone anyway)

- Starcraft. There is a starcraft AI competition each year, with many competitors. The results of the last one, at the time I was looking around, had gone widespread media coverage, with the micro-managed mutalisk tactics doing well for example

Of course, technically speaking, SpringRTS is very well placed, but, in practice, the two games above are much more widely reported. There are many existing papers, which one can reference, and compare one's own AI with. And they are stable targets, which facilitates meaningful comparisons to existing papers.

(Edit: wow, this thread is from January... but it's the seventh thread in the list.... where'd all the AI developers go? :-P )
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Using Spring for AI research

Post by PicassoCT »

They made ther phd and are working now?

Also lua ais happend, which are mostly tacked to the respective game..

I wonder, shouldnt a good (strong) AI be able to learn and adapt to every ruleset it finds.. speaking, it should be able to play Starcraft as well as Spring after a learning period?
http://www.bth.se/fou/cuppsats.nsf/all/ ... _games.pdf

http://www.diva-portal.org/smash/get/di ... TEXT01.pdf

Also, most of the AIs done had fallacys in them, asuming BA would last forever (overspezialized) .. not anticipating the rise of the lua gadget and lua scripting (assuming that game-rules are constant, and determinstic), which simply made them decay over time, though the devs work hard to keep them in a executable stage..

Shard has a memory leak..

I think springs AI-scene lacked competition- and the game-problem that a AI to good will simply beat all humans, and thus become not fun.
So what is actually yearned for by the masses is a mind the size of a moon, beeing wrong out of irrational reasons, basically a human emulator.

If you still want to try making a AI, you are welcome.

PS: Even a good salary shouldnt stop someone from doing a phd.. the title will last, while company and salary may in a few years be a thing of the past.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Using Spring for AI research

Post by AF »

Steps were taken to improve the memory situation in Shard, refer to github.

It should be noted that I intended Shard to be engine agnostic, with starcraft being the likely contender for engine #2
100Gbps
Posts: 74
Joined: 30 Jan 2009, 13:19

Re: Using Spring for AI research

Post by 100Gbps »

No joking, but at the moment easiest way for me to do AI kung-fu is ... JavaScript + Canvas. Way too much hassles arise doing it in native, luckily for my choise there are webworkers for the heavy lifting. After everything is polished, I can think for native.
Post Reply

Return to “AI”