net_graph 2 explanation please

What do the different colors represent?

So far i’ve established that Green is player data, Red is entities, but what is the yellow?

net_graph 3 gives you a legend on the left-hand side. What game-mode is this?

The Valve wiki explains everything you need to know.


One last thing; does usermessages include the netlib?
I’m guessing yes, but i need to be sure. It’s a rather crippling problem.

That’s TF2.

What game-mode are you running with that many umsgs? And, no, umsgs do not count as “net-messages” but there are simple ways to prevent that umsg spam.

it’s a heavily customized Basewars.
As in, i’ve re-written the entire gamemode.
I’m also quite positive it’s nothing in the actual gamemode itself but rather an addon i’m using.
Problem is pinpointing where its coming from

By using the first 3 files here you can convert most umsgs into net-messages: /

Put into: SERVER/garrysmod/addons/acecool/lua/entities/info_mobile_spawn.lua

Put into: SERVER/garrysmod/addons/acecool/lua/autorun/server/class_lrecipientfilter_sv.lua

Put into: SERVER/garrysmod/addons/acecool/lua/autorun/umsg_to_net_mapping_sh.lua

Was hoping to fix it instead of put a bandaid over it.

I’ll give that a shot and let you know how it goes tomorrow.

User messages use 2 libraries. umsg on the server and usermessage on the client. Look for usermessage.Hook in client files, those are the user-message receivers. On the server, look for umsg.Start / umsg.End, those functions prepare, and send, the user-message to the client; there will be other things in-between in most cases unless it is simply a “flag” message.

You can rewrite all of those to net-messages but other functions such as SendLua also use user-messages, so it could be other things. Some things to look for in terms of “lag” would be using NWVars to fetch data every frame.

I use SetNWVars all over the place.
i’m going to have to go over everything and change all that aren’t i?

When I release my networking system, I’ll be redirecting all NWVar functionality through it ( meaning that NO data will be sent unless the data changes; and no data will be sent to connecting players [ prevents overflow ] but all data will be synced on connect ).

So, it depends if you want to wait for a bandaid ( which will work as a drop-in replacement to optimize old / existing code just like my umsg to net-msg system ) or recode it ( you could also add a cache variable to the NWVars so it calls NWVar if CurTime( ) - LastUpdate > 3 so they only update every 3 seconds or so. Even limiting them to once per second is helpful ).

I’ve decided it’s time to start working on the 3rd iteration of the gamemode.
Completely new and from scratch.
But that wont be functional for quite some time so a bandaid would be quite helpful. <3

Not sure how i’m going to sync the massive amount of persistent data though for not only players but entities as well.
Isn’t the and supposed to be good for this?

Those are for a type of networked vars. Also update too often ( I think Kilburn changed it to only refresh every few seconds instead of every second or whatever )…

Take a look at my dev base game-mode. You won’t need to worry about include or AddCSLuaFile at all because of the autoloader, and will have the networking system included, with data management and much more. Feel free to add me on steam; and take a look at the documentation folder for the dev-base ( will be removed soon in favor of the bit-bucket wiki, and a copy will be included for each version; will generate it automatically using dev-tool I’m writing )…

I have written over 400 tutorials and completed “systems” in Lua for Garry’s Mod. I tutor and answer questions for free; feel free to add me on Steam if you need some guidance. This forum is for devs that need help working on things. Here are some resources to help you get started:

Generalized Lua Help ( Links to Wikis, Answers the question of “Where do I post a simple question or DarkRP Specific question”, links to other resources compiled by forum members )

Useful Programs ( SteamCMD, Autosizer, Desktops, Process Explorer ) and Notepad++ Upgrades

Acecool Dev Base Skeletonized Base Game-Mode ( Never worry about Include or AddCSLuaFile ever again; comes with New Hooks, Console Commands, Meta-Table Objects, Helper Functions, Extended Functionality, and more! )

acecooldev_base Addon - All of the features above, but packaged as an addon. [ COMING SOON ]

Turns out the lil’ tool you gave me major broke Advance Duplicator 2.

Anyway, i’m no newbie to lua and i am at a stage well beyond your newbie resources.
This leaves us with the question of; if the SetupDataTables() thing isn’t the most efficient way of networking data, what is?

Back to basics, let’s try and keep this simple.

What should be used;

Current Method:

ply:SetNWInt(“Money”, 1337 )

– Or –

function PLAYER:SetupDataTables()
self:NetworkVar( “Int”, 0, “Money” )
ply:SetMoney( 1337 )

– Or –

This method would require a whole library built around networking the data, but here’s a crude module to give you an idea

util.AddNetworkString( “PLAYER::SetMoney” )
local PLAYER=FindMetaTable(“Player”)

function PLAYER:SetMoney( amt )
if( !SERVER ) then return end
self.Money = amt
net.Start( “PLAYER::SetMoney” )
net.WriteInt( self:EntIndex(), 32 )
net.WriteInt( amt, 32 )

if( CLIENT ) then
net.Receive( “PLAYER::SetMoney”, function()
local ent = Entity( net.ReadInt( 32 ) )
if( !IsValid( ent ) || !ent:IsPlayer() ) then return end
ent.Money = net.ReadInt( 32 )
end )

elseif( SERVER ) then
concommand.Add( “getmoney”, function( ply,cmd,args )
local idx = tonumber(args[1])
if( !idx ) then – Stop breaking the script please
local ent = Entity( idx )
if( !IsValid( ent ) || !ent:IsPlayer() ) then return end
net.Start( “PLAYER::SetMoney” )
net.WriteInt( idx, 32 )
net.WriteInt( ent.Money, 32 )
net.Send( ply )
end )

function PLAYER:GetMoney()
if( SERVER ) then
return self.Money
if( !self.Money ) then
RunConsoleCommand( “getmoney”, self:EntIndex() )
return 0
return self.Money

Which tool broke it, and what were the errors so I can fix it. I already have the umsg converter running on a few large production servers and have only heard compliments, but they weren’t running sandbox. I did mention that there are other umsg functions which aren’t converted, but they’d send them as usual so they shouldn’t interfere as some of them exist on the other production servers.

My resources range from beginner to advanced and beyond. The questions asked just haven’t been too specific though.

Instead of continuously rewriting the game-mode over and over, why not start making your own meta-tables / objects, helper-functions, etc… Then you’ll have a lot of building blocks to assemble the game logic with, and if there is an issue with something you will only need to change it in one place instead of many? Additionally, organization is key; game developers / designers usually design how a game works before coding it by abstracting the idea on paper, then setting up specifics which are then converted to logic / code.


I have been, only i’ve been working on this gamemode for over a year now and in that time my skills have improved.
“You always do it better the second time.”

I agree with you that skills improve, but if you write the game-mode in a modular fashion ( helper-functions, reduce repeated code, etc… ) you can swap out old code for newer / better code on the fly while retaining functionality. Food for thought on the next build.

The reason for the dispatch error is because one of the messages had an error. There was one error like that in the large production server I put it in but it was caused by improper writes ( like in this case, you’d expect umsg to also fail because the number is nil ).

Pyro, if you plan on using Acecool’s cool thing then i should warn you that it breaks a few of the functions, well it at least did for me :frowning:

  • Edit - Guess you figured it out for yourself