• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

Scripting and 'hard-coding' in games/applications - pros/cons.

Chieftess

Moderator
Retired Moderator
Joined
Feb 10, 2002
Messages
24,160
Location
Baltimore
Ok, time for a nice programming discussions amongst us programmers. ;) (and gamers, or course)

Ever seen a game (or game development kits) with and without scripting? Here's a few right off the bat:

Allegro Game Development Kit (and many others) - These tend to be RPGs, with 99% of the code in scripted files.

Civ4 - It's known that this will include scripting (Python).

AoE II - This has basic AI scripting.


So, here's what I think the pros and cons are: (You'll notice that some can be both)

Pros:
1 - Customisability. With scripts, a player can develop scenarios, and enhance their game. It's possible to even create an entirely new game.

2 - Open Source. Players and developers can easily share their code out in the public domain.

3 - The game is forced to act as an engine, leaving very little features hard-coded.

4 - Minimal compilier time. The only thing that's compilied is the game engine itself.

5 - Can be as limited, or as extensive as the programmer wants. If the game is meant to be a game engine, it can allow a 3rd party programmer to create whatever they want within the capabilities of the engine.

Cons:

1 - Customisability. Suppose you're making a Role Playing Game. Why would you want 99% of your code visible to the user? Sometimes, scripting is too much information. The user could easily see some spoiler, or find all the secrets in the game, or even add a few lines to give them the best stats.

2 - Interpretor. Scripts are interpreted, which take longer than compiled code.

3 - Circular. One thing I'll probably never understand is why in the world you would use a compilier to create the game engine, only to use a 'compilier' again to actually code the game for the game engine. Seems like double-work to me, and is begging for Murphy's Law (see the above two points) to strike.

4 - Sloppy. It's just plain sloppy with all these scripting files running around. Besides, some old school programmers probably wouldn't like the whole world looking at their code (which is why they wouldn't use scripts in the first place).

5 - Security concerns. If your script allows for reading/writing of files, then it's possible to download a rouge script someone has made that could ruin your computer. Think VBScript and MS Outlook.

6 - Can be limited. Depending on the script (whether it uses Python, or an internal script), you could be limited to the features you can use. Although a good game might use addons (DLL files for graphics routines, etc.).

Personally, I don't like full blown scripts that much (then again, I'm kind of old-school). The fact that it isn't compiled means it's not going to be as fast, which nowadays isn't much of a concern. But, it really depends on the type of game it is. For games with scenarios, it's a great tool. For a RPG type game, then I wouldn't go for it, since it's eluding the purpose of the executable itself. Might as well compile that code anyway. :)
 
Admittedly I hate leaving stuff out there from a programmers perspective, but I love playing a game knowing I can tweak it to high heaven once it's pissed me off.
 
Limited customizing is okay, but the control should be in the hands of the developer. The open-ended model is why I love Opera over Firefox - all the features are already in there.
 
I think it depends on the game. Some games are begging for scripting, some are begging for it to be completely locked and shut. E.g. Civ, with such a heavy dependence on rules, and such a wide range of opinion on how those rules are best implemented in "real world" simulations, really needs scripting, whereas games like (as you say) RPGs might only need scripting for User Interface tweaks, rather than any changes in the core game mechanics.
 
Scripting works wonderfully for some RPGs... the infinity engine line comes to mind (Baldur's Gate 1 and 2 and Planescape: Torment, IWD wasn't great). Some of the fan made mods and total conversions for it are amazing as well.

And certain types of scripts (the lengthy ones which could tend to slow stuff down) actually do have to be compiled for use in the infinity engine.
 
Back
Top Bottom