ID:159826
 
My partner made some updates to the game, nice ones at that, or so we assume, but we can't start up the game anymore...

Dreamseeker loads and the first alert() pops up, but after you hit ok, everything loads extremely slow.

You aren't moved to the login screen like before. And none of the other procs start to run.

I checked all the mob/Login procs in the game and I can't find anything that would cause this. There are only two procs running but neither seem to be the cause.

Is there anything that would cause the game to start up exponentionally slow?
An infinite loop.
In response to Andre-g1
I have loop checks on 1 and only two procs show up in the profile. And neither are infinite loops, well one is but it has a sleep(10) and a spawn(1).

I'll try disabeling that really quickly and give you the results.
In response to DemonicK
Question 1: Do you have a stat() proc
Question 2: Do you have anything excessive in the stat() proc?

Also make sure you are profiling properly... You need to start up the profiler, clear it, then reboot your world to be able to see the procs at startup. That's probably where the intensive proc is starting so that is the first place to look.
In response to DemonicK
The spawn() is probably your problem >_>. spawn() + for()/while() = lag. You need to sleep, not spawn, in your loops.
In response to Jeff8500
Ok well Im going to try changing that, but its really hard to determine a problem in a large source code, and not knowing everything that was changed.

Also, yes I have a stat proc. No nothing in there is causing any stress whatsoever.

I profiled, rebooted, and refreshed the profile.

Highest thing in there was 0.002 with one call, which was Stat()

And I just figured this out, it is loading but extremely slow.
Its like Dreamseeker itself is lagging not your connection to it.

EDIT: Idk if this matters but things like Move are taking 41 seconds + (used average in profile to determine that so...)

EDIT 2: Took out the spawn(1) in the Update proc for the HUD, and changed it to a sleep(1) but problem persists.
In response to DemonicK
I'm going to have to guess your HUD updating proc has a large loop in it or some other memory leak. Can you post that code?
In response to AJX
mob
proc/Update()
// Compares the percentage of the
if(!src.client)
return
for(var/obj/Health/O in src.client.screen) // src's health with the range of
O.Num = round((src.health/src.maxhealth)*O.Width)// each objects, then sets icon
if(O.Num >= O.Rangemax) // state accordingly
O.icon_state = "19"
if(O.Num <= O.Rangemin)
O.icon_state = "0"
if(O.Num < O.Rangemax && O.Num > O.Rangemin)
var/newnum = O.Num - O.Rangemin
O.icon_state = "[newnum]"
for(var/obj/Chakra/Q in src.client.screen)
Q.Num = round((src.chakra/src.Mchakra)*Q.Width)// each objects, then sets icon
if(Q.Num >= Q.Rangemax) // state accordingly
Q.icon_state = "19"
if(Q.Num <= Q.Rangemin)
Q.icon_state = "0"
if(Q.Num < Q.Rangemax && Q.Num > Q.Rangemin)
var/newnum = Q.Num - Q.Rangemin
Q.icon_state = "[newnum]"
for(var/obj/Stamina/Q in src.client.screen)
Q.Num = round((src.stamina/src.maxstamina)*Q.Width)// each objects, then sets icon
if(Q.Num >= Q.Rangemax) // state accordingly
Q.icon_state = "19"
if(Q.Num <= Q.Rangemin)
Q.icon_state = "0"
if(Q.Num < Q.Rangemax && Q.Num > Q.Rangemin)
var/newnum = Q.Num - Q.Rangemin
Q.icon_state = "[newnum]"
sleep(1)


Below the sleep(1) is supposed to be src.Update() but I removed it to prevent any looping to see if that fixed it..sadly no.
In response to DemonicK
Nothing looks too extravagant there to me...

Can you post the proc that is calling Update()?
In response to DemonicK
That will use a lot of CPU if it updates every tick.

1) Call it only when the corresponding var changes
2) Split it into separate procs so you have greater control over what object changes when the corresponding var changes
3) Give your player a tmp var for their HP bar etc. to cut down on the CPU caused by those for() loops.
4) Try to make your proc rely less on those if()'s. The best way to do this would be to get the player's health percentage and then set their bar accordingly. If your player's health is going over their max health or below 0, something is wrong.

mob/player/var/tmp/obj/hud/health = new

