Skip to main content
GameDev.net gamedev.net
🔒 Locked

Which scripting language?

Started by Tera_Dragon Feb 17, 2005 at 4:02 PM 16 replies 2.5k views
Original Post
Tera_Dragon
Tera_Dragon
I'm working on the gui for my game and thought of using a scripting language for events such as buttons being clicked. First off, is this the best way to go about this? If not, what is? If it is a good way to go about it what scripting language should I use? I'm using C++ and therefore my gui just uses classes. I've looked into Small but it is not meant to be easy to use with class methods. Please tell me what you think, and any other helpful info will be gladly accepted!
____________________________________________________________Programmers Resource Central
C-Junkie
C-Junkie
I discovered yesterday that WoW uses Lua.
Fruny
Fruny
I've read on Slashdot that both Civilization 4 and Battlefield 2 will use Python.

-- Fruny [defending Python's honor]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Pipo DeClown
Pipo DeClown
I've never used a scripting language with C++ before, but I can tell you that Python is a great language. I've used it in plug-in development and WOW it's clean and easy!

Although, WoW (World of Warcraft) uses Lua.. Maybe you should use Lua! [grin]
*drools*..
Drew_Benton
Drew_Benton
You should take a look at AngelScript developed by WitchLord. I think it is pretty intresting. I have not done anything more than the basic demo with it, but it is alwasy an option. I need to take a look into Lua and Python myself for our game. Best thing about AS is that the developer is right here on GameDev [grin].

- Drew
Sneftel
Sneftel
Quote:
Original post by Fruny
I've read on Slashdot that both Civilization 4 and Battlefield 2 will use Python.
I heard that Lua saves orphaned children from cancer, whereas Python kills puppies. That's, y'know, just what I've heard.
Qw3r7yU10p!
Qw3r7yU10p!
Python
Quote:
Original post by Sneftel
Quote:
Original post by Fruny
I've read on Slashdot that both Civilization 4 and Battlefield 2 will use Python.
I heard that Lua saves orphaned children from cancer, whereas Python kills puppies. That's, y'know, just what I've heard.


I guess you heard that on Slashdot.
anonuser
anonuser
I'm going for Lua;
Wow uses loa. And Never Winter Nights uses Lua. Its really powerful and easily implimented form what i've heard.
Tera_Dragon
Tera_Dragon
I think I might use lua. It looks a bit easier to use than python from what I have been able to find so far...
Having a bit of trouble building the .exe and .lib files for tolua though. I'm getting a lot of unresolved externals which all seem to be lua functions, even though I have lua 5.0.2 (latest I think) linked.
Any ideas? Do I even need tolua?
____________________________________________________________Programmers Resource Central
evolutional
evolutional
I'd go for the one you like most/works best out of trying them all
Toolmaker
Toolmaker
I hated Lua, as the API was a bitch. Using it for things such as calling functions, pushing/popping vars, etc. wasn't really what I would call fun.

Another thing, I had problems calling member functions from classes. Perhaps it's just because I suck.

Toolmaker
 
Tera_Dragon
Tera_Dragon
I will probably wanting it to mainly call member functions. Is lua then not the best scripting language for the job?
____________________________________________________________Programmers Resource Central
evolutional
evolutional
I think the choice of a scripting language is entirely dependant on your game and how you feel about the particular language. Many people love and adore Lua, but I despise it's API. Perhaps it's a great language but I gave it up after having to root through the stack to do the simplest of things. I know there's things like ToLua/LuaBind, but you should be able to use the native API comfortably too.

I wasn't being glib with my previous post; you'll ask which language to use and you'll get 50 different answers. The best way I found was to pick up a few and test them out, then use the one that suits you better.

Oh and I heard Squirrel/AngelScript was good for member binding. I use GameMonkey script which is also pretty decent.
Evil Steve
Evil Steve
Quote:
Original post by evolutional
Many people love and adore Lua, but I despise it's API. Perhaps it's a great language but I gave it up after having to root through the stack to do the simplest of things.
Here here. I tried making my own scripting language, and it worked nicely for really simple stuff, and was very OOP.
However, I'm not good enough at the low level stuff, and I got bored trying to implement things like arithmetic operators and operator ordering.
bit64
bit64
Lua can call member functions easily, you just have to remember that all functions that are exported to Lua need to be static.
This isn't to say that the member functions need to be declared static, just that the exported interfaces do.

class genericClass(){    . . .   static genericClass * m_pThis;   void DoThisWonderousThing(); //member function   static void DoThisWonderousThing(); //interface for lua}


and in your static method you would just do:

//this is the method that we register with luavoid genericClass::DoThisWonderousThing(){   if(m_pThis)       m_pThis->DoThisWonderousThing(); }


and from Lua you just call it like this:

DoThisWonderousThing()

There are perhaps better ways of doing this, but it works and I use it this way. Someday I will figure out how to post source code on the forums :(




Edited by evolutional - Source tags :)

[Edited by - bit64 on February 17, 2005 7:18:11 PM]
Don't be afraid to be yourself. Nobody else ever will be.
evolutional
evolutional
Quote:
Original post by bit64
Someday I will figure out how to post source code on the forums :(


GDNet Forums FAQ
bit64
bit64
Thanks!
Don't be afraid to be yourself. Nobody else ever will be.
Nairou
Nairou
I'm going with Squirrel. Pretty simple to use, C-like style, and very OOP-ish if you want to use it that way (I do).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.