Advertisement

question about scripting systems

Started by November 15, 2004 02:58 PM
0 comments, last by GBGames 19 years, 9 months ago
hi! I am trying to experiment a bit with writing scripting compiler and language. let's say I define in a txt file: integer ABC; this means that I declared an integer variable named ABC. How exactly do I let my VM know it is a variable, that can be manipulated like? ADD ABC 1 //adds 1 to ABC - does the VM keeps track of it? is it done with array of variables? - can someone point me generally what is the pipeline of compiler? - I have the following scheme for a simple system in my head: 1) the VM loads the script file 2) a Lexical analyzer is then parsing the lines: For each line: a) analyse the first string and find it's opcode from a table RULE: the first string is a command syntax b) if the are more words in that line (probably parameters), pack them in buffer. the buffer will contain the Opcode and these parameters c) that buffer is pushed in a stack 3) After this process is done, the VM starts with: for each Stack packet from top to buttom A) Aquire the packet. B) go through a switch statement to qualify the opCode. 1) if this is a declaration of variable, then assaign the Variable a place in tracking array -> save it. 2) etc.. C) blah blah blah as I wroe it many problems raised my eyebrow. So, what is the simplest way to write a scripting system, with it's own syntax and grammer that will control the camera, objects and etc.... thanks in advance. this is a discusion as well so feel free
A nice resource:
Game Scripting Mastery

Also, check here. Scroll down a bit, and you'll see some tutorials on making scripting systems for your game.
-------------------------GBGames' Blog: An Indie Game Developer's Somewhat Interesting ThoughtsStaff Reviewer for Game Tunnel

This topic is closed to new replies.

Advertisement