LUA Scripting

StixNStonzStixNStonz Join Date: 2006-11-06 Member: 58439Members, Reinforced - Shadow
<div class="IPBDescription">I'd like to start learning.</div>When the devs here began getting excited about the LUA things they were implementing, it was the first I'd heard of it. I've mapped for years and an getting pretty seriously into modelling right now, so why not try to round it out with scripting as well.

Seems that LUA is rather popular for scripting, and from what i've seen, looks like it would be rather easy to learn. What I'm wondering is how it will be implemented and used in NS2, or for any fps for that matter.

If anyone has good links to tutorials, or wants to make their own, or simply wants to give some advice, please feel free. I simply want to become the best game content creator I can be, and it sounds like a solid scripting base would be a very valuable asset. I just gotta figure out how to start <img src="style_emoticons/<#EMO_DIR#>/tounge.gif" style="vertical-align:middle" emoid=":p" border="0" alt="tounge.gif" />

Comments

  • GredinusGredinus Join Date: 2007-10-21 Member: 62694Members
    Hello,
    I just wanted to ask some questions abaut Lua and becose theres a thread already ill post it here.

    I want to make a mod (on the source engine) that would be moustly implemented on Lua but I dont know how to acctuly add the Lua scripting system. So could someone help me with it?
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    edited October 2007
    <!--quoteo(post=1656986:date=Oct 20 2007, 10:06 PM:name=StixNStonz)--><div class='quotetop'>QUOTE(StixNStonz @ Oct 20 2007, 10:06 PM) <a href="index.php?act=findpost&pid=1656986"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Seems that LUA is rather popular for scripting, and from what i've seen, looks like it would be rather easy to learn. What I'm wondering is how it will be implemented and used in NS2, or for any fps for that matter.<!--QuoteEnd--></div><!--QuoteEEnd-->
    The best place to look is probably <a href="http://www.garrysmod.com/" target="_blank">Garry's Mod</a>. Our use of Lua in NS2 is a bit different, but it will give you the general idea. By the way, "Lua" is the proper way of writing the name, not "LUA".

    <!--quoteo(post=1656994:date=Oct 21 2007, 01:21 AM:name=Gredinus)--><div class='quotetop'>QUOTE(Gredinus @ Oct 21 2007, 01:21 AM) <a href="index.php?act=findpost&pid=1656994"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I want to make a mod (on the source engine) that would be moustly implemented on Lua but I dont know how to acctuly add the Lua scripting system. So could someone help me with it?<!--QuoteEnd--></div><!--QuoteEEnd-->
    There are some challenges, especially if you are going to be making a multi-player mod. In order to get networking to work identically to how to works in C++ I had to make modifications to the Source engine, which obviously you can't do if you're making a mod. I described this a bit <a href="http://www.unknownworlds.com/ns2/news/2007/06/client_side_scripting_and_weapons" target="_blank">here</a> and <a href="http://www.unknownworlds.com/ns2/news/2007/06/client_side_scripting_and_weapons_continued" target="_blank">here</a>. I would check out <a href="http://www.rasterbar.com/products/luabind.html" target="_blank">LuaBind</a> or <a href="http://luaplus.org/tiki-index.php" target="_blank">LuaPlus</a> to help you integrate Lua with your C++ code. For NS2 we didn't use these libraries, but in retrospect I think that probably would have been an easier way to go. Beyond that it's just a matter of deciding which pieces of the code you want to pull out into Lua and how the API is setup. Our approach mirrors the Source SDK quite a bit.

    Of course I'd also recommend you check out <a href="http://www.unknownworlds.com/decoda" target="_blank">Decoda</a> if you want to do Lua development.
  • douchebagatrondouchebagatron Custom member title Join Date: 2003-12-20 Member: 24581Members, Constellation, Reinforced - Shadow
    <!--quoteo(post=1657063:date=Oct 21 2007, 05:15 PM:name=Max)--><div class='quotetop'>QUOTE(Max @ Oct 21 2007, 05:15 PM) <a href="index.php?act=findpost&pid=1657063"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->In order to get networking to work identically to how to works in C++ I had to make modifications to the Source engine, which obviously you can't do if you're making a mod.<!--QuoteEnd--></div><!--QuoteEEnd-->


    didnt garry's mod 9 have Lua scripting in it? how was it accomplished there without altering the source engine, because at that point it was still a mod and not a licensed game.
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    <!--quoteo(post=1657064:date=Oct 21 2007, 03:19 PM:name=6john)--><div class='quotetop'>QUOTE(6john @ Oct 21 2007, 03:19 PM) <a href="index.php?act=findpost&pid=1657064"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->didnt garry's mod 9 have Lua scripting in it? how was it accomplished there without altering the source engine, because at that point it was still a mod and not a licensed game.<!--QuoteEnd--></div><!--QuoteEEnd-->
    I'm pretty sure Garry's Mod is still implemented as a mod, even though Garry does have access to the engine source. As to how he did it, Garry took a different approach and implemented the networking using the Source user message facility, which is just a general mechanism for sending data from the server to the client. In HL1 we used this for things like sending the minimap data. The reason we didn't do this for all of the networking in NS2 is that it doesn't take full advantage of the facilities built into the engine (you can read about that <a href="http://developer.valvesoftware.com/wiki/Networking_Entities" target="_blank">here</a>). Clearly it works well for a game like Garry's mod, but for NS2 we wanted to make sure we weren't sacrificing anything by adopting Lua for our game play code.
  • schkorpioschkorpio I can mspaint Join Date: 2003-05-23 Member: 16635Members
    edited October 2007
    <!--quoteo(post=1656986:date=Oct 21 2007, 03:06 PM:name=StixNStonz)--><div class='quotetop'>QUOTE(StixNStonz @ Oct 21 2007, 03:06 PM) <a href="index.php?act=findpost&pid=1656986"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->so why not try to round it out with scripting as well.<!--QuoteEnd--></div><!--QuoteEEnd-->

    cause you should occasionally go outside LOL! <img src="style_emoticons/<#EMO_DIR#>/biggrin-fix.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin-fix.gif" /> j/k

    seriously though, i think its a great idea - I'd like to try a few things out myself just to see what can be done when ns2 comes out <img src="style_emoticons/<#EMO_DIR#>/smile-fix.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile-fix.gif" />
Sign In or Register to comment.