Shard Lua AI

Shard Lua AI

Classic game design, maintained to please you...

Moderator: Content Developer

Post Reply
User avatar
eronoobos
Posts: 73
Joined: 27 Mar 2015, 20:25

Shard Lua AI

Post by eronoobos »

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
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Shard Lua AI

Post by Forboding Angel »

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.
User avatar
prandipadaro
Posts: 98
Joined: 19 Oct 2011, 22:38

Re: Shard Lua AI

Post by prandipadaro »

Uh...
i see all your work, but i don't try atm.
i will test it fast, seem a good work
User avatar
prandipadaro
Posts: 98
Joined: 19 Oct 2011, 22:38

Re: Shard Lua AI

Post by prandipadaro »

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?
User avatar
eronoobos
Posts: 73
Joined: 27 Mar 2015, 20:25

Re: Shard Lua AI

Post by eronoobos »

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
User avatar
prandipadaro
Posts: 98
Joined: 19 Oct 2011, 22:38

Re: Shard Lua AI

Post by prandipadaro »

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.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Shard Lua AI

Post by Forboding Angel »

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:

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",		
	},
}
User avatar
eronoobos
Posts: 73
Joined: 27 Mar 2015, 20:25

Re: Shard Lua AI

Post by eronoobos »

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
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Shard Lua AI

Post by Forboding Angel »

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?
User avatar
prandipadaro
Posts: 98
Joined: 19 Oct 2011, 22:38

Re: Shard Lua AI

Post by prandipadaro »

User avatar
eronoobos
Posts: 73
Joined: 27 Mar 2015, 20:25

Re: Shard Lua AI

Post by eronoobos »

prandipadaro, i'm sorry i can't watch it because i've made changes since the version you made that replay with :-P 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
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Shard Lua AI

Post by abma »

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.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Shard Lua AI

Post by Forboding Angel »

OK I'll add both as issues, thanks! :-)
User avatar
eronoobos
Posts: 73
Joined: 27 Mar 2015, 20:25

Re: Shard Lua AI

Post by eronoobos »

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.
User avatar
MasterBel2
Posts: 347
Joined: 11 Apr 2016, 12:03

Re: Shard Lua AI

Post by MasterBel2 »

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?
User avatar
eronoobos
Posts: 73
Joined: 27 Mar 2015, 20:25

Re: Shard Lua AI

Post by eronoobos »

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/
User avatar
eronoobos
Posts: 73
Joined: 27 Mar 2015, 20:25

Re: Shard Lua AI

Post by eronoobos »

i made a commit to BA, adding the AI
http://imolarpg.dyndns.org/trac/balatest/changeset/5566
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Shard Lua AI

Post by abma »

eronoobos wrote:i made a commit to BA, adding the AI
wasn't the idea for the dedicated git repo for the ai to avoid to copy the files into several repos?

-> remove the files and add the AI as depending to BA

why where the ai's put into a dedicated repo?
User avatar
eronoobos
Posts: 73
Joined: 27 Mar 2015, 20:25

Re: Shard Lua AI

Post by eronoobos »

abma wrote:wasn't the idea for the dedicated git repo for the ai to avoid to copy the files into several repos?
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.

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.
abma wrote:-> remove the files and add the AI as depending to BA
Where is this quote from?
Post Reply

Return to “Balanced Annihilation”