New AI; New Developer

New AI; New Developer

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

Moderators: hoijui, Moderators

Post Reply
d3x0r
Posts: 7
Joined: 03 Jun 2009, 06:06

New AI; New Developer

Post by d3x0r »

How do I add this AI that I built? I hoped it would be enough to make a directory and copy it in with modified lua settings, but no.

Basically I have a copy of shard AI; was thinking this was going to be a much more dynamic process; but it looks like a lot of replicated code (like the entire lua library?)...

But it doesn't show up...

I built this using cmake & MinGW Makefiles; and a modified boost, ended up getting boost 1.55, buildling it, and modifying the original to use the installed one.. but I was able to join and spectate a few games, and basically I think the build works.

would be nice if there was a document like... this is what spring does to load an AI... I want to additionally extend this with dynamic modules later which will be addtional .dll's in the ai directory, will this be a problem?
d3x0r
Posts: 7
Joined: 03 Jun 2009, 06:06

Re: New AI; New Developer

Post by d3x0r »

I'm not a 'new developer' I've developed C/C++ code for 25 years. I've come to like CMake.

It would be nice to know conceptually what an AI was supposed to do; or how it sees the game...
User avatar
PepeAmpere
Posts: 591
Joined: 03 Jun 2010, 01:28

Re: New AI; New Developer

Post by PepeAmpere »

I would suggest to choose some game first and if you plan to do new AI, do it in Lua just for this game (or ok, stay in C++ if you really want, but specialize your AI for only one game). From game developer view and from player view, game-embeded, game-themed AIs are better prepared for its task and do better then below-average behavior and offer easy customization or connection with game specifics.

We have plenty of "general AIs" - i mean AI modules, which attempt to be AIs for all games - but all of them are not much interesting and playing like dumb machines (with perfect skirmishing of scouts), not like players (I exclude Shard AI, which I like, because it has active community around and there is some possiblity to customize the AI in Lua, but yes, its playing like machine, too :) ).
d3x0r
Posts: 7
Joined: 03 Jun 2009, 06:06

Re: New AI; New Developer

Post by d3x0r »

PepeAmpere wrote:I would suggest to choose some game first and if you plan to do new AI, do it in Lua just for this game (or ok, stay in C++ if you really want, but specialize your AI for only one game). From game developer view and from player view, game-embeded, game-themed AIs are better prepared for its task and do better then below-average behavior and offer easy customization or connection with game specifics.

We have plenty of "general AIs" - i mean AI modules, which attempt to be AIs for all games - but all of them are not much interesting and playing like dumb machines (with perfect skirmishing of scouts), not like players (I exclude Shard AI, which I like, because it has active community around and there is some possiblity to customize the AI in Lua, but yes, its playing like machine, too :) ).
That doesn't give me the access to the configuration for the units....

https://docs.google.com/document/d/15XJ ... Jr9XdFhTEc

Lua may be nice; but I don't really want to reimplement the full thing when I just need to have some addresses of floating point variables to patch in...
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: New AI; New Developer

Post by Anarchid »

So you want to make an artificial neural network AI? :P

Even if you go with making a cpp powered AI, i think you'd have to submit patches to any games you want it to play if they use LuaRules to any extent, so as to expose the gadget information to your AI.

It probably doesn't make sense to port an existing ANN library into Lua, but you might want to know that there exist Lua-based ANN libraries :)

