AITile.IsBuildable()

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

AITile.IsBuildable()

Post by Zutty »

Just a quick one for the devs... I'm getting inconsistent results from AITile.IsBuildable() on coast tiles. This really feels like a bug to me, as the result is unpredictable. Mostly it returns false for any land tile that borders with water, but sometimes it returns true for no apparent reason. There can be a long stretch of coast tiles in a line, and one out of twenty will be buildable at random!

Ideally I'd like IsBuildable() to return true for coast tiles with nothing on them (it would be helpful for bridge building), but just having consistent results will be a start!

Is this a bug? Can we have it fixed? Is it already fixed?! (I'm still using r13326)

Thanks.


As for libraries, I've only just noticed that there are standard libs already. To be perfectly honest I don't know what the value will be in having 20 separate binary heap implementations made available, so I probably won't bother posting my own code anymore! Plus I'm not going to re-engineer my pathfinder to use the library code at this stage, so there wouldn't be much point in me posting my pathfinder either (and frankly, A* is A* regardless of who wrote it!!). I might post some other parts of my AI in the library format (maybe some of the graph stuff I'm working on) if people are interested, but that'll suit me for now. You'd all probably be horrified by my Java-esque style of coding anyway!! ;) I use camelCase for variables and ExtremelyExplicitMethodNames().
PathZilla - A networking AI - Now with tram support.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: NoAI Branch - An AI Framework

Post by Zutty »

Zutty wrote:Just a quick one for the devs... I'm getting inconsistent results from AITile.IsBuildable() on coast tiles. This really feels like a bug to me, as the result is unpredictable. Mostly it returns false for any land tile that borders with water, but sometimes it returns true for no apparent reason. There can be a long stretch of coast tiles in a line, and one out of twenty will be buildable at random!

Ideally I'd like IsBuildable() to return true for coast tiles with nothing on them (it would be helpful for bridge building), but just having consistent results will be a start!

Is this a bug? Can we have it fixed? Is it already fixed?! (I'm still using r13326)

Thanks.
I'm sorry to bump my own post, but I don't suppose anyone can answer this question can they? :) Its kind of blocking my development at the moment.

Its hard keeping track of stuff in just a single thread. That new forum will be very handy.
PathZilla - A networking AI - Now with tram support.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoAI Branch - An AI Framework

Post by TrueBrain »

Zutty wrote:I'm sorry to bump my own post, but I don't suppose anyone can answer this question can they? :) Its kind of blocking my development at the moment.
It is fixed now, and in 5 hours and 25 minutes in the binaries that will produced by then :)
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: NoAI Branch - An AI Framework

Post by Zutty »

TrueLight wrote:
Zutty wrote:I'm sorry to bump my own post, but I don't suppose anyone can answer this question can they? :) Its kind of blocking my development at the moment.
It is fixed now, and in 5 hours and 25 minutes in the binaries that will produced by then :)
You're a god! :bow:
PathZilla - A networking AI - Now with tram support.
User avatar
Ralph
Engineer
Engineer
Posts: 87
Joined: 21 Jun 2004 15:25

Re: NoAI Branch - An AI Framework

Post by Ralph »

Zutty wrote:Wow! That IS impressive, considering that aircraft are at a natural advantage to buses in OpenTTD. Congratulations GeekToo :D You've set the bar!

Edit: Hey Truelight can we get RalphsAI into the tournament also?
Mine is currently not working, seems AITile.IsBuildable is returning false on roads now..

Is this the intended behavior from now on?
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoAI Branch - An AI Framework

Post by TrueBrain »

Ralph wrote: Mine is currently not working, seems AITile.IsBuildable is returning false on roads now..

Is this the intended behavior from now on?
yes.
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: NoAI Branch - An AI Framework

Post by Zutty »

Ralph wrote:
Zutty wrote:Wow! That IS impressive, considering that aircraft are at a natural advantage to buses in OpenTTD. Congratulations GeekToo :D You've set the bar!

Edit: Hey Truelight can we get RalphsAI into the tournament also?
Mine is currently not working, seems AITile.IsBuildable is returning false on roads now..

Is this the intended behavior from now on?
Damn! If its any consolation, I need to spend tonight adjusting my AI to cope with this change too!!

I like this new feature though, as it forces me to formalise the traversal of existing roads.
PathZilla - A networking AI - Now with tram support.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: AITile.IsBuildable()

Post by Zutty »

WOAH! MAGICAL THINGS HAVE HAPPENED!
PathZilla - A networking AI - Now with tram support.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoAI Branch - An AI Framework

Post by TrueBrain »

Zutty wrote: Damn! If its any consolation, I need to spend tonight adjusting my AI to cope with this change too!!

I like this new feature though, as it forces me to formalise the traversal of existing roads.
Also, in the future, Rail will work as one might expect :) But after many problems with IsBuildable, it should now be stable.. I hope :)
The only thing necessary for the triumph of evil is for good men to do nothing.
Finaldeath
Engineer
Engineer
Posts: 72
Joined: 09 Apr 2006 23:49
Location: UK
Contact:

Re: AITile.IsBuildable()

Post by Finaldeath »

Yeah, thanks again Truelight and the others for fixing that. It can return true if there is only half sections of road (since these can be removed when building on them) but not for full sections of road (which block building) if I recall the fix correctly. I guess the API docs reflect that.
Finaldeath
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 6 guests