[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[bos-dev] [patch #7650] Extensible storage of AI state



URL:
  <http://savannah.nongnu.org/patch/?7650>

                 Summary: Extensible storage of AI state
                 Project: Bos Wars
            Submitted by: kon
            Submitted on: Sun 30 Oct 2011 03:36:11 PM GMT
             Open/Closed: Open
                  Status: None
             Assigned to: None
        Originator Email: 
         Discussion Lock: Any

    _______________________________________________________

Details:

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.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 30 Oct 2011 03:36:11 PM GMT  Name:
0001-Replaced-AiList-and-_ai_scripts_-with-AiTypes.patch  Size: 22kB   By: kon

<http://savannah.nongnu.org/patch/download.php?file_id=24249>
-------------------------------------------------------
Date: Sun 30 Oct 2011 03:36:11 PM GMT  Name:
0002-Save-AI-state-in-AiState-AiPlayer.patch  Size: 71kB   By: kon

<http://savannah.nongnu.org/patch/download.php?file_id=24250>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?7650>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/