GoldenEye: Source Forums

Global Communications => Development Media => killermonkey's Blog => Topic started by: killermonkey on March 11, 2008, 06:28:03 pm

Title: March 11, 2008 - Gameplays and LUA
Post by: killermonkey on March 11, 2008, 06:28:03 pm
Killer Monkey here, I am taking over Anthony's blog for today since I just made a significant step in coding. I have FULLY implemented LUA game modes! Thats correct, it has been extremely difficult, but with the help of Scott's base code I was able to do it over the past 5 days. In order to achieve this, I employed the following schematic:

(http://img.photobucket.com/albums/v687/killermonkey01/GE%20Source/blog_flowchart.jpg)

As you can see, the classes at the top are CGERules, CGEPlayer, and Gameinterface. These three classes are what the server uses to define the playing of a game.

CGERules are logical functions and events that are called and can be acted on. In these calls, CGERules calls functions from CGELUAGamePlay that interfaces with LUA. In the absence of any defined LUA functions, it happily goes about what it would do normally (IE NO GAMEPLAY). When the rules are created at map load, the LUA classes are also loaded into memory using the helper classes CGEGameModeSystem and CGEGameMode. These classes store the various LUA gamemodes that are detected in the 'scripts/gameplay/' folder. During a course of play any gamemode can be loaded at any time and it will restart the round and start every player on a clean slate!

CGEPlayer calls CGELUAGamePlay to get definitions that affect the player, such as whether or not he should respawn, his current armor/health level, and how many times he died (in this case for YOLT).

GameInterface is where all the magic begins. This is called upon initialization of the server dll and calls the CGELUAGamePlay's init() function that loads LUA. That means LUA remains loaded until the server is shutdown making level loads highly efficient and also maintains stability between map sessions by remembering your last Game Mode and reloading it for you.

Finally, all you, the server owner, has to do is create a .lua file and .txt file that defines the gameplay for the parser. The LUA file will contain the functions called by CGELUAGameplay, you will also have access to a plethora of Call Back functions defined to set and retrieve data necessary to modify the gameplay. All of this code is server side, the only thing the client will see are UserMessages to update their HUD/VGUI windows!
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: Anthony on March 11, 2008, 06:29:47 pm
Well done mate :]
You are always welcome to blog here.
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: Loafie, Hero of Dreams on March 11, 2008, 07:21:46 pm
gaddam i wish i had a fucking clue what you were talking about
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: Jonathan [Spider] on March 11, 2008, 08:37:06 pm
generally i read the programmer things, and just nod my head and pretend to understand. but i actually think i got this this time haha.

hey this means we get to play with trying out a lot of game mods without breaking the core code too since its all done through scripting.
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: killermonkey on March 12, 2008, 06:22:13 am
Correct, I am working on a simpliler and more direct model for the Wiki, don't worry LoFi :)
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: Mike [fourtecks] on March 12, 2008, 07:01:48 am
gaddam i wish i had a fucking clue what you were talking about
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: Jeron [SharpSh00tah] on March 12, 2008, 09:26:13 am
gaddam i wish i had a fucking clue what you were talking about
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: mbsurfer on March 12, 2008, 11:13:33 am
 :o LUA is probably the simplest of codings to learn starting out.  This is definitely a big step, and I expect to have a shit load of game modes made by the community, and not just the developers!

Thanks goes out to all who made this possible!
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: Sean [Baron] on March 12, 2008, 12:18:59 pm
Thanks goes out to all who made this possible!

Your welcome. I take full credit for all this work.... :P Just kidding Killermonkey and Anthony. Great job guys! :)
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: mbsurfer on March 12, 2008, 12:49:15 pm
Thats correct, it has been extremely difficult, but with the help of Scott's base code I was able to do it over the past 5 days

And Scott ;)
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: Doc.NO on March 14, 2008, 12:21:18 pm
LUA rocks :D It's good to see things are in progress.
Title: Re: March 11, 2008 - Gameplays and LUA
Post by: CCsaint10 on March 16, 2008, 05:51:34 pm
I've been really enjoying these blogs anthony and killermonkey..PLEASE keep them coming so I can hear how progress is going :)