Problem description:My Game Naruto Supreme Chaos has been experiencing many server crashes and lag spikes very often in the past 2 days. I don't know what is causing it, I don't know if something i coded is causing it but i don't think it is. I'm not getting run time errors so I'm confused if its a ddos or maybe the host or something?? |
Oct 14 2013, 7:53 am
|
|
Compile the game in debug mode, get the host to run it up and open the profile window. Wait 30 minutes, then give us a screenshot of that profile window, made as big as they can.
|
hmm well its already in debug mode, so now what do I do? Also the game is up right now so I guess step 1 and 2 are done... So now I just wait 30 minutes then??
|
And the lag usually comes when I am around other Players and especially around the host, I have also kept the game up for a while now and lag didnt return cuz i imporved my lag guard but sometimes it comes back when im walking around or going to npc/players and it spikes to much
|
As I said, you need to open the profile window, under the server menu. It will collect information on what is running, how much CPU it takes etc.
|
how, i dont know how to open it can u tell me? (im going afk right now so ill do it when i get back)
|
As you can hopefully see here, I am hosting in DreamSeeker, and have clicked on the atom in the top left, which shows me a menu. Under server, you will see profile. Clicking on that, gives me the following. As procedures are called in the world, this is populated with their details. Makes that window nice and big, then give us a screenshot of it after 30 minutes or so of people playing on your server. |
this is the screen shot http://i42.tinypic.com/4zuqm9.jpg
|
Can you sort it by total CPU? Just click on total CPU, until the biggest numbers are at the top.
|
ok, i restarted the server by accident, so hmm ill post a new screen shot in a few minutes with the sorted usage
|
ok, so i hosted for a few minutes (no more then 7 minutes) cant remember the time but this is the screen shot http://i41.tinypic.com/2im3q04.jpg
|
Seems like your AI might be your killer.
A common malpractice when implementing AI into games is to initialize their behaviors/target acquiring/etc. when they are constructed in New(). This becomes extremely wasteful when you have a world populated by several hundreds, if not thousands of AIs sprinkled about. Best way to do it is simply to gradually check hearers(mob, dist) every time a player moves around, and check for inactive npcs to activate. Once they're active you can disengage them by checking for nearby players every few AI increments or what have you. |
well when i posted the new screen shot it was JUST ME hosting and no one else joined and after 5- 7 minutes i posed it
|
Ya i also think it is my A.I because they usually do stuff they aren't intended to...
|
In response to Naruto 5292
|
|
That's definitely your problem, then. Read what I posted and try to make your AI state-oriented (active, inactive...).
|
While that's definitely a good thing, that doesn't quite explain why the lag seen was worst with a number of players on.
And the lag usually comes when I am around other Players and especially around the host, I have also kept the game up for a while now and lag didnt return cuz i imporved my lag guard but sometimes it comes back when im walking around or going to npc/players and it spikes to much |