Page 1 of 1

Native AIs & API Maintenance

Posted: 08 Apr 2014, 18:10
by AF
Currently AIs have some issues outside of the lua AI that can be bundled with games.

We have an API that's been generated from AWK scripts, but there is little documentation or explanation as to how those scripts actually work, and what they run off of as their input.

Because of this we have these issues:

- LUA <-> AI comms has stopped working, the exact cause is unknown
- No VFS access, and no indication of how it would be added
- Some calls have problems but there's no thorough test suite of the generation to ensure that it creates good mappings that work as expected

While Shard can be shifted over to Lua AI land with some work, this puts a large amount of potential code out of reach, such as the pathfinders in the C++ AIs, multithreading for more advanced AI techniques, and non Lua AIs.

Native AIs have always been a source of new engine developers and academic interest and research, regardless of the opinions or needs of content developers, we should identify what needs to be done and what the failings are ( even if the outcome is an improved lua interface ).


Does anybody have a high level understanding of any of the API parts who'd be willing to outline what they're aware of? Clearly we need new maintainers in this area

Re: Native AIs & API Maintenance

Posted: 09 Apr 2014, 02:15
by Kloot
Wrong on the first two counts...

The Lua <-> AI communications scheme I added is functional (even through the OO C++ wrapper) though only in half-duplex mode as I explained before, support for it was just incomplete on Shard's part last time I checked. Sorry, CBA to make a patch.

The legacy C++ wrapper exposes VFS function callbacks, the OO C++ wrapper has a generated File class "abstraction" in namespace springai which (deep in its bowels) engages the same code.

Undoubtedly some other interface stuff will have suffered bitrot, or never worked right to begin with (only the legacy wrapper has received reasonable testing coverage afaik). That would be a consequence of there being four layers of convoluted crap now instead of one to get from engine to AI library or vice versa, which no remaining active sane dev wants to work on (speaking for myself: I would only consider it if there was $$$ involved) and makes maintenance a giant PITA. Combine this with the trend toward dedicated Lua-only AI's (even the *A's contain masses of game-logic altering gadgets at this point) and you are unlikely to find anyone still willing to step up and protect the natives.

On a technical note, more powerful direct Lua <-> AI interaction (as opposed to tossing parsable strings back and forth) could be achieved by leaking raw lua_State*'s across the interface layers and allowing AI's to supply their own Lua bindings, but Thou Shalt Not go there.

Re: Native AIs & API Maintenance

Posted: 09 Apr 2014, 12:20
by AF
That last part would certainly alleviate a lot of demands made on Shard =p, and I don't blame the mass movement of *A games to dedicated lua only AIs

So from the sounds of it you'd recommend not to use the Oo API and to use the legacy API instead?

What would you recommend be done to remove layers of abstraction/simplify things if someone else were to do the job?

What's your hourly rate?

Re: Native AIs & API Maintenance

Posted: 09 Apr 2014, 13:39
by gajop
AF wrote:What's your hourly rate?
If you have to ask how much it costs, you can't afford it! 8)

Re: Native AIs & API Maintenance

Posted: 09 Apr 2014, 15:10
by AF
From the looks of it the hgih level OO API functions as:
  • Awk script looks at https://github.com/spring/spring/blob/d ... Callback.h
  • Using the comments as a start and end indicator, it creates classes of said name
  • The methods in said classes map on to the functions defined in the header between said comments, matching the names, so:

    Code: Select all

    float             (CALLING_CONV *Economy_getIncome)(int skirmishAIId, int resourceId); //$ REF:resourceId->Resource
    with the name Economy_getIncome becomes a getIncome method on an Economy object, with some annotation indicating to replace the resourceId with a resource object
Perhaps I can write some code with a simpler more generic understandable parser that generates a graph that can be manipulated and output in plain text structures as debug for human evaluation.

I understand the awk script a little more now but it's difficult to track everything ( soo long )

Re: Native AIs & API Maintenance

Posted: 09 Apr 2014, 15:24
by SinbadEV
My hourly rate as a useless sod (that knows how to use computers and is capable of politely explaining why you aren't going to get a refund) is about $20 CAD an hour... quick googling suggests that the going rate for "If you have to ask how much it costs, you can't afford it!" is $100 an hour with a minimum of 80 hours... if you don't want to work and are just saying "leave me alone" that usually works out to $200 + expenses.

OpenSource is the only way for things like SpringRTS to happen because nobody would be able to pay anyone enough to do this work... you have to be crazy enough to want to do it.