12/31/2023 0 Comments Openttd saved games![]() Try to load the exact same version of the same AI. As soon as one step succeeds, the sequence is stopped: If a savegame with an AI in it is loaded, OpenTTD tries the following. However, the game will continue normally after the Save() function is called, so you also need to handle those events. To circumvent this you can store all events (converted to allowed types) in the savegame yourself. ![]() Note: No other information is saved, so for example all pending events are lost as soon as the game is loaded. The chances of the Squirrel fair-scheduler kicking in just after a Sleep() are very slim, so you should be relatively safe. Warning: if you change a variable that you also store, and want to make absolutely sure no race-conditions happen, do it right after a Sleep(). When you return from that function, your AI continues like nothing happened. The point here is, that your AI won't notice it, besides the fact that the Save() is called for a moment. For example, in the middle of a pathfinding, or maybe when you are changing an internal array. ![]() This happens while your AI is still active doing whatever you made it do. Please note that this includes AIList, so if you want to store an AIList, you have to convert it to an array or table on save and convert it back on load.Īs soon as the user saves the game, the Save() function of your AI is called. The function should return a table with the information you want to store. If you create a Save() function in your AI, you can store some data inside the savegame.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |