Thursday, August 18, 2005
So I started playing around with LUA. I want to use it in Facewound for enemies to make things easier to edit without compiling.
For anyone that doesn't know, LUA is a scripting language. It's awesome because you can edit it without having to compile or restart the application. You just load the script again and the changes are reflected straight away. This makes a lot of sense to me. I think the enemies and maybe entities in a game engine should be external and should 'plug in' at runtime - just like graphics and sound. They should be an asset rather than something hard coded in.
That said, I've integrated it into GMOD. Which makes it REALLY awesome for modders and server admins. For example, to freeze every player on a server you could make this function in a script called "garrysscript.lua"
function FreezeAll( ) while i=0, maxplayers do Player_Freeze( i, true ) end end
Then in the console you'd load up the script with the command I added "lua_openscript garrysscript.lua". So now that function is added to the engine and anywhere in the game (or in a script) you can call FreezeAll() and it will freeze all players.
So you're probably thinking, what the fuck use is this. I'll show you what's going to happen in 8.4. There's now a file called gamemode_default.lua. This contains functions that apply the normal deathmatch gamerules. Things like adding kills to the scoreboard, choosing spawnpoints, going to the next map when the current map ends etc.
Now we can add new gamemode_ scripts. You could say add one that would make it so the game happened in 3 minute rounds and you lost points for killing. You could add a mode where one player was invisible and did 10x more damage than everyone else. You could even add a mode where each player takes turns and gets 10 seconds to move. There's a lot of possibilities here.
This makes a lot of sense to me. I can't understand why Valve didn't add some kind of scripting language like this in from the start. It would have saved them days of testing and recompiling. Plus it makes modding a shit load easier.