Feedback on scripting design



I'm redoing my scripting system, and just want some feedback or ideas for improvement. I'll try to explain it as briefly as possible. The system is hardcoded in C++, and uses Lua for scripting.

Basically, it works like this. At the start of the game, a startup script is called, which is responsible for setting up all the initial game values, selecting the starting map, and any other miscellaneous things you want taken care of at the beginning of the game. Control is then passed back to the main program, which handles I/O and watches for triggers.

Each map is defined in Lua. When a new map is loaded by the main game script, the map script sends the map data to the main program, and also registers all triggers for that map. The triggers are contained in a list, and are checked every loop.

When a trigger is evaluated true, the appropriate trigger script is processed. Triggers can be placed not only on map tiles, but on creatures and objects as well.

Item interaction is handled via scripts, as well. When any action is performed on an item (using, wielding, attacking with, etc.), the item script is processed.

Creature interaction is also handled with scripts. Each creature has a set of scripts that handle attacking, AI, special abilities, stats, etc.

Here are the C++ functions that are registered with Lua and are usable from game scripts:

Interface_NewMap(int Width, int Height);
// Clears the current map, and replaces it with a map
// of the desired dimension
Interface_SetTile(int TileType, int X, int Y);
// Sets the desired tile on the current map
Interface_PrintMessage(string Msg, int Color);
// Sends a string of the desired color to the
// message buffer to be printed
Interface_Hurt(int MonsterID, int Damage, int DamageTypeFlags);
// Deals damage to selected creature
Interface_CreateNewCreature(int CreatureType, int X, int Y);
// Creates a new creature of the desired type
// at the selected map coordinates
Interface_CreateNewItem(int ItemType, int X, int Y);
// Creates a new item at the desired location
// If X and Y == 0, then place item in inventory
Interface_SetTrigger(Trigger TriggerType, Target TriggerTarget,
string ActionScript);
// Creates a new trigger of selected type, targetting
// the desired target. When evaluated as true, will
// process the ActionScript.
Interface_MoveCreature(int MonsterID, int X, int Y);
// Teleports creature to new coordinates
Interface_UpdateVariables();
// Updates all relevant game variables, so that the Lua
// scripting environment has up-to-date data
Interface_Heal(int MonsterID, int Amount);
// Heals creature by desired amount
Interface_CreateNewObject(int ObjectType, int X, int Y);
// Creates a new object at desired location
Interface_BindKey(int KeyCode, int Action);
// Binds key to perform selected action
Interface_SetFlag(int FlagID, bool Value);
// Sets the selected flag to desired value
Interface_ToggleFlag(int FlagID);
// Toggles selected flag
Interface_DamageItem(int ItemID, int Damage,
int DamageTypeFlags);
// Damages an item
Interface_DamageObject(int ObjectID, int Damage,
int DamageTypeFlags);
// Damages an object
Interface_CanSee(int MonsterID, Target LOSTarget);
// Checks whether a target is visible from the
// creature's viewpoint


Here are a list of trigger types:
OnEnterTile();
OnExitTile();
OnEnterLevel();
OnExitLevel();
OnUse();
OnWield();
OnDrop();
OnBreak();
OnAttack();
OnKill();
OnFlagSet();
OnRead();
OnExamine();
OnHealth();
OnEat();
OnDrink();
OnTalk();
OnInteract();
OnTimer();


Since I still haven't reached an advanced stage with this project, I haven't really had any testing done yet, nor do I have anything playable enough to be able to accurately judge whether the functions and triggers above will be enough to cover all my needs, when the time comes to create the actual game content. Any ideas would be appreciated, especially if you see some missing but needed functionality.
.



Relevant Pages

  • Newbie: Why does SAMBA authentication fail?
    ... The problem is I can't map a drive to it from my Win XP box. ... ldap delete dn = No ...
    (comp.os.linux.misc)
  • Re: Drive maping help
    ... Dim objAccount, objDomain ... Set objDomain = GetObject ... Try this script, I think this is what you are asking for. ... As written, the above code will map a share whose name is, literally ...
    (microsoft.public.windows.server.scripting)
  • Re: troubleshoot a script
    ... I see you use the memberOf attribute. ... ' map appropriate drives. ... The part of the script that will not work for the 3 ...
    (microsoft.public.scripting.vbscript)
  • Re: [PATCH V2 2/3] powerpc: Add support for swiotlb on 32-bit
    ... static inline int ... nonforced_iommu(struct device *dev, unsigned long addr, size_t size) ... /* Map a single continuous physical area into the IOMMU. ... static int is_swiotlb_buffer ...
    (Linux-Kernel)
  • Re: Drive maping help
    ... Try this script, I think this is what you are asking for. ... Dim WSHNetwork ... it possible instead to use the Organizational Units name to setup the T: map? ... your script does not reference a groupname variable. ...
    (microsoft.public.windows.server.scripting)