MetalHeck BA Tourney for Lua AIs
Moderator: Moderators
MetalHeck BA Tourney for Lua AIs
The amazing AI tourney.
Why:
-To find out if this http://springrts.com/phpbb/viewtopic.ph ... 41#p559241 is working way to manage multiple Lua-AIs that do not want to go into gamebox
-Its fun, make one gadget and let it fight.
-AI competion!!
How Pro:
Not very pro AI required.
It is more for fun. For example a primitive AI that does but build an airlab and combombs is acceptable.
How:
Rules are as simple as possible to have low entry barrier.
For example the map does not require thinking about "where to place mexes", because that is no fun.
1) Game Setup like this:
2) This map: http://springfiles.com/spring/spring-maps/metalheckv2
3) The map has two startposition at bottom and top. The AIs will be placed by hand on them.
The other startpositions will be ignored.
3b) You can decide if your AI should play ARM or CORE, it will be set accordingly.
4) Mod is BA 8.0 - http://springrts.com/phpbb/viewtopic.php?f=44&t=32244
5) engine is 96.0
6) To make it easier, no newer versions of map/engine/mod will be used, even if something is released.
7) Make your Lua-AI and pack it like in the example. If something needs slight adjustment (like LuaAI.info) I will try to make it work and copypaste everything together so AIs can play VS each other.
Cheating:
9) Only do things that human players can do, who play with full LOS.
That means for example...
...Only controlling units of your team!
...No Spring.UnitCreate or other sillyness
10) Using globallos to get position of enemy units etc is okay, to make it easier.
11) If it crashes or lags, it is out.
Example entry:
Nooby Metalheckler version 1 in this post:
http://springrts.com/phpbb/viewtopic.ph ... 60#p559172
DO NOT USE THIS AS EXAMPLE FOR ACTUAL AI LOGIC.
THERE ARE BETTER THINGS FROM WHICH TO LEARN
AIs should have version number in both the getInfo() and file name!
Meaningful filename please, eg "AI_Combomber_v1.sdz"
"Old AIs" such as RAI, KAI, NullAI are not permitted because it would be boring if they always win.
I thought about solving that by using a more original game but then figured "Everybody knows BA, it has all the basic elements of an RTS, why not just BA."
Resources:
How to Lua-AI:
http://springrts.com/wiki/AI:Development:Lang:Lua
Ask if more questions.
BA unit names:
To look up the internal names, like ARM Peewee = "armpw"
http://pastebin.com/aknpV5xR (by Silentwings)
It's on as soon there are two entries.
Why:
-To find out if this http://springrts.com/phpbb/viewtopic.ph ... 41#p559241 is working way to manage multiple Lua-AIs that do not want to go into gamebox
-Its fun, make one gadget and let it fight.
-AI competion!!
How Pro:
Not very pro AI required.
It is more for fun. For example a primitive AI that does but build an airlab and combombs is acceptable.
How:
Rules are as simple as possible to have low entry barrier.
For example the map does not require thinking about "where to place mexes", because that is no fun.
1) Game Setup like this:
2) This map: http://springfiles.com/spring/spring-maps/metalheckv2
3) The map has two startposition at bottom and top. The AIs will be placed by hand on them.
The other startpositions will be ignored.
3b) You can decide if your AI should play ARM or CORE, it will be set accordingly.
4) Mod is BA 8.0 - http://springrts.com/phpbb/viewtopic.php?f=44&t=32244
5) engine is 96.0
6) To make it easier, no newer versions of map/engine/mod will be used, even if something is released.
7) Make your Lua-AI and pack it like in the example. If something needs slight adjustment (like LuaAI.info) I will try to make it work and copypaste everything together so AIs can play VS each other.
Cheating:
9) Only do things that human players can do, who play with full LOS.
That means for example...
...Only controlling units of your team!
...No Spring.UnitCreate or other sillyness
10) Using globallos to get position of enemy units etc is okay, to make it easier.
11) If it crashes or lags, it is out.
Example entry:
Nooby Metalheckler version 1 in this post:
http://springrts.com/phpbb/viewtopic.ph ... 60#p559172
DO NOT USE THIS AS EXAMPLE FOR ACTUAL AI LOGIC.
THERE ARE BETTER THINGS FROM WHICH TO LEARN
AIs should have version number in both the getInfo() and file name!
Meaningful filename please, eg "AI_Combomber_v1.sdz"
"Old AIs" such as RAI, KAI, NullAI are not permitted because it would be boring if they always win.
I thought about solving that by using a more original game but then figured "Everybody knows BA, it has all the basic elements of an RTS, why not just BA."
Resources:
How to Lua-AI:
http://springrts.com/wiki/AI:Development:Lang:Lua
Ask if more questions.
BA unit names:
To look up the internal names, like ARM Peewee = "armpw"
http://pastebin.com/aknpV5xR (by Silentwings)
It's on as soon there are two entries.
Last edited by knorke on 24 Jun 2014, 14:30, edited 1 time in total.
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: MetalHeck BA Tourney for Lua AIs
Here's a table of BA humanNames -> names http://pastebin.com/aknpV5xR
I don't know why some got [" "] and some didnt - something wierd in luas table.save.
I don't know why some got [" "] and some didnt - something wierd in luas table.save.
Re: MetalHeck BA Tourney for Lua AIs
I will enter my does nothing AI (as soon as I bring it up to date with the latest versions):
https://github.com/Petah/bai-lua
https://github.com/Petah/bai-lua
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: MetalHeck BA Tourney for Lua AIs
It's applied when it's needed.Silentwings wrote:I don't know why some got [" "] and some didnt
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: MetalHeck BA Tourney for Lua AIs
And when is it needed? (All the table keys and values had been through tostring() )
I will try and write an entry, time permitting :)
I will try and write an entry, time permitting :)
Re: MetalHeck BA Tourney for Lua AIs
Is there a template?
Re: MetalHeck BA Tourney for Lua AIs
Maybe this:PicassoCT wrote:Is there a template?
http://springrts.com/wiki/AI:Developmen ... _AI_Gadget
The important part is to find out which team the AI is assigned to.
Spring.GetTeamLuaAI returns the LuaAI-name that lobby as assigned to a team:
So compare that name to the name of your AI and see if they match.
Good idea is imo to put the AI-name in the getInfo() part head of gadget, then read it with stringgadget:GetInfo().name
Code: Select all
for _,t in ipairs(Spring.GetTeamList()) do
local teamID, leader, isDead, isAI, side = Spring.GetTeamInfo(teamID)
if Spring.GetTeamLuaAI(teamID) == gadget:GetInfo().name then
...this is my teamID...save it...
For example when you want to give orders to newly built units:
Code: Select all
gadget:UnitFinished(unitID, unitDefID, unitTeam)
if unitTeam ~= myAIteamID then return end --this is not one of our units: ignore it!
Spring.GiveOrderToUnit (unitID, ... ...)
That would be mean!
If the AI is supposed to controll multiple teams then it gets bit more confusing, but can care about at later stage. Here is something about that: http://springrts.com/phpbb/viewtopic.ph ... 02#p533696
Petah:
ok cool. Noticed all your echos begin with name of your AI like
Spring.Echo("BAI: "..spaces .."(metatable) ")
Think that is good idea.:) If all AI just spam random debug stuff it might be hard to see where it is coming from. No forced rule but recommended
Last edited by knorke on 02 Jul 2014, 13:54, edited 1 time in total.
Re: MetalHeck BA Tourney for Lua AIs
When is this tourney held?
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: MetalHeck BA Tourney for Lua AIs
When the table key is not alphanumeric. It would be syntactically wrong otherwise.Silentwings wrote:And when is it needed?
Re: MetalHeck BA Tourney for Lua AIs
I hope il find the time to make it in.
Re: MetalHeck BA Tourney for Lua AIs
As soon as there is a second entryJools wrote:When is this tourney held?
Then I will make a test-match against my "Nooby Metalheckler" example entry.
Think there is no use to put strict deadlines but maybe we should aim for the next few weeks or so.
Interessted so far: Petah, code_man, knorke, PicassoCT (?)
Re: MetalHeck BA Tourney for Lua AIs
There is an error in taht code.knorke wrote:Maybe this:PicassoCT wrote:Is there a template?
The important part is to find out which team the AI is assigned to.
Spring.GetTeamLuaAI returns the LuaAI-name that lobby as assigned to a team:
So compare that name to the name of your AI and see if they match.
Good idea is imo to put the AI-name in the getInfo() part head of gadget, then read it with stringgadget:GetInfo().nameCode: Select all
for _,t in ipairs(Spring.GetTeamList()) do local teamID, leader, isDead, isAI, side = Spring.GetTeamInfo(teamID) if Spring.GetTeamLuaAI(teamID) == gadget:GetInfo().name then ...this is my teamID...save it...
Here il post and improved version.
Code: Select all
function gadget:Initialize()
for _,t in ipairs(Spring.GetTeamList()) do
local teamID, leader, isDead, isAI, side = Spring.GetTeamInfo(t)
if isAI and Spring.GetTeamLuaAI(teamID) == gadget:GetInfo().name then
ai_id = teamID -- <-- This is my team ID, there are many team IDs but this one is mine
end
end
end
Re: MetalHeck BA Tourney for Lua AIs
code_man: What error do you mean?
It looks basically the same to me but maybe I miss something.
The newly added isAI:
It looks basically the same to me but maybe I miss something.
The newly added isAI:
is not needed I think because if this teamID is not controlled by a LuaAI then GetTeamLuaAI() just returns "" (empty string) so the next condition would never be true anyway.if isAI and Spring.GetTeamLuaAI(teamID) == gadget:GetInfo().name
Re: MetalHeck BA Tourney for Lua AIs
local teamID, leader, isDead, isAI, side = Spring.GetTeamInfo(teamID)knorke wrote:Code: Select all
for _,t in ipairs(Spring.GetTeamList()) do local teamID, leader, isDead, isAI, side = Spring.GetTeamInfo(teamID) if Spring.GetTeamLuaAI(teamID) == gadget:GetInfo().name then ...this is my teamID...save it...
teamID referenced before defined.
And im not sure if the IsAI is needed, but i think its probably safer.
Re: MetalHeck BA Tourney for Lua AIs
ah :)
t in the loop is already the teamID, spelling mistake, both variables should have same name.
t in the loop is already the teamID, spelling mistake, both variables should have same name.