Pin behavior position lag

Bugs will be moved here once resolved.

Post » Thu Feb 16, 2012 4:46 pm

I'm using a pin behavior in some sprites that are pinned to one sprite that is moved by a touch plugin in a simple manner:
[code]is touching object? -> sprite: set position to Touch.X, Touch.Y[/code]
the problem is, that the pinned objects are having sime kind of one frame lag (reminds me of a sprite->destroy bug), it looks like all pinned objects' positions are updated after frame draw on a following basis:
[code]run behaviors (set pinned objects' positions)
run events (move the sprite that other sprites are pinned to)
draw canvas[/code]
in theory if you have an object FOO pinned to other object BAR that is pinned to some other object XYZ, when the XYZ object is moved, the BAR and FOO should always have XYZ's position. instead right now they have a lag of 1 frame for BAR and 2 frames for FOO. (and so on if you have more objects). this is not much of a problem on a 60fps computer screen, but on a mobile fon with fast moving objects it becomes visible and annoying.

capx: http://www.mediafire.com/?wnshcwfanv1sci9

I would much appreciate if this could be fixed :) thanks!ranma2012-02-16 16:47:03
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Thu Feb 16, 2012 5:36 pm

I would not download from mediafire because there have many adds, suggestion, host your files on dropbox.

Please, feel free to see my game and download his .capx from here, where I added many objects pinned to the player gadget and I didn't noticed any lag. Maybe is the phone hardware who can't keep all the math without delay, or, something else, but I believe you can figure out looking inside SandBOX code to make sure the first issue is not true.
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,192
Reputation: 18,301

Post » Thu Feb 16, 2012 6:25 pm

they have ads, but a big green download button, also uploading is just dragging files to a browser window without installing any programs like dropbox, that's why i preffer mediafire and that is the main reason why I uninstalled dropbox actually. now back to the topic, in your code all the pinned object move so slow that you are not able to see any lag. if you actually downloaded my capx and tried it you would see the lag clearly :) cheers.
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Thu Feb 16, 2012 6:30 pm

...don't need to install dropbox program to use dropbox, just saying ;)
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Thu Feb 16, 2012 6:34 pm

[QUOTE=ranma] they have ads, but a big green download button, also uploading is just dragging files to a browser window without installing any programs like dropbox, that's why i preffer mediafire and that is the main reason why I uninstalled dropbox actually. now back to the topic, in your code all the pinned object move so slow that you are not able to see any lag. if you actually downloaded my capx and tried it you would see the lag clearly :) cheers.[/QUOTE]

Even falling?

In my job any advertisement block the entire site, and mediafire is one of the black listed here, so, sorry, I can't download anyway.
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,192
Reputation: 18,301

Post » Thu Feb 16, 2012 6:45 pm

[QUOTE=shinkan] ...don't need to install dropbox program to use dropbox, just saying ;)[/QUOTE]

didn't know that :) I will check it. in the meantime, maybe someone who's actually interested in the bug itself and not finding the best hosting options would see this? ;)
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Thu Feb 16, 2012 9:18 pm

I'm at my house now.

Confirmed, I did a new sample and checked the offset:
http://dl.dropbox.com/u/47035927/temp/pin%20behavior%20bug.capx

This happen on objects sub pinned on another pinned object interacting with the input cursor.
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,192
Reputation: 18,301

Post » Thu Feb 16, 2012 11:13 pm

great, thanks! for all interested, the only thing you can do is actually pin all the objects to the first sprite that is moved, and I want to correct myself, indeed, the FIRST pinned objects doesn't seem to have a lag, the second and so on, does.
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sat Feb 18, 2012 5:41 pm

also, when you have some behavior that moves object and make an event to scroll to this object every tick, there's somewhat similar one frame lag, the object moves some pixels by behavior, then the frame is drawn, then the screen is scrolled to the position, then object moves, then next draw occurs.
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Mon Feb 20, 2012 10:25 pm

I'm afraid I don't think this can be fixed: the Pin behavior is already coded to run *after* the events so it gets the latest position of the object. As you can see from this modified example there is no lag at all if you only use a single pin:

http://dl.dropbox.com/u/15217362/nopinlag.capx

The problem comes from using two behaviors at once. Construct 2 does not run behaviors in any particular order. So in this case the pin behaviors run in the wrong order and the second pin updates before the first, so it is always one frame behind. I don't think there's any good fix for this - it's how the engine has always worked. It's easy to workaround with events though, the Pin behavior is pretty simple. I'm afraid this appears to be the only solution. If you do it all by events you have exact control over the order it happens in, anyway.Ashley2012-02-20 22:25:33
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 5 guests