🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

New to scripting. What is the idea?

Started by
3 comments, last by Guimo 19 years, 12 months ago
Ok, I'm fairly new to the idea of scripting, but from what I've gathered, scripting is like a file format. It just stores values that you can read in (such as character stats), which you use to build areas of a game, usually one's where the same idea is repeated over and over again. An example is FPS guns. You would store the damage, ammo, reload time, reload animation, gun model etc. all in the script yeah? If that is the case, then I've been doing scripting for ages, just I've been storing the data in code (data statements, I use a darkbasic mostly). The thing that I want to clear up is, for example with the FPS weapons, if I wanted to have a special event, like the gun overheating, or having a certain particle effect applied to it, would that in any way be able to be put into the script? It seems to me that that would entail a lot of hard work and additions to the script, and would be pretty pointless as you would be coding the script around the idea of overheating weapons. If you wanted to add something else completely you'd have to add to the script again. Or is the general idea to hard code the special events like this, and just provide basic attributes in the script, and maybe a slot for activating one of these special events (which would use some of the basic values as well). Basically, I would like to know what the general idea is behind scripting, and how far you would usually take the scripting language before you started adding hard coded stuff. Thanks.
Joseph Thomson - CLS Productions
Advertisement
Quote: Original post by hpesoj
Ok, I'm fairly new to the idea of scripting, but from what I've gathered, scripting is like a file format. It just stores values that you can read in (such as character stats), which you use to build areas of a game, usually one's where the same idea is repeated over and over again. An example is FPS guns. You would store the damage, ammo, reload time, reload animation, gun model etc. all in the script yeah? .

I'd say that's scripting in it's most basic form. More advanced forms of scripting involve control structures (if..else, do..while, for, etc..) and calls to hardcoded functions in the "engine"
-LuctusIn the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move - Douglas Adams
Functions eh? How would that happen? I guess just a conditional statement that checks for all the allowed scripting functions and calls the parallel hardcoded functions?
Joseph Thomson - CLS Productions
Modern scripting engines are full-fledged languages - the only difference is that they don't compile into bytecode engine code. Usually they're just used because they're faster to compile and far more portable then C++ code, as well as being more readable and specialised for the application at hand.

The ultimate example was Unreal Tournament, where the engine defined just the core libraries, and the game itself was implemented in a Java-like scripting language object inheritence tree.

The compromise occurs where you use engines for mapping - in that case, objects themselves aren't defined in script, strictly procedural stuff - event handlers for map events, and constructor calls to all the level objects. If the constructers are versitile enough, this could include supplying "function pointer" custom event handlers (coded in script) to the game objects.
-- Single player is masturbation.
Hi,

An script is just a sequence of commands. The way you want to use it is your own problem.

I like to use it for resource loading. When I need to change resources from one map to other, I flush the resources and load the new script, easy. I like to call them Resource Scripts.

Today, it is really common for games to use the engine and use scripted sequences to show the game plot instead of using a video. Its not that hard to do, if you have an entity and that entity can perform some actions (move_to, run_to, attack, etc etc) then its really easy to load an action script into a task manager so it can pump the actions in sequence.

There are other was to use scripts... to code actions and reactions, to program IA... you can use scripts as you wish.

Luck!
Guimo

This topic is closed to new replies.

Advertisement