mob/player/proc/update_health()
health.icon_state = "[round(health*100/max_health,10)]"
In response to AJX
mob
Stat()
if(src.Stun>0)
src.Stun-=5
if(src.Stun<0)
src.Stun=0
if(src.GuardOn)
if(src.kunaiequipped|src.katanaequipped|src.samehadeequipped)
src.Deflection=1
statpanel("Info")
stat("-------------------{[usr]}-------------------")
stat("Village: [Village]")
stat("Bloodline: [Clan]")
stat("Rank: [rank]")
stat("Class: [Class]")
stat("Bounty: [bounty]")
stat("-------------------{Stats}-------------------")
stat("Level: [level]")
stat("Vitality: [health]/[maxhealth] (+[HealthRegen+HealthyPoints*3])")
stat("Stamina: [stamina]/[maxstamina] (+[StaminaRegen+EnergyPoints*3])")
stat("Chakra: [chakra]/[Mchakra] (+[ChakraC+ControlPoints*5])")
if(src.health<=0)
src.Death(src)
src.Update(src) //<--calls it right here.
var/A=src.tai+src.nin+src.gen

var/tt=round((src.Maxtai/A)*10)

var/nn=round((src.Maxnin/A)*10)

var/gg=round((src.Maxgen/A)*10)
stat("Tai: [tt*10]%")
stat("Nin: [nn*10]%")
stat("Gen: [gg*10]%")
stat("----------------{Experience}-----------------")
stat("Skillpoint: [SkillPoint]")
stat("Levelpoints: [LevelPoint]")
stat("Next Level: [exp] out of [max_exp]")
stat("-----------------{Elements}------------------")
if(src.FireE)
stat("Katon")
if(src.WaterE)
stat("Suiton")
if(src.LightningE)
stat("Raiton")
if(src.EarthE)
stat("Doton")
if(src.WindE)
stat("Fuuton")
stat("-------------------{Else}--------------------")
stat("Hunger: [hunger]%")
stat("Thirst: [thirst]%")
if(src.AburameClan)
stat("Bugs: [KonchuuAmount]")
if(src.AkimichiClan)
stat("Food Calories: [calories]")
stat("Location:X [usr.x] Y [usr.y]")
stat("Gold: [GoldAmount]")
stat("Banked Gold: [GoldInStorage]")
stat("--------------------------------------")
In response to Jeff8500
Its just that, this NEVER caused lag before..it was something recent and we don't know what.

But I know that proc hasn't changed because I looked in my older source code and it matches letter for letter.
In response to DemonicK
Lolz.
So. you said that inside the Update() proc there was another call to it at the end but you removed it to see if getting rid of the looping would fix it. Well... you didn't stop it from looping.
Stat() is called many times per second, that is why you're having those lag problems. Take Update() out of stat, throw it into something like this
mob/New()
spawn(10) Update()
..()

then have update call itself once every second and you should be golden.

Also btw, I would use a central loop that goes over all the players in the world to handle the HUDs rather than a loop per person. Just me though.
In response to DemonicK
Those huge if()'s can't exactly be helping you, but nothing is terribly wrong there, besides your usr abuse and your use of the bitwise OR operator.

if(src.kunaiequipped|src.katanaequipped|src.samehadeequipped)


| is the bitwise OR operator. You're looking for ||, the Boolean or operator.
In response to Jeff8500
if()'s honestly are nothing to your processing power if they are simply doing comparisons.

If you code everything efficiently you can do thousands of math calculations and if() procs in a single tick without phasing the CPU. The only reason BYOND ever really sucks up resources is from inefficient programming creating memory leaks.
In response to AJX
He still wants to cut down on his CPU, and I'm telling him how.
In response to Jeff8500
Ok well no luck..I could have sworn it was the fact that he filled an entire z level (192x192) with objs...but that was not it because I changed all those objs to turfs and it persists...Im going to keep snooping around the code and let you know if anything comes up.
In response to DemonicK
Even after removing Update() from Stat() it still is lagging out?
In response to AJX
Yes, that didn't fix anything at all..The only thing I can think of at this point is too many mobs or objs on map..

But there isnt.

The AI isnt causing the lag, we disabled it and doesnt fix the extreme slowness.

And even better, my partner forgot to back up (by sending me the source) after the last update, so if we cant fix this source code (since mine is so outdated) the game dies.

Sure we could start over and code everything from scratch, but its big.. And if its something simple I really don't want to spend the next 2 weeks rebuilding it.
In response to DemonicK
Show us the two procs that are running when you run the world.
Page: 1 2