ID:680532
 
Keywords: code, daemon, dream, game, help, host, lag, run
(See the best response by .screw.)
Code:
mob/var/frozen = 0
mob/var/speeding = 0

mob/PC/Move()

if(src.frozen)
return 0

if(src.wrapped)
return 0

if(src.donut_wrapped)
return 0

var/delay = src.speed
var/buku_speed = src.speed - 10

if(buku_speed < 0)
buku_speed = 0

if(src.speeding <= 10)
src.speeding = 10
..()
if(src.buku)
sleep((buku_speed))
src.speeding = 0
else
sleep(delay)
src.speeding = 0
else
return


Problem description:

In my game when i hosted it i never got lag, then i pwiped and when i rehosted it i got lag for some reason, and now it always lags, also when i open my game in dream maker and go to run, it also has the same exact lag, does this mean the problem is not "me" but something in the code?
This could actually be a number of things. The first to come to mind to me, since you just wiped out the files, would be that the game lags from having to recreate some files you already had before. This, however, is largely dependent on your games features.

The questions you should probably ask yourself first are the following.

What all am I saving?
How big are the save files?
What am I running now, that I wouldn't have been before the player wipe?

Although whatever the answers, chances are it's the code. Unless something has happened to your computer to slow it down, and thus slow down the games you host. The fact it does it in run also, though, makes it seem like something in your programming is causing lag. There are no players to cause it, after all.
Best response
Nourn wrote:
In my game when i hosted it i never got lag, then i pwiped and when i rehosted it i got lag for some reason, and now it always lags, also when i open my game in dream maker and go to run, it also has the same exact lag, does this mean the problem is not "me" but something in the code?

Inefficient programming is usually the cause for lag in BYOND games. Check to see if you have an infinite loop with little to no delay.
As an extension to .screw's comment, what you'd want to do is enable debug mode (in the options in Dream Maker), compile that, and then host it or play it yourself. Then open up the profiler under the options and messages box, and refresh a few times until you have a good amount of data.

The numbers measure CPU time taken in milliseconds, self-CPU being code that's directly in a proc or verb (but not ones it calls), total being all the things it calls also.
well, i tried hosting another game, no lag, so it must be code, also using clean compile wouldnt effect this, b/c i use to use regular compile but a friend told me clean compile is better, but also i know it cant be tht b/c ive used it before and it didnt make lag, but now i know it has to be code
also its a dbz game if tht helps, so is there anything u can think tht usually is a problem tht would cause lag? b/c now for a fact ik its the code, b/c i hosted other dbz games to test and they worked perfect no lag
In response to .screw
.screw wrote:
Inefficient programming is usually the cause for lag in BYOND games. Check to see if you have an infinite loop with little to no delay.


You may want to read the above again.

It's obvious you have just downloaded a source...

Try reading the DM Guide
dude, no, my game has been up for almost 3 years now, and im a alright coder, not the best, also i opened up options and messgaes and got this - Welcome BYOND! (4.0 Public Version 493.1117)
Logging in...connected
Logged in as Nourn.
Connecting to byond://127.0.0.1:1996...connected
Setting network delay to 0.

main thing i want to point out was the setting network delay thing, also this is making me lose players, also this has never happened before and i dont know wht code would cause this
In response to Nourn
Nourn wrote:
dude, no, my game has been up for almost 3 years now, and im a alright coder

You can hardly spell I doubt you can code since you are using a source "DBZ" sources have been available for ages now over 7 - 8 years.

I would do as they suggested.. Look for an infinite loop...
well, this isn't a place where correct spelling is a big deal, also, what do you mean infinte loop? because like i said im not that good of a coder
In response to Nourn
Nourn wrote:
well, this isn't a place where correct spelling is a big deal, also, what do you mean infinte loop? because like i said im not that good of a coder

An infinite loop is exactly how it sounds: an endless loop. Try reviewing your for() and while() loops. If you are using goto, make sure everything is functioning properly.

More importantly, try what Stephen suggested. You will easily find the source to your problem with that method.
alright ive done wht stephen has said, and got the data, but what am i suppose to be looking for?
also, the highest real time was 10 seconds on move, which is the thing that lags, others were like 1 sec to . something, so imma check move code, but i havent messed with that
also i only moved only a few steps
i also edited my first comment and showed to movement code
well i found the problem, i added a new map, i had my mapper redo map and when he sent back to me i added it, so new map file, so i still dont undertsand why tht would cause tht problem