Good scripting language for C++?

In short, I'm trying to find a scripting language that will allow me to write an AI script or a weapon script for a game I'm making.

Anyone have any good suggestions? I'd rather it be C++ based instead of C if possible (if they have a C++ wrapper that's probably fine).
closed account (S6k9GNh0)
I've been suggested Lua on just about everything when it comes to scripting. That and XML (bleh).
Last edited on
closed account (10oTURfi)
Why not use C++ for scripting? I like the way how Scriptdev2 used C++ for World of Warcraft AI. (as opposed to ArcEmu LUA WoW AI)
Last edited on
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.
Last edited on
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.

Also, might I ask what this is for?
Last edited on
Wow, Lua sounds good, I should learn it.

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
Hmm, I guess I was wrong there. Anyhow syntax and OOP are better in Ruby :)
I don't know Ruby so I wouldn't know.
Last edited on
Wow, Lua sounds good, I should learn it.

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.
Last edited on
closed account (1yR4jE8b)
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.
That sounds great.

IronPython is awesome, by the way, much better than standard Python. I <3 .Net/Mono.

[edit]
Do you use an IDE for Python? If so, which one? I've been using Spyder but I don't really like it.
Last edited on
closed account (1yR4jE8b)
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
Last edited on
Thanks. I'll look into it.
Topic archived. No new replies allowed.