Shard 0.4/dev - Page 33

Shard 0.4/dev

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

Moderators: hoijui, Moderators

User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by zoggop »

AF wrote:The ones that are positioned to the upper left of a metal spot are following the behavior I described earlier though
yes, I understand that (correct) behaviour. the second screenshot was meant show the two extractors that are not on metal spots: i.e., the config generates normal spots as well as bad ones.
AF wrote:Some of those look as if they're nowhere near metal spots at all, rather than displaced weirdly.
that's a good point, i'm probably getting the positions from somewhere else somehow.
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 »

Here's the code that retrieves the spots from the API

https://github.com/Tarendai/Shard/blob/ ... ap.cpp#L81

The algorithm IIRC was from KAI, so it's been pretty well tested, AAI/RAI/etc should exhibit the same behavior if thats the cause
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 »

I had no problems of this kind with NOTA, so c++ part is supposedly working fine. Both static and mobile builders always place mexes where there is metal.
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 »

Zoggop has made a lot of pull requests recently. Next engine release the bundled Shard should be significantly better at BA thanks to him
User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by zoggop »

:-)
AF wrote:Zoggop has made a lot of pull requests
this is partly because i have a feeling my git etiquette isn't very good--my commits and pull requests are awfully freqeuent

i know you're drowning in feature requests, AF, but would it break the engine-agnosticness for shard to provide the metal and energy values of features? a decent guess if a feature has any metal comes to mind (if the name contains the strings "heap", "wreck", or "rock"), but actually knowing would of course be preferable.
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 »

Pull requests are always welcome =]


Regarding memory issues:

  • It seems I'm already cleaning up after myself with regards to unit events for friendly units. There is an aliveUnits container that's tracked and filled and then unfilled as units are built and die. My initial hunch was wrong
  • I believe the true source of the problem lies in the get friendly units APIs. These APIs return engine unit objects that I've not wrapped. I need to wrap these to send them to the Lua AI, but they aren't tracked after that. I don't know if the engine API manufactures these objects on the fly or if they're a part of a persistent list. It's difficult to know when you don't have a set of API headers to reference
  • CSpringunit now attempts to delete the engine unit in its destructor
New items:
  • A get unit by ID call was added to the game object, e.g.:

    Code: Select all

    game:getUnitByID( 5 )
  • Next engine build may have an enemy created, damaged, and dead event

Blockers and things needed:
  • I need the vagrant environment fixing, I still can't do a full build of the spring engine with it, though it does start the build process. I simply don't know what I'm doing now, and I need help from someone who has gotten spring building under Ubuntu succesfully

    Trying to build under OS X Mavericks with the GCC issues was nightmarish last I tried.
  • Documentation on the CMake commands or a pointer to where I can find them. It's frustrating that there's a command to build the AI headers but the only way I know how is by building the entire engine. I would rather not have to go on a great wild goose chase googling and hunting through forums and wiki to find it every 4 months
  • AI API documentation. Even if it's an uncommented list of objects and their methods, this would be a vast help. It means i don't need to pull up a dev environment to answer a question or check something, I could do it on my phone. A basic doxygen or Github repo that holds the build output of the AI headers somewhere that can be read would be invaluable
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by abma »

AF wrote:Documentation on the CMake commands or a pointer to where I can find them. It's frustrating that there's a command to build the AI headers but the only way I know how is by building the entire engine. I would rather not have to go on a great wild goose chase googling and hunting through forums and wiki to find it every 4 months
"make help"
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 »

Code: Select all

~/dev/git/spring git::master 
❯ make help
The following are some of the valid targets for this Makefile:
... all (the default if no target is provided)
... clean
... depend
... edit_cache
... rebuild_cache
I'm sure there were more than that =s
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by abma »

looks like your build setup is invalid?! does "cmake ." work?

i've added some notes to the wiki:
http://springrts.com/wiki/AI:Development:Lang:Cpp

thats how output of make help should look like:

http://paste.springfiles.com/view/73560901
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 »

re-running latest vagrant setup for comparison
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 »

Engine now builds, springlobby has issues but seems I missed some vagrant repo updates

Current vagrant output:

https://gist.github.com/Tarendai/9c3b89a85190f8c6f659
User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by zoggop »

AF wrote:I believe the true source of the problem lies in the get friendly units APIs.
what about get enemy units? you just added the handling of enemy unit deaths, i see. before you made those changes, did the enemy unit objects ever get deleted?

also, thanks for working on it
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 »

The event and the request for friendly/enemy units aren't the same, I need to investigate further if the API creates new unit objects, or if it has a store of them somewhere
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by raaar »

eventually i made the conversion to pure lua AI for metal factions.

removed/refactored some parts of the shard "skeleton" and added lots of logic.

link to a zip with the files is in this thread

used it successfully in a multiplayer 2v2 game with an AI on both teams on spring 96.0.

you could use it to make an "official" lua shard skeleton for others to use.

and i might use some feedback on how to lua things properly
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 »

Nice, but is there a version controlled copy with history somewhere?
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by raaar »

nope
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 »

Ah bugger =(

You've added a lot of new behaviors, though they're not using the behaviour system I implemented and are directly in the unit handlers etc, and instead of implementing the Shard API using Spring APIs, you've sidestepped that out entirely by using the Spring API directly. The build placement file could be backported into native vanilla Shard with a little work, I'm not sure how Zoggops work differs exactlyas i've not been through it for comparison
User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by zoggop »

looks like raaar's build plan checking is more efficient, but only checks for overlapping build plans of the same unitname. also buildsitehandler is intimately linked with turtlehandler, which keeps track of where to put defenses.

anyway, all this work you've done, raaar, makes me tempted to convert the BA config into a lua ai, too.
ant1
Posts: 8
Joined: 05 Apr 2014, 13:20

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by ant1 »

Hi,


Intending to play a bit with shard on an ai for Evolution RTS.
Got the game going (from SpringLobby 0.182), loading bots (twice shard), and running in spectate mode.
However, no movement happens in-game.

This seems (to my currently very limited understanding) to be the case on maps with metal spots.
Could get full blown behaviour only on map "Trololo" so far - soon not much fun anymore :D - which accepts metal extractor building on its whole surface).

Alernatively some movement by bot controlled units can be triggered by initially loading the game including one human player, then briefly attack bot controlled idle unit which then will start building some defense and more. Still, I think, proceeding this way, no metal extractor get built by bot controlled units at any point.

Diving into lua files (as opposed to the C++ ones) so far, I got to the point that:

in ...\Shard\dev\ai\taskqueuebehaviour.lua
  function TaskQueueBehaviour:ProgressQueue()
    success = self.unit:Internal():Build(utype,p)

does get called attempting to build a unit of type "emetalextractor" at a valid position according to the function MetalSpotHandler:ClosestFreeSpot(unittype,position)
in ...\Shard\dev\ai\spothandler.lua

So that Build(utype,p) returns True, nonetheless nothing happens in-game.


Anybody can or cannot reproduce this (my test map is AlienDesert), and/or possibly set me on an improved track about it?


Cheers.
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 sure the metal placement algorithm that the engine provides is going to run well on metal maps, I would advise against it unless you put in special measures to detect such scenarios, but I don't think that's possible short of maintaining a list of metal maps or analysing and picking up the borked engine spots
Post Reply

Return to “AI”