Scripting Engine in V12
by Trevor Barnett · in General Discussion · 03/17/2001 (12:00 am) · 4 replies
A question about the V12 scripting engine. What are its capabilities and must it load the scripts from a file? For example if I wanted each player to be able to define the AI for his "ship" while he was away in a MMORPG, and had the script uploaded, would this be feasible? Can I define my own procedures and entry points? That may seem like a ramble, and it is. Maybe a better question to ask is: Could you explain the capabilities of the scripting engine and how it is implemented in code? (IE a class that represents a script or a class that represents the whole engine, or a function that loads the script, you get the idea).
About the author
#2
03/17/2001 (12:34 pm)
And how about the Server/Client model? Does it work likee quake so I can define a weapon on the server with a script adn have it be used by the client without the client having the same script?
#3
03/17/2001 (2:35 pm)
Depending on how you implemented it, yes. There are Server side "DataBlocks" that get automatically transfered to each client. These dataBlocks can be virtually anything... including new weapons.
#4
09/09/2001 (10:08 am)
I have a question on this topic. You say you can use datablocks to the able to specify server side data only, but is this secure and is the client devoid of being able to override it with other scripts? Im basically just curious on how the scripting for multiplayer games can prevent cheating.
Torque Owner Rick Overman
Scripts are simply text files. When a script is loaded it is compiled into an intermediate byte-code format and an associated script "obj" file is written. The scripting engine then executes the obj file. If the script is updated the engine will automatically re-compile a new obj file. You can distribute just obj files without the text files if you desire.
Scripts can run on both the server and client.
You can easily add new script functions and callable C functions. Script variables can be local to the scripting engine or directly modify associated C++ code or C++ class member variables.
This is just the tip of the ice berg. Scripts are the heart Tribes2, they run everything. They define your gui and it's behavior, control the mission/game logic, initiate netowrk connections, direct the AI, control your key bindings, etc, etc.