scripting engine ? explanation plz.
i am creating a simple iso rpg which i want to have a simple turn-based combat engine. Now i have NO knowledge of scripting engines but people have thrown that at me a lot, i was wondering:
can someone please explain scripting engines (state machines + simple scripting) and how this might apply to me and if it is the only or easiest way to do what i want/need to do.
thank you
does tasntaafls'' book cover artwork at all? (creation)
I don''t know if it will work as well as I hope, but this is how I am doing it so far...
Firstly, developer-specific notes. I work in Windows, using Visual Basic 6.0, Enterprise Edition. In () brackets, I have placed notes for C/++ developers. In [] brackets, I have placed general notes.
A scripting engine is a system which manages and executes code which is not hard-coded into the program executable or it''s dependant library [DLL] files.
State machines is not, per se, scripting. A state machine is controlled by a single variable, an index to the current "state". Depending on the value of this variable, your program will run different chunks of code at a specific time. For instance, in AI applications, you might have state 0 be "Look for Food". If it finds food, then it changes to state 5, "Take Item Home". And it would be state 5 because you might have "Look for Enemy" as State 2 [For organizational purposes].
On program init, I initialize a class called the ScriptManager. This class manages code, executes code, and all other such things. It has a self-contained system of variables, which I make work with a Collection that holds VarObj classes. Each VarObj class has a String (char) NAME and a Single (float) VALUE property. (As far as I understand C++, A Collection class would be a class that manages pointers to objects)
And by the way, I use a half-dynamic string table for non-numeric variables.
In the ScriptManager, I load each script file that I want to run into a class called a ScriptCode. I load them into this class, and set a few basic variables based on the contents.
I organize my scripts into "Triggers" and "Procedures". A "trigger" is a chunk of code in the script which is called when a condition is met. For instance, when the player pushes ANY switch in the level, every ScriptCode is checked to see if it has any ToggleSwitch triggers in it. In every ScriptCode where it finds one, it will then check if that trigger''s index, or other identifier, matches the index of the switch which was toggled. If that is so, then it will finally execute the code in that Trigger.
A Procedure is called when an actual event occurs. You may not understand the difference that easily, but you might. On level load [Script load, in this case], all ScriptCode classes with a "OnInit" procedure is run. Procedures can also be called by Triggers.
I might have gone a little too far in-depth, but I''d rather be comprehensive than continuously pestered.
I hope this helps!
Firstly, developer-specific notes. I work in Windows, using Visual Basic 6.0, Enterprise Edition. In () brackets, I have placed notes for C/++ developers. In [] brackets, I have placed general notes.
A scripting engine is a system which manages and executes code which is not hard-coded into the program executable or it''s dependant library [DLL] files.
State machines is not, per se, scripting. A state machine is controlled by a single variable, an index to the current "state". Depending on the value of this variable, your program will run different chunks of code at a specific time. For instance, in AI applications, you might have state 0 be "Look for Food". If it finds food, then it changes to state 5, "Take Item Home". And it would be state 5 because you might have "Look for Enemy" as State 2 [For organizational purposes].
On program init, I initialize a class called the ScriptManager. This class manages code, executes code, and all other such things. It has a self-contained system of variables, which I make work with a Collection that holds VarObj classes. Each VarObj class has a String (char) NAME and a Single (float) VALUE property. (As far as I understand C++, A Collection class would be a class that manages pointers to objects)
And by the way, I use a half-dynamic string table for non-numeric variables.
In the ScriptManager, I load each script file that I want to run into a class called a ScriptCode. I load them into this class, and set a few basic variables based on the contents.
I organize my scripts into "Triggers" and "Procedures". A "trigger" is a chunk of code in the script which is called when a condition is met. For instance, when the player pushes ANY switch in the level, every ScriptCode is checked to see if it has any ToggleSwitch triggers in it. In every ScriptCode where it finds one, it will then check if that trigger''s index, or other identifier, matches the index of the switch which was toggled. If that is so, then it will finally execute the code in that Trigger.
A Procedure is called when an actual event occurs. You may not understand the difference that easily, but you might. On level load [Script load, in this case], all ScriptCode classes with a "OnInit" procedure is run. Procedures can also be called by Triggers.
I might have gone a little too far in-depth, but I''d rather be comprehensive than continuously pestered.
I hope this helps!
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement