Page 27 of 42

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 27 Nov 2012, 11:07
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?

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 27 Nov 2012, 11:25
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?

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 27 Nov 2012, 16:34
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?

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 27 Nov 2012, 18:51
by knorke

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 27 Nov 2012, 22:19
by Erik
This is working with Void but with an older version of shard.

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 28 Nov 2012, 20:42
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

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 27 Jan 2013, 16:03
by Erik
ExecuteCustomCommand is not working over here, is there a version that has it implemented already?

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 27 Jan 2013, 22:41
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

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 30 Jan 2013, 16:08
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.

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 31 Jan 2013, 00:53
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?

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 31 Jan 2013, 00:59
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

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 31 Jan 2013, 16:14
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 )

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 31 Jan 2013, 20:27
by Erik
Its building mobile units within its perimeter, so no code for location grab at all.

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 01 Feb 2013, 00:28
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.

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 01 Feb 2013, 11:03
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.

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 01 Feb 2013, 16:33
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

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 07 Mar 2013, 02:02
by elias79
Is shard the only actively developed AI for spring ?
How do i put some distance between the building my units get stuck.

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 07 Mar 2013, 11:20
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

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 08 Mar 2013, 06:23
by elias79
Image

Power plants block both defense and units from the factories.

Re: Shard 0.35RC2 & 0.31.1 Not So Ballsey

Posted: 08 Mar 2013, 10:53
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.