Narwhal Gamemode Base


Announcing the Official Gamemode Base by GModCentral

Narwhal is a base gamemode designed for the development of large, networked community gamemodes. It comes with a few frameworks and utilities to make your gamemodes more efficient and bug-free.

One of the redeeming qualities of Narwhal is stability. It’s easy for anyone to add features to Narwhal based gamemodes without editing important files or breaking the whole gamemode.

Since it’s not always possible to derive the gamemodes you have now from Narwhal, we plan to make a server addon which has some of the features you would get by using Narwhal as your base.

Narwhal comes with an array of features to help keep your gamemodes running clean and efficiently. Nearly all features are toggleable.

Highlighted Features
[li]MySQL support and Interfaces. Supports both threaded and non-threaded input.[/li] [/ul]
[li]Custom Networking Utilities. Supports Tables, EffectData, and even user-defined data structures. They only sync with the client on a per-call basis, so making a lot of these won’t lag your server.[/li] [/ul]
[li]Stable ‘Modules’ System. Think of it as a plug-ins system that doesn’t break and conflict all the time.[/li] [/ul]
[li]Gamemode ‘Themes’ System. Yo dawg, I heard you like gamemodes, so we put a gamemode in your gamemode so you can play while you play! It’s like Derma Skins are to VGUI, as Themes are to your Gamemode.[/li] [/ul]
[li]Animations System. Comes complete with special player skeletons for NPC Bone merging, which allows players to use NPC animations. Compliments of Big-Bang for editing his NPC Animations script specifically for this. Players can use the animations of any model that uses a Valve Biped Skeleton.[/li] [/ul]
[li]New Base NPC. The problem with SNPC’s and the AI management is that it’s all pretty much serverside. This makes for buggy prediction on the client, so in Narwhal, the NPC’s and AI are all shared.[/li] [/ul]
[li]In-Game Map Editor. This is namely for entity manipulation. You’ll be able to add, remove, and edit entities with it.[/li] [/ul]

As mentioned in the Features, Narwhal comes with a sort of glorified plugins system that we have called Modules. These are not to be confused with the GMod Modules that use the require function.

Modules are well encapsulated, so even if your module fails, your gamemode won’t. These make it easier for people to add new features to a gamemode without breaking everything.

Narwhal comes with a default set of modules that can be toggled from a configuration file. Some of the features from above actually come in the form of a module.

Stock Modules
[li]MySQL Interface.[/li][li]Simple Currency system.[/li][li]Custom Achievements system.[/li][li]Data Management system.[/li][li]Global Store Platform.[/li][li]And more? If you have any suggestions, we’d love to hear them.[/li][/ul]
It is our hope that Narwhal will some day evolve to a point of popularity where people will start making and sharing modules for gamemodes derived from it.
Narwhal is open source, and can be found on GitHub.

You’ll need Git installed to get updates from the repository, but you can also download the repository in the form of a .ZIP or .TAR file. For those who have never heard of Git, it’s basically like SVN, but without all the bugginess and constant lock-ups.

Please note that Narwhal is not quite complete. There are several features that have not been committed yet, and some of the existing features may have bugs. There are features that need further optimization and/or rewriting, and some of them still need stress testing.

Feel free to point out poor coding practices and gamemode bugs. We’re not going to pretend we’re perfect, so don’t be afraid to tell us when we’ve made a mistake. Narwhal is for everyone, so we want it to be as efficient and bug-free as possible! Plus we love it when people take interest in our progress.
Narwhal Gamemode Base by GModCentral is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Join the forums at and plunge into the discussion boards. Keep an eye on the forums for the latest news on our projects.

Narwhal is going to be the base to Grand Colt (GModCentral’s Cops versus Mafia action-RPG gamemode), and perhaps other future gamemodes. We are currently looking for talented mappers to make maps for Grand Colt, and scripters who may be interested in helping us in the long term. Send an email to if you want to apply for a position on the team. Just include some examples of your work.

