ID:114204
 
BYOND Version:485
Operating System:Windows XP Pro
Web Browser:Opera 9.80
Applies to:Dream Seeker
Status: Unverified

Thus far we've been unable to verify or reproduce this bug. Or, it has been observed but it cannot be triggered with a reliable test case. You can help us out by editing your report or adding a comment with more information.
Descriptive Problem Summary:

It seems similar to this BYOND bug.

I'm working on a sidescroller and it has a small HUD, maybe 10-15 objects. The presence of the HUD causes the game to be a little bit choppy. The screen objects aren't being updated, just moving around while having them on the screen makes movement choppier. I could believe that a complex HUD might cause this, but this is only a few objects.

I haven't had time to narrow down the problem. Though, unlike the BYOND bug I linked to, I don't think that the client's pixel offset is being set multiple times per tick here. I do seem to notice the lag more when the player is moving in the x and y directions, maybe updating client.pixel_x then client.pixel_y is causing the same problem that was observed when updating client.pixel_y twice.

Is there anything about the handling of screen objects that I should know to help figure out what the problem is? I'd rather not waste time making a lot of uneducated guesses.

Numbered Steps to Reproduce Problem:

Code Snippet (if applicable) to Reproduce Problem:


Expected Results:

Actual Results:

Does the problem occur:
Every time? Or how often?
In other games?
In other user accounts?
On other computers?

When does the problem NOT occur?

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Workarounds:
Use images and attach them to invisible objects that move every time the player's display moves.
I cranked up the framerate to make the problem more noticeable and it certainly appears to be caused by changing the client's pixel offset.

The player can move up to 32 pixels from the center of the view before the camera will scroll to follow the player. This means there's a little space you can walk back and forth in that won't cause the camera to move. When moving back and forth in this space the framerate is good. As soon as I move outside the space and the camera needs to scroll, the framerate drops significantly.

Initially I figured there was just something inefficient about how screen objects are drawn that can't cause detectable problems with a lower framerate. But because it only happens when the screen moves, I'm not sure what the problem could be.
I had an idea that it might be related to updating screen objects. I noticed in the demo I had posted for the other BYOND bug, when I held the key to add screen objects it would slowdown considerably (as it was adding more and more screen objects), but when I released the key the framerate would go back up (even though all the screen objects stayed on the screen).

However, with the problem I've run into now, the screen objects aren't being updated and objects aren't being added or removed from client.screen.
I've also noticed that they're still causing lag. It even froze my screen till it was done.
Any ideas about this? I'd think that screen objects are just handled inefficiently, but it seems fine as long as the screen isn't scrolling. When using images to create an identical visual effect the performance doesn't suffer (even when the screen scrolls). It seems like there's something wrong with screen objects.
I have no clue here. Scrolling doesn't really impact screen objects, since they don't use the client offset that the map does, but it also doesn't trigger any additional parsing or anything like that.

There is some code that could be relevant, but it's so unlikely to cause an issue (especially with small HUDs) it seems ridiculous as a culprit. The code in question overrides "unlit" tiles wherever a HUD object is present. It does have some divisions but these are generally kept to a minimum. In order for this to even be noticeable, the client would already have to be operating near the stress point.
I'm not sure if I can isolate this into a small and simple demo. I'm also not sure if I can capture this in video because the video quality tends to make everything look bad so you'd never tell where the problem is.

I found a workaround so I'm not as concerned, but I'd still like to figure out what the problem is.
I tried to come up with a demo to reproduce this and I think I came up with essentially the same thing as the demo for the other BYOND bug. The only difference is that the client's pixel offset isn't being set multiple times per tick here.

http://files.byondhome.com/Forumaccount/ screen-object-demo_src.zip

When you run the demo the mob will move smoothly in circles. When you press up the camera will be offset and the motion will be choppy. It'll move smoothly for about 1/8th of the way around the circle, then it'll get choppy, then smooth again, etc.

In the mob's Login proc screen objects are created. If you comment this bit out and run it again, the motion is smooth the whole time whether the camera is offset or not. It doesn't appear to matter how many screen objects are present. It happens if any are there and doesn't happen when none are there, but the magnitude of the slowdown doesn't really change whether there are 1 or 400.

I'll try to get a video of this but I'm not sure how noticeable it'll be in a video.
Edit: I can't get a video with a good enough framerate that you can notice the slowdown.

Edit2: The nature of the lag seems to change as you change the value of offset. With an offset of 9 the motion will lag at the left and right parts of the circular path but be smooth in the middle. I'll see if I can use this to help get a better video.