Stacking AITestMode actions

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
btzy1996
Engineer
Engineer
Posts: 20
Joined: 31 Aug 2012 05:09

Stacking AITestMode actions

Post by btzy1996 »

Hi,

I'm trying to write an AI, but have ran into some difficulties trying to check if a station can be built at a particular location before deciding where to build it. To build a station, I have to first flatten the land, and then build the station on it. The problem is that when using AITestMode, actions aren't actually applied, and so you can't test if the station can be built after flattening the land. (And actually, even flattening the land takes multiple raise/lower land actions, and the fact that you can raise/lower each tile corner does not imply that you can flatten the entire rectangle as desired.)

Is there any way make actions in AITestMode stack until the AITestMode object is destroyed, or is there some better way to tell if I can flatten the land and build a station on it without actually flattening the land?
User avatar
jfs
Tycoon
Tycoon
Posts: 1757
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Stacking AITestMode actions

Post by jfs »

Unfortunately not, no. To do that, the game would need to have a way to "checkpoint" the world state and be able to roll back, and that just doesn't exist right now. It might be possible to add in some way at some point, but don't count on it being any time soon.
btzy1996
Engineer
Engineer
Posts: 20
Joined: 31 Aug 2012 05:09

Re: Stacking AITestMode actions

Post by btzy1996 »

Oh I see, that's unfortunate. Guess I'll have to find some heuristic to predict if a station will be buildable.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 6 guests