The Team
[li]Jesus - Administration Lead, Web Designer/Developer, and Musical Assistant[/li] [li]Grea$eMonkey - Co-Administrator and Lua Lead[/li] [li]AndrewMcWatters - Lua[/li] [li]NightExcessive - Lua[/li] [li]Tobba - Lua[/li] [li]Oskutin - Mapping Lead[/li] [li]highdef - Mapping [/li] [li]Borsty - Mapping [/li] [li]anarcheril - Modeling[/li] [li]Props - Music[/li][/ul]
Thank you for reading. Please feel free to ask any of your questions here.

Sounds great Grease! Will be sure to try it when finished. :3:

This sounds awesome. I’d use this if I weren’t working on a similar one already. :arghfist::saddowns:

Awesome, ill try it out (probably will just f$%k around)


Best thread in a long time. Looking forward to this.

Sounds sexy

You can download it now, as it’s in a fairly stable state. The gamemode themes feature isn’t finished yet, and the animations script still needs further optimization, but other than that it’s functional.

The networking and modules seem to be fine, but still need some more extensive testing. If anyone wants to try using it as a base and do some bug searching, that would be great. If anyone wants to be adventurous and stress-test the networking capabilities, I’ll be interested to hear the results.

Right now the GModCentral Team is overlapping the work on Narwhal with work on Grand Colt, so any help the community can offer is most appreciated.

Love it. Its been a while since something interesting and good was brought to the gamemode thread

You should add some server-to-server communication modules, using oosocks or something. Since large networked community gamemodes are likely to have multiple servers, such a feature would allow the developer to easily integrate things like global server chat (maybe have that as a stock module?) and cross server administration.

You could use a umsg-like system for the backend. Something like:

[lua]local function smChat( hdl, sm )
local ip = hdl:GetIP()
if (ip == “”) then – Choice of IP here
for _, ply in pairs( player.GetAll() ) do
ply:ChatPrint( sm:ReadString() )
servermessage.Hook( “sm_chat”, smChat )[/lua]

[lua]local function cmdGChat( ply, com, args )
local hdl = smsg.GetServer( “ip_of_server_here” )
hdl:Start( “sm_chat” )
hdl:SendString( ply:Nick() … ": " … table.concat( args, " " ) )
concommand.Add( “gchat”, cmdGChat )[/lua]

gchat hello there!

On the other server:

thomasfn: hello there!

hdl:Dispatch would buffer the message into a queue. If the connection isn’t open, it will open it then dispatch the messages (all using callbacks).

This is an excellent example of what the modules system is for.

Suppose you are running a server and want a global chat mod between your servers that interfaces with your custom chat box, which just so happens to be contained in another module. Problem is you don’t know how, so you need to get some stranger to do it. With the modules system in place, you don’t need to hand over an unnecessary amount of your source code to make sure nothing breaks in the process. You can ask them to simply make a module that interfaces with a another module that handles your custom chat box, and so on.

But yeah, that’s a good idea for a stock module. If you want to make one for it, I can include it in the repository.

Holy shit I’ve been waiting for something like this. Let’s play around with this beauty.

Amazing, awesome, fantastic, there’s no word to describe this.

Glad to hear that I was part of this.

Could you also mention that the NPC Animations system allows you to use ANY model as a player model as long as it has the ValveBiped skeleton, even if they don’t have animations? It’s kind of a clever unintended feature for it.

I had to read that 3 times before I figured out what you meant. But yea, good idea for a stock module. I might write it myself if I get bored enough, I got a tonne of non gmod stuff to be doing.

This is awesome! Good work grea$emonkey and crew. Idea for a module, include one of those automatic update modules that updates the core files and things.

Wow! This looks amazing! I can’t wait to see how this works!

Also I forgot to say that this looks pretty awesome :v:

Thanks everyone for all the positive feedback. :smile:

Looks good, I cant code for shit, but I hope to see good stuff based off of this.

Since you reminded me,

Narwhals, Narwhals Swimming in the ocean, causing a commotion coz they are so awesome…
Youtube search narwhals.