How to Impliment Scripting Engine...
Hiya! I''ve got a quick question about the design of a scripting engine. I''ve got a simple OO RPG, with classes such as rpgMap, rpgTile, etc. I''ve got an rpgGame class that controls the game. Now my question is now to impliment my scripting engine. I''d like to have basic commands, such as IF, FOR..., and GOTO located in a .lib or .dll file I can use for all projects (Mind, I''ve already coded the scripting engine, I just need design suggestions) How do I go about doing this? Is my OO approach all wrong? Thanks for your time!
John ''Hannibal'' Smith
You have two choices.
1. Do it the hard way. Start reading up on Flex and Bison. Creating a scripting language from scratch takes a long time and a lot of effort. However, creating your own scripting language does have advantages. The main advantage is flexibility. You are designing the language so you can put in or leave out any commands you like.
2. Use an existing language. There are lots of existing scripting languages available on the net that you can build into your engine. Whilst this is simpler initially you may have problems if you later discover the language you have chosen does not support some feature you really need.
Alan
1. Do it the hard way. Start reading up on Flex and Bison. Creating a scripting language from scratch takes a long time and a lot of effort. However, creating your own scripting language does have advantages. The main advantage is flexibility. You are designing the language so you can put in or leave out any commands you like.
2. Use an existing language. There are lots of existing scripting languages available on the net that you can build into your engine. Whilst this is simpler initially you may have problems if you later discover the language you have chosen does not support some feature you really need.
Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
Thanks for the reply. I''ve already constructed a simple scripting language, with commands such as MoveCharacter, LoadMap, etc. What I wanted to know is the best procedure for creating my own, re-usable, scripting library for future RPGs. Thanks for the help!
I recently wrote a very nice scripting engine that works a lot like the C language. You can use it in your game if you like.. you don't even have to give me credit (but it would be a nice gesture). However, even if you would rather use yours, mine is built to be re-used in any type of application (whether it's an rpg or a business application), which is what I believe you are after. Anyway.. I hope it helps in either case.
Here's the URL for the full source code:
http://www.willcomp.com/majick/xscript-src-1.2a-beta.zip
-or-
http://www.crosswinds.net/~iperez/xscript-src-1.2a-beta.zip (try this one at least 3 times.. never works on the first try for me)
-or-
http://isynergy.webjump.com/files/xscript-src-1.2a-beta.zip
Yes.. it is a beta, but only because it's not very well documented (it comes with a small tutorial) and it doesn't have all of the features that I had planned. It is still a fully functional scripting engine and I currently use it in many of my apps/games and have found nothing wrong with it (yet).
Feel free to e-mail me about xscript, or you can contact me via ICQ (my UIN is 6343833).
- Ian Perez (fett@willcomp.com) - "It is by will alone I set my mind in motion"
Edited by - [bobafet] on May 2, 2001 5:51:09 AM
Here's the URL for the full source code:
http://www.willcomp.com/majick/xscript-src-1.2a-beta.zip
-or-
http://www.crosswinds.net/~iperez/xscript-src-1.2a-beta.zip (try this one at least 3 times.. never works on the first try for me)
-or-
http://isynergy.webjump.com/files/xscript-src-1.2a-beta.zip
Yes.. it is a beta, but only because it's not very well documented (it comes with a small tutorial) and it doesn't have all of the features that I had planned. It is still a fully functional scripting engine and I currently use it in many of my apps/games and have found nothing wrong with it (yet).
Feel free to e-mail me about xscript, or you can contact me via ICQ (my UIN is 6343833).
- Ian Perez (fett@willcomp.com) - "It is by will alone I set my mind in motion"
Edited by - [bobafet] on May 2, 2001 5:51:09 AM
- Ian Perez (iperez.fett@verizon.net) - "It is by will alone I set my mind in motion"
Thanks for the helpful link! I''ll take a look at this clever scritping engine today! Any more suggestions are also more than welcome! Thanks again!
www.flipcode.com has a completed course on implementing a scripting engine...
Good luck, hope to see your engine opensourced soon!
What the hells!
Good luck, hope to see your engine opensourced soon!
What the hells!
What the hells!
you might consider adding external resources to the script capabilities..for instance, if you have seperate files for character data/graphics, sounds, models, etc., you should be able to specify them in the script and use them in later commands..
here''s a bad example..you could have a SOUNDS section at the top of the script that specifies wav files like this:
SOUND DeathSound = "playerdies.wav"
later on you could:
PLAYSOUND DeathSound
one of the biggest advantages I found with writing my own script compiler was the ability to add extra sounds, characters, models, animations, etc. right in the script..I used my script mostly for character AI, but it was invaluable for getting new content into the game..
"Like all good things, it starts with a monkey.."
here''s a bad example..you could have a SOUNDS section at the top of the script that specifies wav files like this:
SOUND DeathSound = "playerdies.wav"
later on you could:
PLAYSOUND DeathSound
one of the biggest advantages I found with writing my own script compiler was the ability to add extra sounds, characters, models, animations, etc. right in the script..I used my script mostly for character AI, but it was invaluable for getting new content into the game..
"Like all good things, it starts with a monkey.."
"Like all good things, it starts with a monkey.."
Hmm, I still never understood what the point of making a C-style scripting language is... You could just make normal functions to use like script commands, and use your C/C++ compiler instead of writing your own, since it would most likely run faster, and have a lot more features. And for events, just make a .dll for each map file with all of that map''s event functions in it, so you don''t have every event for the entire game in memory all the time.
-Deku-chan
DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)
-Deku-chan
DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)
deku: if you have a simplified scripting language (as opposed to straight C and your compuler), there are many benefits:
1) You can make modifications when you''re away from your PC
2) You can make changes without recompiling
3) Your artists, your designers, your musicians can all make their own changes, because it''s easier for them to read this simple script than to code in C (and then they don''t need a compiler installed)
Number 3 is probably THE most important issue, because then it stops the "non-tech" people from hassling you. Even if you just make an ini file kind of thing that reads in variables at runtime it will save you HEAPS of time.
"Can you make the rockets a bit faster?"
"Can you make the light a bit brighter?"
"Can you make the grenades bounce higher?"
"Can you give the player more health?"
petty things which consume time, when you could be working on more important things, your engine, the AI, etc etc etc.
1) You can make modifications when you''re away from your PC
2) You can make changes without recompiling
3) Your artists, your designers, your musicians can all make their own changes, because it''s easier for them to read this simple script than to code in C (and then they don''t need a compiler installed)
Number 3 is probably THE most important issue, because then it stops the "non-tech" people from hassling you. Even if you just make an ini file kind of thing that reads in variables at runtime it will save you HEAPS of time.
"Can you make the rockets a bit faster?"
"Can you make the light a bit brighter?"
"Can you make the grenades bounce higher?"
"Can you give the player more health?"
petty things which consume time, when you could be working on more important things, your engine, the AI, etc etc etc.
freshya''s number 3 reason is the most important. You, the programmer, is not going to be using the scripting engine. Thats not your job. That''s the job of the AI guys, the mission designers, the beta testers, etc. It''s very likely they don''t know C language and syntax. However, a simple, plain english scripting mabober makes it easier. Also, scripts can be changed on the fly to test their effects, and all the extra C mumbo jumbo you don''t need can be excluded.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement