Scripting
Moderator: Coders of Rage
-
- Chaos Rift Newbie
- Posts: 30
- Joined: Sat Apr 18, 2009 8:17 pm
Scripting
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
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
- wtetzner
- 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
One reason is to separate game logic from the engine.deathsangel wrote:1) why would you use scripting(lua, perl, ruby, etc...) instead of pure c++ inside of your game.
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.
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:2) which scripting language should I chose, is there a difference in them?
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).deathsangel wrote:3) how do you implement a scripting language
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.
-
- Chaos Rift Newbie
- Posts: 30
- Joined: Sat Apr 18, 2009 8:17 pm
Re: Scripting
So your saying I should chose lua?
Thanks to gyro vorbis for inspiring me to learn how to make a 2d graphics engine
- MadPumpkin
- 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
yes, thats what he's saying.deathsangel wrote:So your saying I should chose lua?
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
For God so loved the world that he blessed the thugs with rock
- Falco Girgis
- 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
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.
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.
- M_D_K
- 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
True. At least until you pimp it out with access to the engine/app.GyroVorbis wrote:Lua is fast and lightweight, but feature-wise it's a pussy compared to lots of other languages.
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.
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Scripting
OMG MDK HAZ RANK EVIL
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.
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Scripting
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)
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Re: Scripting
Does it change back when he makes one more post?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)
They pull out the truncheon, that's when the trouble starts.
'Cause when you've got a badge, the laws don't apply.
'Cause when you've got a badge, the laws don't apply.
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Scripting
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.
- dandymcgee
- 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
Marauder, you are the man.MarauderIIC wrote:Finally! Eatcomics was the only other one to hit it, but he posted past it and didn't notice.
EDIT:
What he said.MarauderIIC wrote:Yes. Back to talking about scripting, everybody! On task!
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Re: Scripting
Lusikka got it didn't she???Ewan wrote:Does it change back when he makes one more post?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)
Then back to scripting
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: Scripting
Click here to see the hidden message (It might contain spoilers)
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.