Why use scripting in games?
hey everyone-
I'm making key decisions in the planning of my game right now, one of them is to continue spending time on planning the dynamics of my game into either a scripting engine or hard-coding.
Why use scripting in a game? Unless they would change often after the installation of the game (which they most likely will not), why would I need to spend endless hours debugging a whole new programming language?
I understand scripting would be good for mods and things like that, but I doubt my engine will be remotely good enough for someone to spend time modifying it. Maybe levels and things like that, but those will be external no matter what and not even "scripting".
Should I bother making a scripting engine?
Aside from storing cinematic and special effect scripting (just referencing to built in functions), is there anything else worth scripting?
Usually you don't have to make a scripting engine. You just embed a scripting language in your engine, and make some wrapper functions.
A scriptig is good if you want to allow your users to make mods. If you don't plan to do that, then it's not really usefull.
A scriptig is good if you want to allow your users to make mods. If you don't plan to do that, then it's not really usefull.
There's some games which don't really need scripting. Generally, if you need lots of one-off behaviors, that's an ideal scripting situation. For example, an adventure game where some particular switch causes a box to fall out of the sky if and only if the player has a rope.
Understand: a scripting language is for you, not for other people. It allows you to write levels and characters and other objects in a more natural representation than they would be in C++ or flat data files. (of course, if you're not the one that'll be designing the levels, replace "you" with "level designers"). If you feel that the game's operation is suitably simple and normalized that representing the game purely as data is possible, by all means forgo the scripting.
Understand: a scripting language is for you, not for other people. It allows you to write levels and characters and other objects in a more natural representation than they would be in C++ or flat data files. (of course, if you're not the one that'll be designing the levels, replace "you" with "level designers"). If you feel that the game's operation is suitably simple and normalized that representing the game purely as data is possible, by all means forgo the scripting.
Scripting is good for lots of things. What genre is your game? (RPG, Strategy, etc)
Assuming your game is an RPG, lets say you want the map to get fuzzy when the main character gets to point (5,10)
In code you might do something like this: (psuedo/C++)
That would be a lot of hard coding for special events. Scripts allow lots of information to be held externally, and you don't have to recompile everytime. I know you said besides special effects. That's where I'll go next.
Character interaction and NPC placement/control: Just like detection for special effects, when a character enters an area, things can happen. Mostly trigger-like events. But you can also have your system set up so you can create NPC objects in the script, to be maintained in the script.
Another reason is if you have a team to work with. You may have people who are very imaginative, and that you trust cuold put together a good enough timeline. They may not know how to code. Well, save yourself some effort and put them to work! :) Seriously, if you put together a high end script langauge, they can do it, and besides, since it doesn't need to be recompiled, they can test it without bugging the coders.
To Sum It Up:
Scripts are great because you can use them for whatever purpose you want. There is no "script language", just common guidlines. And even those can be passed. Scripts were made because they allow for creator-defined events to occur on cue. They are whatever you want them to be, just don't overcomplicate it.
I hope I helped. :)
Assuming your game is an RPG, lets say you want the map to get fuzzy when the main character gets to point (5,10)
In code you might do something like this: (psuedo/C++)
if ( (Main.x==5) && (Main.y==10) ){//stuff}
That would be a lot of hard coding for special events. Scripts allow lots of information to be held externally, and you don't have to recompile everytime. I know you said besides special effects. That's where I'll go next.
Character interaction and NPC placement/control: Just like detection for special effects, when a character enters an area, things can happen. Mostly trigger-like events. But you can also have your system set up so you can create NPC objects in the script, to be maintained in the script.
Another reason is if you have a team to work with. You may have people who are very imaginative, and that you trust cuold put together a good enough timeline. They may not know how to code. Well, save yourself some effort and put them to work! :) Seriously, if you put together a high end script langauge, they can do it, and besides, since it doesn't need to be recompiled, they can test it without bugging the coders.
To Sum It Up:
Scripts are great because you can use them for whatever purpose you want. There is no "script language", just common guidlines. And even those can be passed. Scripts were made because they allow for creator-defined events to occur on cue. They are whatever you want them to be, just don't overcomplicate it.
I hope I helped. :)
-----If you thought I was helpful, rate me down.If you thought I wasn't helpful, rate me down as well.This idiot didn't read my signature and tried to insult me.
im a little confused now...
you guys are all acting like scripting is useless unless you want other people to modify the game.
im working on a 2D RPG w / C++, and have a decent amount of the bare engine done. i can now make as many maps as i want, and the player can walk around the maps. so basically, i can make an entire world that the player can walk around in.
now i just need to add content. i was under the impression, that i should learn a scripting language like Python, and embed it into my game. IE, all game content should be coded in Python. NPC interaction, character dialogue, world interaction (IE going on missions and such), ETC.
since no one else will be working on the game but me, should i still go with a scripting language? or should i just use text files to store data and then parse the data with my C++ engine for thigns like character dialogue, world interaction, ETC, basically all the games content?
thanks for any help!!!
you guys are all acting like scripting is useless unless you want other people to modify the game.
im working on a 2D RPG w / C++, and have a decent amount of the bare engine done. i can now make as many maps as i want, and the player can walk around the maps. so basically, i can make an entire world that the player can walk around in.
now i just need to add content. i was under the impression, that i should learn a scripting language like Python, and embed it into my game. IE, all game content should be coded in Python. NPC interaction, character dialogue, world interaction (IE going on missions and such), ETC.
since no one else will be working on the game but me, should i still go with a scripting language? or should i just use text files to store data and then parse the data with my C++ engine for thigns like character dialogue, world interaction, ETC, basically all the games content?
thanks for any help!!!
FTA, my 2D futuristic action MMORPG
Scripting is useful because it allows you to make changes to parts of a game without having to recompile the entire game. If you want to change the way an enemy character behaves, you change the script and just restart the game. No need to recompile the code. That's the main advantage.
Anthony Rufrano
RealityFactory 2 Programmer
RealityFactory 2 Programmer
if the only advantages are no need to recompile and mod-ability, it seems like a waste of time for me.
for my engine.
Thanks for the input.
for my engine.
Thanks for the input.
How are we defining 'script'?
If a script is just a file or something that the main program reads and uses for the primary function of the program, I'd say scripting is crucial.
Everything either scripted or hard-coded...? Is that an over-simplified explanation?
If a script is just a file or something that the main program reads and uses for the primary function of the program, I'd say scripting is crucial.
Everything either scripted or hard-coded...? Is that an over-simplified explanation?
------------------------------NE1 HAV LABIS CAMON FRO TRD??
Quote: Original post by graveyard filla
im a little confused now...
you guys are all acting like scripting is useless unless you want other people to modify the game.
nope, scripting is usefull whenever you want to reduce hardcoding in a game or program so that you can change values and behaviours without having to rebuild everything and restart the program.
For example, you're working on a RPG, lets say you've got a wizard who you want to act a certain way with a character but then later decide you want him to act differently.
Now, without scripting you'd have to change the C++ code, change all the code around, recompile and restart.
With a script you'd change the script file and restart.
dont like it still? go back and fiddle abit.
If you get really clever you could infact have a small script editor built right into the game, allowing you to reprogram characters on the fly without even having to leave the game its self.
If you've got a console you could even allow yourself to use script code directly in it to modifiy parts of the game, say give yourself a big sword for testing reasons.
Frankly, the posibilties are endless when you start thinking about it [smile]
Quote: Original post by wannabean333
if the only advantages are no need to recompile and mod-ability, it seems like a waste of time for me.
for my engine.
It all depends on the size and scope of what you plan on doing.
Once you get alot of code involving templates and other things and you find yourself sitting through huge build times just to change one little thing you'll wish you had gone with scripting just to make your life easier.
With scripting you've everything to gain and nowt to lose, you gain flexibilty at the expense of a small amount of CPU time and your time is more valuable than that any day [smile]
Scrpting is great, see above for a couple of reasons why, and if you plan on a project of a reasonable size you'll be better of with it than without it imo [smile]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement