Shard 0.4/dev - Page 27

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 »

For build facing, how about an additional Build method taking the form:

Code: Select all

engineunit:build(type,position,facing)
Where the values of facing are predefined e.g.

Code: Select all

build_facing.north
Suggestions?
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 »

Looks good to me.

While we're at it, maybe facing should be added to CanBuildHere as well, since buildings can have non-square footprints?
User avatar
1v0ry_k1ng
Posts: 4656
Joined: 10 Mar 2006, 10:24

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by 1v0ry_k1ng »

this working (in the form of a standalone downloadable file that I can insert into spring and immediately play against) with any major mods atm?
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by Erik »

This is working with Void but with an older version of 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 »

FindClosestBuildSite and CanBuildHere in the C++ part now have counterparts FindClosestBuildSiteFacing and CanBuildHereFacing.

Build now also takes a facing parameter on the end if provided. It also does more checks on the type of units validity and tests if the structure can actually be built at the target before issuing the build order
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by Erik »

ExecuteCustomCommand is not working over here, is there a version that has it implemented already?
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 »

It's always been marked as experimental, since I don't have an appropriate test case to test against. If I wanted to know, I'd most likely ask yourself.

If it doesn't work at the moment I'd err on the side of saying it never worked and I had no way of knowing
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by Erik »

Also shard seems to randomly fail building anything on these maps: Titan-v2, Titanduel.
Not sure why.

Edit: Did some more testing and now can rule out any mistakes:
Theres a factory on perfectly flat terrain on Titan-v2 where it never builds and the same factory on similar terrain at a slightly different position works.
Also the same factory works with the same units on all my other maps except those two and whenever i command the same factory at the same spot to build the exact same thing.
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 »

Given the spacing dynamic, it could be that the closest possible position that fits the spacing parameters is outside the search radius.

What is your factories footprint and what's the spacing parameters and search radius?
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by Erik »

Code: Select all

	FootprintX = 12,
	FootprintZ = 12,
	MaxSlope = 10,	
	YardMap ="oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo oooooooooooo ooooccccoooo ooooccccoooo ooooccccoooo ooooccccoooo ooooccccoooo ooooccccoooo",

I don't think this is the problem because the same factory:
-produces a mobile unit(terrain problems should usually show up after construction is finished but it doesn't even start)
-works fine on all other maps so far
-works fine on some spots
-works fine if i enable godmode and start construction manually

edit: Pictures of the spots in case it helps
non working spots
Image
working spots
Image
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 »

So basically there must be a minimum distance of (12 footprint square*spacing value) between the tested position and the nearest unbuildable spot.

It's very likely that the nearest valid position is outside the radius of the search area.

Can I see your current code grabbing the location? Keep in mind that Shard relies on the engines building placement callback and what say I have in the matter is dependent on the search radius and spacing values ( which can be passed in yourself, not passing them in will use my heuristics which are far from optimal ).

It's my longterm goal to abandon the engines API closestbuildsite API call as it's a pain in the arse. Until I can do so there isn't a lot i can do to help other than advocate you use the canbuildhere APIs to do your own tests to implement your own algorithm. Shouldn't be too hard to do but i don't have a test environment right this moment ( clean machine install a week ago, no visual studio or compilers, no spring install )
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by Erik »

Its building mobile units within its perimeter, so no code for location grab at all.
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 »

Mobile unit footprints are not the same as factory footprints.

Also a factory can build whatever the hell it wants, closestbuildsite will not have an impact.
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by Erik »

So why on earth does it fail on some locations? It only seems to fail on "Titan" maps and only on some spots on that "outer plains" terrain.
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 don't know. A widget that visualised this would be useful but I wouldn't know where to begin. Closestbuildsite has always been a finnicky suboptimal solution, and a replacement has long been on my todo list
elias79
Posts: 57
Joined: 11 May 2008, 23:29

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by elias79 »

Is shard the only actively developed AI for spring ?
How do i put some distance between the building my units get stuck.
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 »

Since the building placement is something that crops up every few months, I wrote a blog post on the subject:

http://darkstars.co.uk/2013/closestbuildsite-shard/

It goes into why it fails so badly and what needs to be done. Right this moment I don't have a spring or development environment set up at home to test this with ( new Windows 8 install, moving flat, I don't have any dev tools installed yet, just sublimetext and an svn/git client ), but when I do I'll want to look into this
elias79
Posts: 57
Joined: 11 May 2008, 23:29

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by elias79 »

Image

Power plants block both defense and units from the factories.
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Post by Erik »

Woot Tiberian Dawn!

Also i was kinda working on a way to make the AI place defenses in a way that makes sense, perhaps i'll finish that some time.
Post Reply

Return to “AI”