Python and Lua are very commonly used as scripting languages in games. Languages like lisp are commonly used for AI.
For weapons I'd do something like weapons.dat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#
# weapons.dat -- stores weapon data
#
# <weapon> <display> <damage> <rounds/clip>
pistol Pistol 5 15
shotgun Shotgun 20 1
arifle Assault_rifle 10 30
srifle Sniper_rifle 40 1
#
# <weapon> Weapon name
# <display> Display name
# <damage> Damage done at point blank range. To find damage done at a
# different range, divide by (abs(distance) + 1) and truncate
# <rounds/clip> Maximum number of rounds fired before reloading
#
That's what I did once when I wrote a game. I didn't design the code properly so I stopped making the game.
@Krofna,
I wouldn't say C++ was very suitable for scripting.
I don't think I explained exactly what I needed in the first post...I'd like a scripting language that will allow me to expose some classes/objects into the language and then run a script on them. It would also be nice if I could call C++ functions from it, but I could probably make do without that ability.
Lua is great for that, since it's easy to call C++ accessor functions from your classes so you can easily keep everything encapsulated and still adjust them.
Otherwise, I consider Ruby the king of all scripting languages. Python is okay, but it can be rather performance intensive at times.
As for Ruby & Python; in terms of performance, (C)Python used to be faster than Ruby (version 1.8) but apparently they're about the same now: http://www.wikivs.com/wiki/Python_vs_Ruby#Speed
As for Ruby & Python; in terms of performance, (C)Python used to be faster than Ruby (version 1.8) but apparently they're about the same now: http://www.wikivs.com/wiki/Python_vs_Ruby#Speed
Why was Perl not in it? It has a long history too :P
Perl, Python, Ruby all are really slow compared to statically typed languages. I use Scala for all scripting purposes - it is just as terse as Perl / Python / Ruby but has better collection libraries and runs much, much faster. I'd use Lua if I only needed a thin layer of scripting on top of C/C++. I would use Scala if I only needed a thin layer of C/C++ on the bottom.
I've been writing a Hybrid RTS/Tactics style RPG with some friends. We're using C# for the main engine and Iron Python for the game-logic and level generation algorithms, it works swimmingly.
I use "Python Tools For Visual Studio" w/ VS2010 : http://pytools.codeplex.com/
It's amazing.
If you don't have Visual Studio 2010 professional, you can use it with the "Visual Studio Shell": http://www.microsoft.com/download/en/details.aspx?id=115