The AI doc talks about "[...] a piece of code that queues all your commands in a big list and starts executing them on request all at once. Now if one fails, where it didn't before, it rolls everything back.".
Found in the last paragraph here: https://wiki.openttd.org/en/Development ... s#now-what
Any idea what this is referring to?
Can't find "a piece of code that queues all your commands in a big list"
Moderator: OpenTTD Developers
-
- Engineer
- Posts: 6
- Joined: 13 Sep 2021 14:05
Re: Can't find "a piece of code that queues all your commands in a big list"
I think the intended meaning of that paragraph is "it might be a good idea to write such a thing as part of your AI".
-
- Engineer
- Posts: 6
- Joined: 13 Sep 2021 14:05
Re: Can't find "a piece of code that queues all your commands in a big list"
Oh. I was hoping to save some time.
Then, if you or anyone happens to know the existence of a script/class/library doing something like that, feel free to post it here.
Thank you
Then, if you or anyone happens to know the existence of a script/class/library doing something like that, feel free to post it here.
Thank you
Re: Can't find "a piece of code that queues all your commands in a big list"
Here's a framework for you:
The hard part is not really going over a list of stuff in first-in-first-out fashion, it's what to put in the list so you get the appropriate granularity, how you want to handle unexpected changes to the world that make the planned commands impossible or pointless, and when/how often you want to check for game events too.
Most of that isn't something I think is suited for putting into a framework or library, because they are part of the things that make your AI have personality.
Code: Select all
while (commandList.len() > 0) {
ExecuteCommand(commandList[0]);
commandList.remove(0);
}
Most of that isn't something I think is suited for putting into a framework or library, because they are part of the things that make your AI have personality.
Who is online
Users browsing this forum: No registered users and 14 guests