ID:1782101
 
(See the best response by Lummox JR.)
Code:


Problem description:
I don't think its anything specific about my code but the way I skip steps.

1. is making objects through the map unefficent? like instead of having turf/grass and turf/dirt all of my turfs currently are under turf/grass and edited in the map to be different icon_states to speed things up.

2. can causing enemies to have player only procs and variables be very inefficient? I know its bad but could it cause lag? How bad could it make it


3.for art files is it better to have multiple files or all my turfs in one file or does it matter?

4. to test my brother used a computer on the same network I was hosting. Could that cause lag for him just alone?

If its none of those I guess it was just my network speed, I clocked it and it was much slower than supposed to be 2/mbs and its supposed to be 25/mbs
1. No do it how you like.

2. Sometimes depends what procs.

3. Yes this can be important while loading if you have only 1 Icon with all turfs in it, it can make it go slower I think.(I mean like 100+ Icon stats)

4. Hellz to the no the more close you are to who ever is hosting it the less lag you should have.

some tips:
Make world/fps = 30-60,
make a good pixel movement system or tiled based system(There are few libs already good ones, just find them)
Use #define DEBUG which will help you find out what procs cause lag by press F1=Server=Profile. Then Optimize those procs
How is increasing fps supposed to help someone who's having problems with lag? Most likely induced by poor programming practice considering there is lag while testing on their home network.
Thats fine they are just tips :P
If your game lags when running locally, I recommend you enable the debug directive like Zasif suggested. Start the world up and start profiling. That'll give you a place to start.
In response to Lavitiz
The problem is tha their is lag even while no coding is happening. For example just standing still or moving. And moving is 1 line of code. AI only starts when you attack, and no other process are really happening
In response to Lavitiz
And 2 is for procs and variables the AI never has to used. They just have it cause it's under mob tree. I'm guessing that would cause more memory usage as mobs would have a bunch of variables and definitions they don't need but are using space to have them?
If you play by yourself without hosting is the lag happening aswell?
That doesn't explain where this lag is coming from. Do you have a dated machine? Are you sure nothing is being spawned off when the world is starting? Any loops?
None of the concerns you mentioned would cause network lag. A lot of it comes from proc calling and resources that are not cached. Connecting to a computer on your LAN won't gove you any network lag network packets would never leave the house.

As Lavitiz suggested, using the Profiler cam help you understand which procs are computing the most CPU, which in turn can be responsible for your network lag.

If your clients are in an entirely different country than you, you will always have network lag no matter how much you optimize.
In response to Zasif
no zero lag, on host computer as well whether online or offline. but both of my other computers i use to test lag.

average over 10 seconds
so i did the test SELF CPU:0.000 TOTAL CPU: 0.0000 REAL TIME: 0.08(with combined procs id been using)
What is lagging exactly? It would definitely help to know what is going on with the project to better troubleshoot your issue.
In response to Mr_Goober
when a non host is playing, at random moments it will freeze his character will than after a short time appear in the spot he should be in. Sometimes it ocurrs often with 1-2 seconds intervals of lag. It also happens at random moments not when specific actions are preformed
In response to Mr_Goober
or you mean the code. I guess its too large, maybe ill eventually find something or figure out why im having these problems
Best response
DanteVFenris wrote:
1. is making objects through the map unefficent? like instead of having turf/grass and turf/dirt all of my turfs currently are under turf/grass and edited in the map to be different icon_states to speed things up.

This probably doesn't make much difference one way or another. Complex maps do take more time to load, but then the objects and such have to come from somewhere, right? Plus it's only a one-time cost per session.

2. can causing enemies to have player only procs and variables be very inefficient? I know its bad but could it cause lag? How bad could it make it

Merely having those procs and vars can't hurt anything. If procs are being called or vars altered for no reason, that would be an issue.

One caveat: If you have a var like a list that's defined with brackets (e.g., var/mylist[0]), which initializes it, or if the list is otherwise initialized like var/mylist=list(1,2,3) or var/mylist=new, then this is an efficiency problem for sure. Never initialize a list until you need it.

If for instance you had such a list initialized for every turf, not only are you wasting memory, but when the turf is created, the list will be too. That impacts map loading.

3.for art files is it better to have multiple files or all my turfs in one file or does it matter?

Mix it up. Having a zillion tiny icon files makes resource loading a little bit longer, but it is nicer to both DS and the webclient. Having all your states in one file--like hundreds of them--is inefficient for both DS and the webclient. So my recommendation is to aim for a few states per file, nothing drastic. One common thing I see is for all turf icons in a cave theme to be in the same file, for instance. All house furniture might be one icon file.

4. to test my brother used a computer on the same network I was hosting. Could that cause lag for him just alone?

If you were hosting in DS and he played over the network, yes, that would make sense. The lag should be fairly low over your local network, though. The slower speed you measured could be the culprit for him.
In response to Lummox JR
so if we both had a 1.75mbsdownload/upload is that bad between two people? should my project be more efficient than that? I just don't know what the problem. I have a very early version that is saved on a usb. I know that had no lag so ill boot that up and see if hes experienceing lag still. If he is well than its probably a nice new virus i've inheirted from that time.
Definitely run a thorough AV scan. I recommend Malwarebytes and Avast, both of which are free.
I like Malwarebytes the best :X
okay ill try malwarebytes, ive been using macafee and ive heard bad things about them. not scetchy bad but just that they are medicore
Also maybe this will help aswell, completly uninstall and delete all byond files and reinstall it back again.
Page: 1 2