My game is still in the alpha stages so it doesn't have much code. It's got all the basic functions of an RPG but most of those functions aren't even implimented yet.
So, when I log in and walk around, it doesn't go one whole minute before I get a 5 to 15 second lag spike. About every 40 seconds I'll get another lag spike. Not only does this effect the game, it's also effecting the Dream Daemon itself. When I go to the players tab or any other tab, or when I minimize it, sometimes it lags a lot. It lasts about as long as it does in-game.
My computer is more than sufficiant to host even the most demanding Byond game, so specs aren't the issue. I'm thinking maybe I set something up wrong or maybe there's an internet setting I should change. I tried disabling my anti-virus so it's not that.
Any help would be much appreciated. My game is an ORPG so the server is always online if you'd like to see what I'm talking about.
If it does it when running the game locally, try profiling your game to see if anything is taking a ridiculous amount of CPU time.
|
It runs great when running locally. When running the server, it never uses more than 2% of my CPU. The code is very clean. There's only one map and every area of the game is on that one map. That doesn't say much though, since there's hardly anything to the game at this point.
I've been playing a lot of Crysis 2 lately (great game btw) and it runs at 60 FPS (synced, could go higher) on max settings so I very highly doubt the lag is due to a lack of sufficient processing power. |
So when Dream Daemon "freezes", the CPU levels are normal? Did you try profiling just to see if anything stood out?
If you're not maxing out your CPU (and keep in mind that BYOND can only use one of your processor's cores), then that probably means it's a network issue. Are you hosting the server on the same machine, on the same local network, or is it remote? If you have it host a separate, very basic project, does it exhibit the same symptoms? |
Thanks for the replies guys.
I'm not getting any errors. Below is the profile after running the server for about 10 minutes and refreshing the profile approximately 10 times. I'm hosting on the same machine that I'm playing on, so network lag shouldn't be an issue unless there's a problem with my router or something (with oddly only effects Byond). Profile results (total time) |
Here's the top few lines after a few more minutes.
Profile results (total time) |
and a few more minutes.
Profile results (total time) |
I'm no expert on these things, but I do know it takes well over 10 minutes for any proc in my game to reach 1.000 Total or self CPU. And I really didn't think my game was all that CPU friendly so far.
My Real Time for procs takes forever to go above 1 as well |
Ah, thanks. I was told by one of the previous devs that the AI system would need to be replaced and I suppose he wasn't kidding. I didn't know what to think of the high numbers cause I didn't even know what was high or not.
Anywho, case closed. It's the AI system. Thanks again guys. |
I assume these two are part of the AI system?
/mob/Move 1.989 40.921 4645.064 77348 Any NPC should lay dormant until they sense a player nearby. We can't have 1000 NPC's moving constantly now can we? :) |
Yeah those two are part of the AI system. They control turn-based mob movement, unique to this game. It's weird that they use so much CPU yet they actually use hardly any. I mean, opening up task manager to check it uses more than the server does.
Buuut now that I know what the problem is I can fix it. Or replace the mob spawn system. Idk, either way it'll work eventually. |
Sorting the profiler by Self CPU is usually most helpful. Also, use world.cpu to check for meaningful usage. The BYOND engine maxes out far sooner than the physical system gets anywhere near being stressed.
Also, as ATHK pointed out, UpdateTurnController is using a ridiculous amount of CPU compared to anything else, and the real time of /Move would make me think that there was some type of infinite loop there, or long sleep(s), perhaps. A.T.H.K wrote: We can't have 1000 NPC's moving constantly now can we? :)Sure we can, we just can't have them doing complex things like searching for targets or path finding =P The issue isn't really that you can't do that, but that doing so is usually a waste of power. No point in having 1,000 NPCs wandering around if they're 10 miles away from any player and have no real purpose. |
In response to Falacy
|
|
Falacy wrote:
Sure we can, we just can't have them doing complex things like searching for targets or path finding =P :) That was my point I just didn't explain it so well! |
A. Poor programming habits or an obscenely large/populated map.
B. Your system isn't a strong as you think.
I'm partial towards A, though. No offense!