Advertisement

Scripting

Started by April 06, 2003 04:56 AM
28 comments, last by The Keymaster 21 years, 7 months ago
Just for fun, I''ve been looking into some virtual machine/scripting engine articles. It''s all pretty interesting, but it suddenly dawned on me... Why use scripting at all? Why program things in an unwieldy scripting language rather than in a language you know and have a great IDE for? I mean.. If I want to trigger a thousand enemies to charge towards the player when he enters a certain room, why don''t I just hard code that? Why bother with scripting at all?
1.) for the artists and designers who don''t know the programming language.

2.) to make changes and tweaks that do not require any compiling.

The Tyr project is here.
The Tyr project is here.
Advertisement
like Octdev sed it''s for developers who don''t knwo the programming language, it also makes things like maps(that may contain/be linked to scripts) more portable as the game it self may have had to be ported to another language/system, even though this is the case the scripting language it self won''t be changed.

this also makes things easier for modders etc...

u gotta remember that it''s a lot better to have as little hardcoded things like as possible, technically u shouldn''t have any, just the game and it''s engine itself to manage things liek events etc...

Chris
The artists and designers shouldn''t be messing with programming at all. That includes scripting. Also, who cares about compiling a few extra times, rather than going through the hassle of creating and implementing a scripting engine, and learning its syntax?
quote: Original post by poisonfruitloops
like Octdev sed it''s for developers who don''t knwo the programming language, it also makes things like maps(that may contain/be linked to scripts) more portable as the game it self may have had to be ported to another language/system, even though this is the case the scripting language it self won''t be changed.

this also makes things easier for modders etc...



If developers don''t know the programming language, should they really be developers? I can see the portability advantage... but the modding aspect would be irrelevant in, say, an adventure game.


quote: Original post by poisonfruitloops
u gotta remember that it''s a lot better to have as little hardcoded things like as possible, technically u shouldn''t have any, just the game and it''s engine itself to manage things liek events etc...


Why? The scripts would have to be compiled to bytecode anyway, if I''d want them to be fast. So they would be hardcoded as well. So what''s the difference in compiling c++ code and compiling custom script code?
A scripting language is one more level of abstraction above the game code. Sure, you can hard code in all those events and everything, but if you make a mistake, you''ve introduced a bug into game code. If you write a scripting language, the engine itself can have robust error checking, essentially making it impossible to crash the game or introduce unpredictable behavior. And the compiling issue is another thing. Why recompile every time you have a new level done.


Gamedev for learning.
libGDN for putting it all together.
An opensource, cross platform, cross API game development library.
VSEDebug Visual Studio.NET Add-In. Enhances debugging in ways never thought possible.
Advertisement
Quote:

If developers don't know the programming language, should they really be developers? I can see the portability advantage... but the modding aspect would be irrelevant in, say, an adventure game.


true, i meant more along the lines of artists/designers etc..

i was basically trying to say what CpMan sed of course it's slower, but i guess i'd prefer to sacrifice some speed for robustness..

anyways thats just my opinon



[edited by - poisonfruitloops on April 6, 2003 6:54:36 AM]
We use script languages becaue programmers shouldnt be needed to write game *content* (dialogue scripts, triggers, weapons, monsters etc), thats the job of level designers etc.
With scripting you create your game, and then the content designers do the "rest".

As to your question regarding scripts also needing to be pre-compiled:
It shouldnt really be needed, because scripts only do very high level stuff(ie simple checks/comparisons and call native functions all other stuff), so it doesnt matter if they run slow or not. And anyway, compiling a script will be independent of recompiling the whole game code base.
quote: Original post by CpMan
A scripting language is one more level of abstraction above the game code. Sure, you can hard code in all those events and everything, but if you make a mistake, you've introduced a bug into game code. If you write a scripting language, the engine itself can have robust error checking, essentially making it impossible to crash the game or introduce unpredictable behavior. And the compiling issue is another thing. Why recompile every time you have a new level done.


Hmm.. I can see the abstraction advantage, but not the bug-issue. You say that you can make it impossible to introduce unpredictable behavior. However... When I make a mistake in a script, I can either ignore the script or produce an error message. If I choose the first, the game does not do what it is supposed to do (spawn more enemies, etc). If I choose the latter, I get a nice error message. Both seem as bad to me as a bug in game code. Yet with a bug in game code, I can use all sorts of debugging tools such as watches and breakpoints to figure out what's wrong.

Also, the compiling issue... You'd have to compile the scripts to bytecode as well. What's the difference between compiling a .cpp file (you don't need to recompile the -entire- game, after all) and compiling a script file?

I see some advantages in scripting, but most just seem to be too much hassle for too little extra advantage.

[edited by - The Keymaster on April 6, 2003 7:15:12 AM]
actually u have a good point keymaster, i''m currently werkin on a script engine for a uni project, i''ll be keen to see how bugs in the script affects the actual game itself.

chances are i''ll post here for help


chris

This topic is closed to new replies.

Advertisement