Make_Empty_Mobs()
set category = "Admin Other"
if(!usr.client.holder)
alert("You cannot perform this action. You must be of a higher administrative rank!")
return
if(!usr.client.holder||usr.client.holder.level<5) return
var/amount = input("How many clientless player mobs do you want to create?") as num
if(!amount) return
log_errors("\n\n### CREATING [amount] TEST PLAYER MOBS AT: [time2text(world.realtime,"Day DD hh:mm")] ###\n\n")
src << "Creating [amount] player mobs"
for(var/i, i<amount, i++)
var/mob/player/M = new/mob/player
M.loc = locate(usr.x+i,usr.y,usr.z)
M.icon = usr.icon
M.TestChar = 1
spawn M.Update_Player()
M.name = "TESTCHAR #[i]"
Players += M.name
src << "DONE! Created [amount] player mobs"
log_errors("\n\n### DONE CREATING [amount] TEST PLAYER MOBS AT: [time2text(world.realtime,"Day DD hh:mm")] ###\n\n")
Problem description:
So, I currently have the above code. It works, it creates an empty mob, and that's it.
I currently have a lot of front end lag due to some of the in game tabs, and it seems to only occur when above a certain player count (70+).
I want to be able to test fixes without using my playerbase as the guinea pigs, and want to alter the above code to essentially mimic a player. (Have tabs, a client, use CPU like a player, etc. etc.)
Is this possible? And if so, how do I do it?
What will serve you best is profiling your game for an extended time (like anywhere from 5-15 minutes) at different levels of user load. That will show you things like which procs take the longest, which are called the most, etc. In general, the more total "self" time a proc has, the more you want to target it for optimization. I would also look at procs that are called the most frequently regardless of their time, to see if there are ways to improve those or if you can avoid calling them in some cases. (Any proc call comes with some startup and teardown overhead that is unavoidable.)
Profiling at different levels of user load lets you compare these profiles--comparing averages will be much easier than comparing totals--to see what's different. The most useful piece of info will probably be the call count over the time period you profiled. If both profiles take exactly 5 minutes (or close enough), then if DoThings() is called 800 times with 20 players and 2800 times with 70 players, you know that it scales about linearly with the number of players. Any time something scales beyond linear, you want to pay it extra special attention and either avoid calling it or make it as fast as you can.