Scripting

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
deathsangel
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 30
Joined: Sat Apr 18, 2009 8:17 pm

Scripting

Post by deathsangel »

Hey guys, I have 3 quick questions about scripting.

1) why would you use scripting(lua, perl, ruby, etc...) instead of pure c++ inside of your game.

2) which scripting language should I chose, is there a difference in them?

3) how do you implement a scripting language
Thanks to gyro vorbis for inspiring me to learn how to make a 2d graphics engine :)
User avatar
wtetzner
Chaos Rift Regular
Chaos Rift Regular
Posts: 159
Joined: Wed Feb 18, 2009 6:43 pm
Current Project: waterbear, GBA game + editor
Favorite Gaming Platforms: Game Boy Advance
Programming Language of Choice: OCaml
Location: TX
Contact:

Re: Scripting

Post by wtetzner »

deathsangel wrote:1) why would you use scripting(lua, perl, ruby, etc...) instead of pure c++ inside of your game.
One reason is to separate game logic from the engine.
Another is that scripting languages tend to be more expressive, meaning you can implement a concept in less code. They make development faster. So for anything that doesn't need to be especially optimized for performance, scripting languages make development more efficient.
deathsangel wrote:2) which scripting language should I chose, is there a difference in them?
There are differences between them, and I don't know which one you should choose. Lua is typically used for games, because it is designed to be embedded in other programs. Another choice for a language that's designed to be embedded is JavaScript.
deathsangel wrote:3) how do you implement a scripting language
It's different for each language. Basically, there's a library for the language interpreter, and there are methods that allow you to bind functions/objects in the scripting languages to functions/objects in the host application (the game).
The novice realizes that the difference between code and data is trivial. The expert realizes that all code is data. And the true master realizes that all data is code.
deathsangel
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 30
Joined: Sat Apr 18, 2009 8:17 pm

Re: Scripting

Post by deathsangel »

So your saying I should chose lua?
Thanks to gyro vorbis for inspiring me to learn how to make a 2d graphics engine :)
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: Scripting

Post by MadPumpkin »

deathsangel wrote:So your saying I should chose lua?
yes, thats what he's saying.
personally ( everybody ) i like lua and python you should probably use lua its nice and easy
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Scripting

Post by Falco Girgis »

Nobody is saying you should use Lua. You should first decide what you want to use a scripting language for (and based on the fact that you're asking "why," I don't think that you really have a reason to use a scripting language).

There is a specific time and place for that kind of extensibility. If it isn't necessary, you're going to spend more time integrating the scripting language than if you had tackled the problem with just C or C++.

1) Identify the problem 2) Go research scripting languages. There is no "best" language. Some are better than others in particular scenarios. Perl is amazing at text-based manipulation, but it's slow as shit. Python is a great multipurpose language, but it's overkill for simple tasks. Ruby is getting really popular these days, and it's pretty much the object oriented scripting language of choice, but it's also slow and expensive as hell. Lua is fast and lightweight, but feature-wise it's a pussy compared to lots of other languages.
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: Scripting

Post by M_D_K »

GyroVorbis wrote:Lua is fast and lightweight, but feature-wise it's a pussy compared to lots of other languages.
True. At least until you pimp it out with access to the engine/app.
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Scripting

Post by Ginto8 »

OMG MDK HAZ RANK EVIL :lol:
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Scripting

Post by MarauderIIC »

Finally! Eatcomics was the only other one to hit it, but he posted past it and didn't notice.

Click here to see the hidden message (It might contain spoilers)
temp.jpg
temp.jpg (18.37 KiB) Viewed 913 times
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Ewan
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 62
Joined: Mon Mar 23, 2009 11:46 am

Re: Scripting

Post by Ewan »

MarauderIIC wrote:Finally! Eatcomics was the only other one to hit it, but he posted past it and didn't notice.

Click here to see the hidden message (It might contain spoilers)
temp.jpg
:shock: Does it change back when he makes one more post?
They pull out the truncheon, that's when the trouble starts.

'Cause when you've got a badge, the laws don't apply.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Scripting

Post by MarauderIIC »

Yes. Back to talking about scripting, everybody! On task!
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Scripting

Post by dandymcgee »

MarauderIIC wrote:Finally! Eatcomics was the only other one to hit it, but he posted past it and didn't notice.
:lol: Marauder, you are the man.

EDIT:
MarauderIIC wrote:Yes. Back to talking about scripting, everybody! On task!
What he said.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: Scripting

Post by eatcomics »

Ewan wrote:
MarauderIIC wrote:Finally! Eatcomics was the only other one to hit it, but he posted past it and didn't notice.

Click here to see the hidden message (It might contain spoilers)
temp.jpg
:shock: Does it change back when he makes one more post?
Lusikka got it didn't she???
Then back to scripting :lol:
Image
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Scripting

Post by MarauderIIC »

Click here to see the hidden message (It might contain spoilers)
I think Lusikka has/had a special rank, so it didn't show. I might have done it after she passed it, too.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Post Reply