Shard Lua AI
Moderator: Content Developer
Shard Lua AI
The implementation of Shard I've been experimenting with as a Lua AI for BA is working pretty well, and might be worth including with the game. It would always be up to date, regardless of what version of Shard was shipped with whatever engine version happens to be used at the time. I'll create a commit if it's wanted.
https://github.com/eronoobos/Shard https://github.com/eronoobos/ShardSpringLua
https://github.com/eronoobos/Shard https://github.com/eronoobos/ShardSpringLua
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Shard Lua AI
I'll clone and submit a PR, but please put your repo into a proper package so that it can be added to rapid, so that people who want to have shard can just use it as a dependency (anyone who wants to include directly can just dl the zip).
Like I said, I'll clone and do it and make a PR on github.
Edit: PR sent. Please send Abma a PM and ask him to sync it up with rapid (I suggest using the rapid tag "luaai-shard:stable/test"). That way, every time you make a new commit to the git repo, rapid spawns a new version. Gamedevs can then just rely on specific commits, or you can preface a commit with
VERSION{<versionnumberhere>}
To push out "stable" versions.
So if this were on rapid right now, I could tell evo to depend on:
"Shard LuaAI v1.0",
The lobbies would then grab the ai directly from rapid. This is a much cleaner way of distribution than having gamedevs download the fiels and include them directly.
That said, if a game dev wants to alter the core, then he still has the option to include the files directly into his game if he wants to. It's a win win for everyone.
Like I said, I'll clone and do it and make a PR on github.
Edit: PR sent. Please send Abma a PM and ask him to sync it up with rapid (I suggest using the rapid tag "luaai-shard:stable/test"). That way, every time you make a new commit to the git repo, rapid spawns a new version. Gamedevs can then just rely on specific commits, or you can preface a commit with
VERSION{<versionnumberhere>}
To push out "stable" versions.
So if this were on rapid right now, I could tell evo to depend on:
"Shard LuaAI v1.0",
The lobbies would then grab the ai directly from rapid. This is a much cleaner way of distribution than having gamedevs download the fiels and include them directly.
That said, if a game dev wants to alter the core, then he still has the option to include the files directly into his game if he wants to. It's a win win for everyone.
- prandipadaro
- Posts: 98
- Joined: 19 Oct 2011, 22:38
Re: Shard Lua AI
Uh...
i see all your work, but i don't try atm.
i will test it fast, seem a good work
i see all your work, but i don't try atm.
i will test it fast, seem a good work
- prandipadaro
- Posts: 98
- Joined: 19 Oct 2011, 22:38
Re: Shard Lua AI
in order to try shard luaAI
i just extract a version of balanced annihilation and put it inside a .sdd folder
now what should I do?
i just extract a version of balanced annihilation and put it inside a .sdd folder
now what should I do?
Re: Shard Lua AI
Forb, it hadn't occured to me that games can have dependencies with Lua AIs in them. Your scheme makes much more sense! Except then there would be two Shard repos. AF's plan is to have the Shard repo contain everything but the AI loader gadget (what's in https://github.com/eronoobos/ShardSpringLua), so that there aren't competing versions of the Lua framework and the game configs. I haven't merged my Shard fork yet because it would break things for the engine AI version (the necessary changes to the C/C++ side of things haven't been made yet). While packaging my fork with BA is the same problem, it wouldn't be sitting in a repo called Shard.
On a more technical note, I haven't tested the Lua AI implementation with anything other than BA. Could be pretty broken!
prandipadaro, to try it out put everything from https://github.com/eronoobos/ShardSpringLua into the BA .sdd, and then copy the data/ai directory from https://github.com/eronoobos/Shard/ to luarules/gadgets/ai
On a more technical note, I haven't tested the Lua AI implementation with anything other than BA. Could be pretty broken!
prandipadaro, to try it out put everything from https://github.com/eronoobos/ShardSpringLua into the BA .sdd, and then copy the data/ai directory from https://github.com/eronoobos/Shard/ to luarules/gadgets/ai
- prandipadaro
- Posts: 98
- Joined: 19 Oct 2011, 22:38
Re: Shard Lua AI
just tried and it work, but i notice some problem with builders.
I don't know if some change break builders queue, maybe your last attempt to fix lag with the failure count will stop a large amount of orders.
I don't know if some change break builders queue, maybe your last attempt to fix lag with the failure count will stop a large amount of orders.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Shard Lua AI
Using the PR that I already sent to your repo, that's exactly how I'm using it.
I do have an issue though. The files in my EvoRTS folder don't work with the AI. They cause errors. I tried tracking them down. Perhaps you could have a look? (they work fine with original shard, but luaai shard doesn't like them)
https://github.com/EvolutionRTS/Evoluti ... hard-LuaAI
So now my modinfo looks thusly:
I do have an issue though. The files in my EvoRTS folder don't work with the AI. They cause errors. I tried tracking them down. Perhaps you could have a look? (they work fine with original shard, but luaai shard doesn't like them)
https://github.com/EvolutionRTS/Evoluti ... hard-LuaAI
So now my modinfo looks thusly:
Code: Select all
-- $Id: modinfo.lua 4663 2009-05-24 06:00:10Z det $
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- file: modinfo.lua
-- brief: Mod Info
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
return {
name='Evolution RTS -',
description='EvoRTS',
shortname='EvoRTS',
version='$VERSION',
mutator='Official',
game='Evolution RTS',
shortGame='EvoRTS',
modtype=1,
depend = {
"Spring Features v1.8",
"Shard LuaAI $VERSION",
"Evolution RTS Shard LuaAI $VERSION",
},
}
Re: Shard Lua AI
Ah I see, two dependencies, one for AI, one of the luaai.lua & ailoader.lua gadget. I hadn't noticed your PR until now, I thought you meant to the BA repo, which in retrospect doesn't make any sense.
One of your errors is definitely the use of os.time() in taskqueues.lua. Not sure if that's the only one you got, but I'll make a commit to fix it (by providing a fake os object which returns the gameID as the time() function).
edit: prandipadaro, i did notice that builders sometimes start building solars or advanced solars then stop 5% into the build and do something else, but in my tests at least it didn't seem to cause major problems. i should definitely figure out what's causing it, though
One of your errors is definitely the use of os.time() in taskqueues.lua. Not sure if that's the only one you got, but I'll make a commit to fix it (by providing a fake os object which returns the gameID as the time() function).
edit: prandipadaro, i did notice that builders sometimes start building solars or advanced solars then stop 5% into the build and do something else, but in my tests at least it didn't seem to cause major problems. i should definitely figure out what's causing it, though
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Shard Lua AI
Well, unfortunately, you have done such extensive customization in BAR's shard files that I can't even use them as examples.
I've asked abma to add my repo as a rapid package. Once he has added your: https://github.com/eronoobos/ShardSpringLua repo as a rapid package and once he has added my: https://github.com/EvolutionRTS/Evoluti ... hard-LuaAI repo as a rapid package, I can push out a new test version in: https://github.com/EvolutionRTS/Evolution-RTS (evo:test) that relies on those packages so it will be easy to see what is happening. In the meantime, in order to make this work, I need something far more simple than what I see in the BAR section.
Is BAR the only game that has working customizations for shard luaai?
I've asked abma to add my repo as a rapid package. Once he has added your: https://github.com/eronoobos/ShardSpringLua repo as a rapid package and once he has added my: https://github.com/EvolutionRTS/Evoluti ... hard-LuaAI repo as a rapid package, I can push out a new test version in: https://github.com/EvolutionRTS/Evolution-RTS (evo:test) that relies on those packages so it will be easy to see what is happening. In the meantime, in order to make this work, I need something far more simple than what I see in the BAR section.
Is BAR the only game that has working customizations for shard luaai?
- prandipadaro
- Posts: 98
- Joined: 19 Oct 2011, 22:38
Re: Shard Lua AI
this is a replay with no enemy.
https://www.dropbox.com/s/mmo4ya420esnc ... .sdfz?dl=0
https://www.dropbox.com/s/mmo4ya420esnc ... .sdfz?dl=0
Re: Shard Lua AI
prandipadaro, i'm sorry i can't watch it because i've made changes since the version you made that replay with i'll try on the same map with no enemies.
edit: oh, it only finds one metal spot! https://github.com/eronoobos/ShardSpringLua/issues/4
edit: oh, it only finds one metal spot! https://github.com/eronoobos/ShardSpringLua/issues/4
Re: Shard Lua AI
please create an issue for that at https://github.com/spring/RapidTools/issues
i'm very busy and maybe someone else will do so (sorry).
also here in forum / in pm ists a bit unclear which url should be added as which tag.
i'm very busy and maybe someone else will do so (sorry).
also here in forum / in pm ists a bit unclear which url should be added as which tag.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Shard Lua AI
OK I'll add both as issues, thanks!
Re: Shard Lua AI
Is there a way to add this Shard Lua AI and the BA/BAR configuration, both on github, to the BA/BAR SVN repository? I mean, a way other than copying the files and committing them manually? Forb's method of putting them on rapid and making them dependencies would be cleaner, but rapid doesn't support submodules, which is how the BA/BAR Shard configuration is setup. Also, rapid dependencies are confusing for people who download things through springfiles.
Shard Lua AI base, as a dependency: https://github.com/eronoobos/ShardSpringLua
BA/BAR configuration: https://github.com/eronoobos/BABAR-The-Shardifant
example of a dependency that wouldn't work on rapid because of submodule: https://github.com/eronoobos/BAR-Shard-LuaAI
Does BA or BAR use any other github repositories?
It's been pointed out to me that it's a bit silly to be developing this Lua AI and not have it used by anyone.
Shard Lua AI base, as a dependency: https://github.com/eronoobos/ShardSpringLua
BA/BAR configuration: https://github.com/eronoobos/BABAR-The-Shardifant
example of a dependency that wouldn't work on rapid because of submodule: https://github.com/eronoobos/BAR-Shard-LuaAI
Does BA or BAR use any other github repositories?
It's been pointed out to me that it's a bit silly to be developing this Lua AI and not have it used by anyone.
- MasterBel2
- Posts: 347
- Joined: 11 Apr 2016, 12:03
Re: Shard Lua AI
On that, I'm keen to have a play against the shard AI; How should I go about downloading it and what will I then need to do to put it where spring needs it to run it?
Re: Shard Lua AI
the most complete instructions at the moment are at https://github.com/eronoobos/Balanced-A ... hard-LuaAI you'll need git. it's written for Linux directories, but the Windows equivalent is just Documents\My Games\Spring\ instead of .spring/
Re: Shard Lua AI
i made a commit to BA, adding the AI
http://imolarpg.dyndns.org/trac/balatest/changeset/5566
http://imolarpg.dyndns.org/trac/balatest/changeset/5566
Re: Shard Lua AI
wasn't the idea for the dedicated git repo for the ai to avoid to copy the files into several repos?eronoobos wrote:i made a commit to BA, adding the AI
-> remove the files and add the AI as depending to BA
why where the ai's put into a dedicated repo?
Re: Shard Lua AI
Yes, but in the case of BA/BAR, it's not a git repo, and therefore can't be any kind of submodule. Instead it has to be a Spring dependency, which is all well and good for testing the AI, but for players relies on a lobby downloading the dependency through rapid, right? In theory I think Spring dependencies is the right way to do this, but in practice springfiles exists and we download things from it. If someone doesn't have the dependency, the game will not run at all. I doubt that BA/BAR wants to have a game that doesn't work if downloaded through springfiles.abma wrote:wasn't the idea for the dedicated git repo for the ai to avoid to copy the files into several repos?
Sorry to be confusing. I still think one repo for the shared Lua code between Shard and ShardSpringLua would be helpful, but AF and I need to reorganize some things before that can work. There's a lot of infrastructure complexity in implementing Shard in different environments while sharing code.
Where is this quote from?abma wrote:-> remove the files and add the AI as depending to BA