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?
ID:159826
![]() Jan 7 2009, 11:49 am
|
|
![]() Jan 7 2009, 11:53 am
|
|
An infinite loop.
|
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. |
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. |
The spawn() is probably your problem >_>. spawn() + for()/while() = lag. You need to sleep, not spawn, in your loops.
|
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. |
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?
|
mob 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. |
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 |
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. |
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. |
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. |
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. |
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.
|
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. |