Shard 0.4/dev - Page 31

Shard 0.4/dev

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

Moderators: hoijui, Moderators

User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by AF »

Have you tried an unsynced version? What about integers and tables?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by Kloot »

The data return paths from fudget:RecvSkirmishAIMessage (invoked by AI:CallLua*) and from AI:RecvLuaMessage (invoked by Spring.SendSkirmishAIMessage) do not work because the interface generator scripts are too primitive to handle basic C pointer-pointers. I was initially unaware of that "limitation" (not being their author) so full bidirectional AI<-->Lua communications briefly functioned as advertised (for legacy C++ AI's) until this happened and they had to be disabled. As a result only half-duplex mode is available which means you can send data from Lua to AI's (but not hear anything back) and send data from AI's to Lua (but not hear anything back), but nothing else. You must write your own syn/ack system to get around this.

All these extra layers in between engine and AI's sure are nice to maintain and extend.
raaar
Metal Factions Developer
Posts: 1095
Joined: 20 Feb 2010, 12:17

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by raaar »

It seems shard only has the game:SendToContent() way to interact. So even if i replace the "return" in the gadget with Spring.SendSkirmishAIMessage(...) there doesn't seem to be a way to receive the data from the AI side.
raaar
Metal Factions Developer
Posts: 1095
Joined: 20 Feb 2010, 12:17

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by raaar »

changing shard to support receiving strings from Spring.SendSkirmishAIMessage(...) on gadgets/widgets doesn't seem too hard.

will anyone do it?

(i didn't want to go into engine development or AI development other than using the lua that is already exposed...but..)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by AF »

I'm not aware of that API
raaar
Metal Factions Developer
Posts: 1095
Joined: 20 Feb 2010, 12:17

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by raaar »

Kloot wrote:(...)
As a result only half-duplex mode is available which means you can send data from Lua to AI's (but not hear anything back) and send data from AI's to Lua (but not hear anything back), but nothing else. You must write your own syn/ack system to get around this.
(...)
from Kloot's post, it seems what's missing in the current shard is support for the "send data from Lua to AI".

my crappy knowledge of the Spring src tells me that the support for the lua part apparently shows up here (line 2737)
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by yuritch »

Would it be possible to make Shard able to detect idle units? Sometimes the callin gets skipped apparently (mostly for builders) and they can remain idle until my watchdog gets them. As it is not currently possible to tell if a builder is doing something or not, watchdog just checks at intervals longer than (most) build times, which means units may idle quite a bit.

"Idle units" in this context means they have no active orders, build/move/attack/etc. Something like isIdle or ordersCount in the Unit object would do.
User avatar
Petah
Posts: 426
Joined: 13 Jan 2008, 19:40

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by Petah »

yuritch wrote:Would it be possible to make Shard able to detect idle units? Sometimes the callin gets skipped apparently (mostly for builders) and they can remain idle until my watchdog gets them. As it is not currently possible to tell if a builder is doing something or not, watchdog just checks at intervals longer than (most) build times, which means units may idle quite a bit.

"Idle units" in this context means they have no active orders, build/move/attack/etc. Something like isIdle or ordersCount in the Unit object would do.
I asked this almost exact question in http://springrts.com/phpbb/viewtopic.php?f=15&t=30864
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by yuritch »

It's much easier to do in gadget lua, Shard lua does not have access to all of the same data. Hence the request.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by AF »

I would consider this a bug in the API, as pretty much all the AIs I've written rely on this event

That or there's a bug in the task manager system in the lua end where on the unit idle event it never gets back around to doing something
raaar
Metal Factions Developer
Posts: 1095
Joined: 20 Feb 2010, 12:17

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by raaar »

I've been testing my shard cfg, and occasionally i get spammed with

Code: Select all

Warning: AI for team 0 (ID: 0) failed handling event with topic 3, error: 102
and it doesn't recover. If i try to reload the AI it crashes.

I had this on 94.1, but still have it on one of the latest spring 95 test builds: "94.1.1-1087-gaad7847 develop".

PS: with my special sauce, shard can easily defeat RAI 1v1 and on small/medium maps even 1v2 :)
Attachments
infolog_ai_error.txt
example of it happening
(61.61 KiB) Downloaded 6 times
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by yuritch »

See this post and the one following it. Basically abma says this should be fixed in 95, if that's not the case, it should be reported.
raaar
Metal Factions Developer
Posts: 1095
Joined: 20 Feb 2010, 12:17

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by raaar »

so..... if i want to do minimal changes to shard src (enable spring lua --> shard lua communication) and test my builds, what's the fastest route?

What i can find here implies that i need the setup to build spring to build shard.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by AF »

Yes you'll need to build latest spring, and use it to generate the API headers and code needed to build Shard.
raaar
Metal Factions Developer
Posts: 1095
Joined: 20 Feb 2010, 12:17

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by raaar »

yesterday i got the stuff mentioned in the wiki for building spring, but cmake keeps complaining about boost being missing, despite me configuring the boost directory (where i unpacked the zip i got from the website) in the cmake settings.

the goal wasn't just the communication issue but also wanted to try and figure out why

Code: Select all

Warning: AI for team 0 (ID: 0) failed handling event with topic 3, error: 102
keeps happening.

thinking about it, maybe most efficient approach is to just bypass the issues by converting shard to work as a lua AI.

Is there any licence problem or whatever with it?

what's the catch?
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by abma »

raaar wrote:thinking about it, maybe most efficient approach is to just bypass the issues by converting shard to work as a lua AI.
because of some bug you want to switch language? wtf? also afaik some posts ago AF explained how the lua-code can be (re-) used as lua ai.

imo your build-setup is fail. you gave way to few info to give hints what went wrong...
raaar
Metal Factions Developer
Posts: 1095
Joined: 20 Feb 2010, 12:17

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by raaar »

wanting to avoid the whole build-setup for spring seems reasonable to me because i only wanted to fix one or two specific issues in the first place (the AI bug may be hard to duplicate, and unfortunately always seems to lead to a crash in long games). I knew C, but never got into C++.

it seems focusing on luaing is probably a more efficient use of my time. It also allows me to be less dependent on spring releases.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by AF »

raaar wrote:wanting to avoid the whole build-setup for spring seems reasonable to me because i only wanted to fix one or two specific issues in the first place (the AI bug may be hard to duplicate, and unfortunately always seems to lead to a crash in long games). I knew C, but never got into C++.

it seems focusing on luaing is probably a more efficient use of my time. It also allows me to be less dependent on spring releases.

The original premise of the entire project was to be engine agnostic, so implementing as a spring gadget made no sense in that context.

Of course if the API was implemented so that it called gadget APIs then there'd be no difference, but that's work that needs doing, and I've not needed to do it, especially since it doesn't fix any problem I have at the moment, and there was always the APIs provided.

Now that it turns out those APIs don't work, some bug fixing will be necessary, perhaps you'd like to do the gadget implementation work? You'll need to implement a building placement algorithm if you do, which I've spoken about in this thread recently.

Also keep in mind that the SWIG binding generation could just as easily be told to generate bindings for another language, eg python, etc. Using lua gadgets would remove that option.
User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by zoggop »

I made an LOS simulation in a shard config by grabbing the radii from the unidefs with a widget and saving it as a lua table. (I want an AI that doesn't cheat!) But it's only as good as it can be: not so much line of sight as circles on a grid. Is there any chance Shard will get access to Spring's LOS in the future?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by AF »

My main obstacle is that the Ubuntu machine I set up to do Shard stuff on has gone and upgraded itself to Saucy Salamander 13.10 development branch, and is slowly tearing itself apart.

Think of an appropriate API for how you'd like to be able to access it though and I can look properly when I get Ubuntu 12 LTS installed
Post Reply

Return to “AI”