patchBos Wars - Patches: patch #7650, Extensible storage of AI state

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #7650: Extensible storage of AI state

Submitter:  Kalle Olavi Niemitalo <kon>
Submitted:  Sun 30 Oct 2011 03:36:11 PM UTC
   
 
Open/Closed:  Closed Status:  Done
Assigned to:  kon

Sun 27 Nov 2011 08:09:17 PM UTC, comment #1: 

Tested and applied with some changes.

Kalle Olavi Niemitalo <kon>
Group Member
Sun 30 Oct 2011 03:36:11 PM UTC, original submission:  

Currently, AI scripts distribute their state across several global variables such as ai_pos[player], ai_loop_pos[player], and hotspotexists.  Each AI initialization Lua function clears those variables for all players.  This is in principle a bug because there is no guarantee that different AI scripts use the variables in compatible ways.  Also, it is impossible for the engine to clear the AI state when the game ends; thus, state from one game typically leaks to the next game and gets saved with it.

These patches move all the AI state into AiState[AiPlayer()].  Each element there is a table that the AI script can use as it likes.  Initialization functions are now told which player is going to use the AI type in question, so that they can initialize just that element of AiState and leave the others alone.  If an AI type is not used by any player, its initialization function is not called.  To get AiPlayer() working correctly in initialization functions, the functions are now called by the engine directly.

I believe these changes are complete.  However, I have not fully tested them as there are a dozen AI scripts and each of them would have to run till the end.

Kalle Olavi Niemitalo <kon>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by kon (Submitted the item)
  •  

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-11-27 kon Open/ClosedOpen Closed
        StatusNone Done
        Assigned toNone kon
    2011-10-30 kon Attached File- Added 0001-Replaced-AiList-and-_ai_scripts_-with-AiTypes.patch, #24249
        Attached File- Added 0002-Save-AI-state-in-AiState-AiPlayer.patch, #24250

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code