Recent Changes - Search:

Main.SideBar (edit)

PmWiki

ScriptsInMap

NOTE: Scripts in map files are being used now in CVS.

Scripts in map files

We need way to embed Python localplayer- and ai-scripts in map files. They could be used e.g. to control effects and winning conditions.

Every map should have one ai script per each player, when player is not controlled by ai, the script would simply be not used. In addition, every map should have one localplayer script. This could be used to control effects, camera, etc.

Question: do we also need a separate game script (game.py?) to control e.g. winning conditions? This script would then be executed only on ADMIN.

Storage

The script could be put to scripts/ folder in map file and named ai-n.py and localplayer.py where n is number of player (e.g. if map has 2 players, there would be ai-1.py and ai-2.py).

In addition to every .py file, there can be .data file. .data files contain saved variables from scripts. They should only exist in savegames, not in map files.

There would be some default script files (for ai-s and localplayer), but you will also have to be able to change them in editor.

Loading

When game starts, for every ai player, scripts/ai-n.py script file is loaded, where n is playerid (1 - playercount) of player. For local player, scripts/localplayer.py is loaded. Additionally, in case we decide to use game scripts, scripts/game.py would be loaded.

In case we're loading a saved game, then for each loaded script file, we load corresponding .data file, which contains saved variables of corresponding script.

scripts/ directory in Boson's data dir wouldn't disappear though. It would be used to store base scripts which other scripts (the ones stored in map files) could use. They would be something like .h files are for C. They could maybe even contain base ai code, so that scripts in map would just need to call some base ai function if they don't want any special ai behaviour.

Edit - History - Print - Recent Changes - Search
Page last modified on January 15, 2005, at 15:37