I am hosting my game Hunter X Hunter Online using BYONDPanel but its very laggy to everyone. What can I do about it?
|
I added that code and it keeps growing and growing. Its over 200 now and still growing. I think its the code. What should I do now?
|
TheDarkChakra wrote:
I added that code and it keeps growing and growing. Its over 200 now and still growing. I think its the code. What should I do now? Ok, so that equates to your world.cpu hitting 200% at times which means your code is trying to process so much in a single tick that its taking longer than the tick length to do it, hence, lag or slow down. You need to optimize / improve your code so that it runs better and doesn't take so long to process each tick. If you compile your project into DEBUG mode, you can run a server profiler while the game is running. That's accessible in the Options and Messages window by pressing F1. Once you've got profiler open, you "refresh" to get a "snapshot" of proc and their stats (how many times they've been called, and how long each call took). If you check the "average" option and then you sort by Self CPU you'll see the longest to shortest proc times. The longer proc times are the areas you'll want to start optimizing first. |
If its over 80, your code is bad (or your machine's cpu is too old).
If it isn't over 80, you or your server probably has a slow up-link connection to the internet. Go to speedtest.net and run a speed test to the same state as one of your players, observe your up-speed. If it is low (like below 5) you probably should be hosting from a server and not a home machine.
Home machines have a hard time doing a lot of routes because most home machines are in a neighbor hood. Hosting server providers (such as AWS / EC2 machines) have connections to back bones where routes are easy to do.