Garry's Mod

Garry's Mod

NextFX - Stylish Chase FX [EASY Custom Packs]
Optimization problem
On maps with big amount of entites this addon causes lag. That's because in local function GetAllNextbots() you use ents.GetAll(), which is not intented to use in loops/frequent calls. For that you need to use ents.Iterator()[wiki.facepunch.com]. That should help improve perfomance.

Aside from that, I don't understand why for NPC detection you try to find "npc_" in their classname, even though you can use method IsNPC() on them to check if they are NPC or not. What makes it more confusing for more is the fact that you did acknowledged IsNextBot() method (however you still firstly check for "nextbot_" in their classname for some reason)

Sorry for my little rant here, I just wanted to point at some inconstancy and questionable decisions in the code. Didn't want to be sound rude.
Last edited by Король таджиков; 1 Aug @ 6:51am
< >
Showing 1-6 of 6 comments
VAKANCY  [developer] 1 Aug @ 8:13am 
No worries man! I was aiming for generous detection, and I'm sorry for any lua newbie mistakes!
VAKANCY  [developer] 1 Aug @ 8:14am 
Thank you for bringing this to my attention, optimization due!
VAKANCY  [developer] 1 Aug @ 8:16am 
Transparency: This uses some AI to get the job done because I don't know what the f#$k I'm doing half the time when it comes to lua
Last edited by VAKANCY; 1 Aug @ 8:16am
No problems, glad to help you out! One thing I didn't mentioned is that same thing should be done in GetValidPlayers(), where instead of player.GetAll() it's better to use player.Iterator(). Though it's not that critical, due to amount of players, but hey, extra perfomance is still extra perfomance.
Last edited by Король таджиков; 1 Aug @ 8:29am
VAKANCY  [developer] 1 Aug @ 8:33am 
nah dude you're genuinely such an awesome help bro
right now i'm struggling to read the custom directory without using lua, once this is resolved, i'm loving the sound of extra framejuice
though tomorrow i'm going on a trip that was planned way before the workshop upload
so we'll see how much i can get done before that
VAKANCY  [developer] 1 Aug @ 12:51pm 
Yay for optimization! Should be more performant for you! Thanks again for all the helpful detail.
Last edited by VAKANCY; 1 Aug @ 12:51pm
< >
Showing 1-6 of 6 comments
Per page: 1530 50