Only one object could be on a tile at a time and they couldn't sit between tiles. Each game step (about 3 every second), all the scripts would be executed, then all the objects which wanted to move would simulateously move by sliding from tile to tile in the animation step that followed. Some script commands would block the script execution whilst the action was carried out. For instance, if the object called the "move left" command, execution of that object script would pause for that game step, the object would slide left in the animation stage and the next game step would start after this.
The point of the project was to make every single object scripted in an easy to use language so that every game room could be packed with unique game objects that would be fun to play about with. For example, gambling machines, using buttons to control a robot, having a dog follow you when you feed it etc.
A basic enemy who will stagger around randomly and die when shot was scripted like this:
# script starts here when the game starts
created:
move any_free # move in any non-blocked direction
wait 0..3 # wait randomly between 0 and 3 turns
goto created # jump back to the start of the script
# script jumps here when sent a shot message
# from a bullet when shot by the player
shot:
play scream # play the screaming sound effect
shake # make the tile shake for one turn
give score 5 # give the player 5 points
die # destroy this object
It all worked pretty good until the inevitable stage where writing my own scripting language became too complex when I wanted to add features like multiple variable types, functions and parameter passing.
Does anybody know of a suitable scripting language which could be adapted for the role I have described above? The main features that are important are 1) every game object will be scripted and there could be many object on the screen at one time 2) scripts can be paused and resumed when certain commands are called 3) the scripting language can be adapted to have very simple syntax. The game was to be split up into many smallish rooms, where only the objects in the current room would be alive. Each object has to store it's current script position and variable values though, and there could be potentially hundreds or even thousands of objects in the game world so each object needs to have a very small memory footprint.
Does anyone have any recommendations to which scripting langage would best suited for this role?