Additionally, as far as i know at least one person have tried this with spring earlier; i'll see if i can find anything he wrote.
That doesn't give me the access to the configuration for the units....
This is unclear. What do you mean by "configuration for the units"? Lua gadgets (and LuaAI's implemented as gadgets) have full access to unit definition data; in general they have fuller access to game world information than native AIs.

Or do you mean saving data so that AI learns on the fly? That's also possible.
d3x0r
Posts: 7
Joined: 03 Jun 2009, 06:06

Re: New AI; New Developer

Post by d3x0r »

Anarchid wrote:
That doesn't give me the access to the configuration for the units....
This is unclear. What do you mean by "configuration for the units"? Lua gadgets (and LuaAI's implemented as gadgets) have full access to unit definition data; in general they have fuller access to game world information than native AIs.

Or do you mean saving data so that AI learns on the fly? That's also possible.
some of the above; the networks should be dynamically configurable;
while I realize that what I want isn't what I got; it is a more stable platform than any other. Around page 32 is where a sample interface is detailed (with some pictures even)... I couldn't find any way way to directly link to there...

The render library for the gui works with SDL in linux, otherwise opengl, opengl2, gles2, d3d9, d3d11, on windows; ... so I'm sure hooking in isn't a huge deal (init(hwnd,hdc); render(); added somewhere in the init and render loops appropriately); and if the experiment fails no point in patches; but any changes to original sources will impact existing sources in the least possible way.

was just sort of looking for '8x10 color glossy photos with circles and arrows and a paragraph on the back of each one' for an idea of what it is I'm looking at...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: New AI; New Developer

Post by AF »

I assume you mean it doesn't show up in the lobby? If so then we will need to see the ai lua files that the engine reads

e.g.

https://github.com/Tarendai/Shard/blob/ ... AIInfo.lua

If any of those values do not match the directory structure then this will be the result:

Image

Zero tolerance. This include capitalisation and spaces, and the version numbers ( use 'dev', in a folder called 'dev' inside your AI folder ).

So for the AIInfo.lua i posted, this is the only valid folder that will work:

shard/dev/aiinfo.lua etc

I cannot comment any further without being able to see code ( pending NSA or Psychic powers ).

PepeAmpere, your first paragraph helped contribute to the latter paragraph, combined with a combination of unfortunate events. Very few people understand the C++ AI interface anymore, and there are auto-generated elements that nobody is totally sure about, and known defects. This is why Shard is the only native AI that has had any development, and if it weren't for the lua VM it contains I'm sure it would be in the same boat as AAI and KAIK.
d3x0r
Posts: 7
Joined: 03 Jun 2009, 06:06

Re: New AI; New Developer

Post by d3x0r »

AF wrote:I assume you mean it doesn't show up in the lobby? If so then we will need to see the ai lua files that the engine reads

e.g.

https://github.com/Tarendai/Shard/blob/ ... AIInfo.lua

If any of those values do not match the directory structure then this will be the result:

Image

Zero tolerance. This include capitalisation and spaces, and the version numbers ( use 'dev', in a folder called 'dev' inside your AI folder ).

So for the AIInfo.lua i posted, this is the only valid folder that will work:

shard/dev/aiinfo.lua etc

I cannot comment any further without being able to see code ( pending NSA or Psychic powers ).
Okay that helps some I make sure i's are dotted and t's crossed so-to-speak.
AF wrote:Very few people understand the C++ AI interface anymore, and there are auto-generated elements that nobody is totally sure about, and known defects. IK.
Yes I'm leery of auto generated code parts. I can definately take a left turn and investigate the Lua interfacings; I can always just issue my commands to and from the lua... sorta

I dunno maybe there is a obstruction because of how units need to 'see' the world.


I made the following directory... where .\spring is the result of 'make install'

.\spring\AI\Skirmish\Dex\0.01

Code: Select all

--[[
--------------------------------------------------------------------------------

	Info Definition Table format

	These keywords must be lowercase for LuaParser to read them.

	key:    user defined or one of the SKIRMISH_AI_PROPERTY_* defines in
		    SSkirmishAILibrary.h
	value:  the value of the property
	desc:   the description (could be used as a tooltip)

--------------------------------------------------------------------------------
]]

local infos = {
	{
		key    = 'shortName',
		value  = 'Dex',
		desc   = 'machine conform name.',
	},
	{
		key    = 'version',
		value  = '0.01', -- AI version - !This comment is used for parsing!
	},
	{
		key    = 'name',
		value  = 'D3x0r Skirmish AI (Dex[ter])',
		desc   = 'human readable name.',
	},

	{
		key    = 'description',
		value  = [[
                Eat Me.
		]],
		desc   = 'this should help noobs to find out whether this AI is what they want',
	},

	{
		key    = 'url',
		value  = 'http://d3x0r.org/Spring',
		desc   = 'URL with more detailed info about the AI',
	},
	{
		key    = 'loadSupported',
		value  = 'no',
		desc   = 'whether this AI supports loading or not',
	},
	{
		key    = 'interfaceShortName',
		value  = 'ShardC', -- AI Interface name - !This comment is used for parsing!
		desc   = 'the shortName of the AI interface this AI needs',
	},
	{
		key    = 'interfaceVersion',
		value  = '0.1', -- AI Interface version - !This comment is used for parsing!
		desc   = 'the minimum version of the AI interface this AI needs',
	},

	{
		key    = "supportedMods",
		value  = [[
(BA, Balanced Annihilation, *, *)
(BOTA, Basically OTA, *, *)
(SA, Supreme Annihilation, *, *)
(XTA, XTA, *, *)
(EE, Expand and Exterminate, 0.171, 0.46)
(EvoRTS, Evolution RTS, *, *)
		]],
		desc   = "mods this AI is confirmed to be able to play",
	}
}

return infos
I dunno; the other area is maybe there's internal strings? is the wrapper done through simple extern "C" export and reading, so the classes and namespaces don't matter?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: New AI; New Developer

Post by AF »

I'd recommend using 'dev' rather than '0.1', as for the API itself, both C++ apis are wrapped around a C API, so long as the directory structure is setup right, the library is named correctly ( they all have the same name, so look at another AI for the right filename ), and AIInfo.lua is matching, then it should work, I'm not sure why it doesn't
d3x0r
Posts: 7
Joined: 03 Jun 2009, 06:06

Re: New AI; New Developer

Post by d3x0r »

AF wrote:I'd recommend using 'dev' rather than '0.1', as for the API itself, both C++ apis are wrapped around a C API, so long as the directory structure is setup right, the library is named correctly ( they all have the same name, so look at another AI for the right filename ), and AIInfo.lua is matching, then it should work, I'm not sure why it doesn't
Ahh I was comparing other AIInfo.lua files; I had the interface listed as "ShardC" still from the original sources; the CPPTestAI has "C" listed... when I changed it, it loaded. it crashed when I used it :) but it was an available choice... it logs that it doesn't have a HandleEvent handler; but it's progress thanx.
Post Reply

Return to “AI”