Lua: where the heck do I begin? D:

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

User avatar
Moosader
Game Developer
Game Developer
Posts: 1081
Joined: Wed May 07, 2008 12:29 am
Current Project: Find out at: http://www.youtube.com/coderrach
Favorite Gaming Platforms: PC, NES, SNES, PS2, PS1, DS, PSP, X360, WII
Programming Language of Choice: C++
Location: Kansas City
Contact:

Lua: where the heck do I begin? D:

Post by Moosader »

I have a school project this semester with a group, and pretty soon I need to implement scripting into the game.
Except I don't know where to even begin, or anything about scripting.
Besides just sample code, I kind of need to figure out the theory, and I'm not even sure what to ask there.
Pretty much for the game, I'll be doing all the actual C++ code, then hand off scripting to the others.

First off I'm thinking of binding the collision and warping functions, not even sure how to implement warping, and then having to implement characters walking around and having some talking, and I have no idea how to do that either :P

So far the only tutorial I've read is by my friend Claus... http://forums.tigsource.com/index.php?topic=3149.0

Need more tutorials :(



Also, hopefully I can convince the scripter to use Lua instead of Python >_>
User avatar
aamesxdavid
ES Beta Backer
ES Beta Backer
Posts: 347
Joined: Wed Jan 07, 2009 8:49 pm
Location: Bellevue, WA
Contact:

Re: Lua: where the heck do I begin? D:

Post by aamesxdavid »

Whoa, why the hate on Python? Haha, as I understand it, it's not quite as efficient as Lua, but especially if what you're making is for PC, it shouldn't matter unless you're doing some really heavy shit in your scripts. So you're talking about implementing Lua into the engine? I assume Falco can assist you with that. How much functionality do the scripters need exactly?
User avatar
Moosader
Game Developer
Game Developer
Posts: 1081
Joined: Wed May 07, 2008 12:29 am
Current Project: Find out at: http://www.youtube.com/coderrach
Favorite Gaming Platforms: PC, NES, SNES, PS2, PS1, DS, PSP, X360, WII
Programming Language of Choice: C++
Location: Kansas City
Contact:

Re: Lua: where the heck do I begin? D:

Post by Moosader »

I don't know anyone who uses Python, though. I have three friends who use Lua.
I think mainly we're going to use scripting for NPCs walking around and what they say when you talk to them, and I guess stuff like warps. I honestly have no idea what to expect as I have never used it before.
User avatar
trufun202
Game Developer
Game Developer
Posts: 1105
Joined: Sun Sep 21, 2008 12:27 am
Location: Dallas, TX
Contact:

Re: Lua: where the heck do I begin? D:

Post by trufun202 »

I'm sure you've watched this video in the past, but check out Falco's Dev Marathon: Day 2: http://www.youtube.com/watch?v=JjS-tVm_AJE

Watching this video I finally had my "ah-ha" moment with Lua.
-Chris

YouTube | Twitter | Rad Raygun

“REAL ARTISTS SHIP” - Steve Jobs
User avatar
Trask
ES Beta Backer
ES Beta Backer
Posts: 738
Joined: Wed Oct 29, 2008 8:17 pm
Current Project: Building a 2D Engine
Favorite Gaming Platforms: Sega Genesis and Xbox 360
Programming Language of Choice: C/C++
Location: Pittsburgh, PA
Contact:

Re: Lua: where the heck do I begin? D:

Post by Trask »

MarauderIIC wrote:You know those people that are like "CHECK IT OUT I just made Linux run on this piece of celery [or other random object]!!"? Yeah, that's Falco, but with ES.
Dear god, they actually ported ES to a piece of celery!
Martin Golding wrote: "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
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: Lua: where the heck do I begin? D:

Post by M_D_K »

Trask wrote:http://lua-users.org/wiki/TutorialDirectory

Hope this helps!
I go there regularly(I mirror'd the whole site to my hard drive :mrgreen: )
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
Trask
ES Beta Backer
ES Beta Backer
Posts: 738
Joined: Wed Oct 29, 2008 8:17 pm
Current Project: Building a 2D Engine
Favorite Gaming Platforms: Sega Genesis and Xbox 360
Programming Language of Choice: C/C++
Location: Pittsburgh, PA
Contact:

Re: Lua: where the heck do I begin? D:

Post by Trask »

Yeah, I haven't reached LUA yet, but I'm hanging on to that site as well.
MarauderIIC wrote:You know those people that are like "CHECK IT OUT I just made Linux run on this piece of celery [or other random object]!!"? Yeah, that's Falco, but with ES.
Dear god, they actually ported ES to a piece of celery!
Martin Golding wrote: "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
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: Lua: where the heck do I begin? D:

Post by Falco Girgis »

I don't recommend doing something like warps on Lua. Anything systematic like that should be in the level editor.

I specifically reserve Lua for special logic. We even have default AI in the engine, so that everything Lua does is truly unique. You have to make sure that Lua is doing useful things without making it do things that the engine should handle.

If done correctly, you come up with a Lua system that compliments and adds on to the capabilities of your engine, but your engine doesn't need Lua. If you go overboard, you create a weak, shitty engine that is completely Lua dependent. Lua is slower than the engine. You don't want to go crazy, scripting is not free.

Lua is also slower (coding time and run time) than just doing something in a level editor (laying warps).

Scripting design is just something you have to learn for yourself. It becomes intuition after screwing up a few times. I had to rewrite ours at least twice before it became anything like what it is now.
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: Lua: where the heck do I begin? D:

Post by M_D_K »

GyroVorbis wrote:I don't recommend doing something like warps on Lua. Anything systematic like that should be in the level editor.

I specifically reserve Lua for special logic. We even have default AI in the engine, so that everything Lua does is truly unique. You have to make sure that Lua is doing useful things without making it do things that the engine should handle.

If done correctly, you come up with a Lua system that compliments and adds on to the capabilities of your engine, but your engine doesn't need Lua. If you go overboard, you create a weak, shitty engine that is completely Lua dependent. Lua is slower than the engine. You don't want to go crazy, scripting is not free.

Lua is also slower (coding time and run time) than just doing something in a level editor (laying warps).

Scripting design is just something you have to learn for yourself. It becomes intuition after screwing up a few times. I had to rewrite ours at least twice before it became anything like what it is now.
Hell yeah! I totally agree

Anything speed critical should be in the engine. You do not want to be running a physics engine written in Lua. You write it in C/++ and give Lua access to it.
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
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: Lua: where the heck do I begin? D:

Post by Falco Girgis »

Yeah, that's the mistake the kiddies make. We gentlemen have mainstreamed Lua, and the first thing that they want to do is basically write the entire game in Lua...
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: Lua: where the heck do I begin? D:

Post by M_D_K »

OK Arce told me show you this.
Attachments
works1.png
works1.png (6.92 KiB) Viewed 1161 times
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
Trask
ES Beta Backer
ES Beta Backer
Posts: 738
Joined: Wed Oct 29, 2008 8:17 pm
Current Project: Building a 2D Engine
Favorite Gaming Platforms: Sega Genesis and Xbox 360
Programming Language of Choice: C/C++
Location: Pittsburgh, PA
Contact:

Re: Lua: where the heck do I begin? D:

Post by Trask »

I'm clearly missing something, unless its an inside gag. Then I'm fine.
MarauderIIC wrote:You know those people that are like "CHECK IT OUT I just made Linux run on this piece of celery [or other random object]!!"? Yeah, that's Falco, but with ES.
Dear god, they actually ported ES to a piece of celery!
Martin Golding wrote: "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
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: Lua: where the heck do I begin? D:

Post by M_D_K »

Arce actually said shove it her face. Cause I have a flexible lua system, that I can modify to any extent in real time. See the last command.
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: Lua: where the heck do I begin? D:

Post by Ginto8 »

M_D_K wrote:Arce actually said shove it her face. Cause I have a flexible lua system, that I can modify to any extent in real time. See the last command.
Meaning you can change the lua files dynamically? That's some cool stuff. :mrgreen:
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
Trask
ES Beta Backer
ES Beta Backer
Posts: 738
Joined: Wed Oct 29, 2008 8:17 pm
Current Project: Building a 2D Engine
Favorite Gaming Platforms: Sega Genesis and Xbox 360
Programming Language of Choice: C/C++
Location: Pittsburgh, PA
Contact:

Re: Lua: where the heck do I begin? D:

Post by Trask »

M_D_K wrote:Arce actually said shove it her face. Cause I have a flexible lua system, that I can modify to any extent in real time. See the last command.

Ha.. I forgot to scroll down, just saw the picture. Forgot about that being yours... sorry! :oops:
MarauderIIC wrote:You know those people that are like "CHECK IT OUT I just made Linux run on this piece of celery [or other random object]!!"? Yeah, that's Falco, but with ES.
Dear god, they actually ported ES to a piece of celery!
Martin Golding wrote: "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
Post Reply