Download Construct 2 release 35

Discussion and feedback on Construct 2

Post » Tue May 17, 2011 8:19 pm

i see the 1 pixel 'gap' too, but only on the first platform. on every other platform it seems fine.

reason?
B
50
S
17
G
15
Posts: 1,029
Reputation: 26,289

Post » Tue May 17, 2011 10:02 pm

I don't see a pixel gap on Chrome, but I see it on IE9. I think it's because of floating point positioning and scrolling. It depends on whether the browser can draw images at floating point coordinates or not (Chrome doesn't, IE9 does, it seems).

It's a bit of a tricky one to get it absolutely pixel perfect, but I'll look in to it for a future build. For practical games it shouldn't be much of an issue anyway - the standard practice is to use an invisible square for movement and collisions, with an animated sprite positioned on top.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed May 18, 2011 7:14 am

I have a gap on Chrome, but that could be because I'm using portable 10.0.648.204. I'll download the latest build and see.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Wed May 18, 2011 8:11 am

I just tried in Classic, and its platform movement has the same bug. Nobody seemed to notice it there...! It's only ever a gap of less than a pixel.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed May 18, 2011 12:41 pm

on chrome, at home, i see it only on the first platform, and it is good on the others. on firefox4, at work, it has the 1px gap on all the platforms.

if that helps.
B
50
S
17
G
15
Posts: 1,029
Reputation: 26,289

Post » Wed May 18, 2011 3:34 pm

[quote="Ashley":1hfcqs0h]I just tried in Classic, and its platform movement has the same bug. Nobody seemed to notice it there...! It's only ever a gap of less than a pixel.[/quote:1hfcqs0h]

What? I don't see any gap in Classic :shock:

That was a problem several builds ago, but Davo fixed it. Unless it's happening on some graphics cards and not others...
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed May 18, 2011 4:44 pm

When I insert a platform onto a layout it either places it at integer values or x.5 (i.e., Position: 304, 180.5). Could that have something to do with it?
B
5
S
2
G
4
Posts: 14
Reputation: 2,422

Post » Wed May 18, 2011 5:13 pm

The "pixel float" problem is this:
- the editor places objects at integer coordinates by default
- objects have a centred hot spot by default
- objects with an odd width or height therefore actually end on a half-pixel
- the platform movement push-out algorithm only works to the nearest whole pixel
This is the same in both Classic and C2.

For example a 15x15 solid block placed at (50, 50) with a centred hotspot actually extends from (42.5, 42.5) to (57.5, 57.5). That's exactly what you asked for, it's just the math means its edges land midway between pixels.

The way the platform movement works is like this: when you are falling, you are actually teleporting small distances every tick. When you land on a solid, at first the object doesn't land perfectly on top - it ends up lodged some way inside a solid. The platform movement notices this and starts what's called a 'push-out': it moves the object up one pixel at a time until it's no longer overlapping a solid. Now the player has landed perfectly on top of the solid, but to the nearest pixel.

This means the platform movement floats only half a pixel above solid objects with a centred hotspot and an odd number for height.

Then, it's the whim of the renderer how this is displayed: it may round it one way, and there is no gap. It may round it the other way, and there's a whole pixel gap. It may support sub-pixel rendering, which results in a gap which is a 50% blend of the background and the floor colour, which still looks like a gap, but fainter.

In short, everything is working correctly, but the results are not always consistent or intuitive.

As I said it's the same way in Construct Classic. It seems pretty minor so I'm tempted to let it go - the solution is pretty tough as well, considering you can floating-point position objects to be, say, 0.117 of the way between two pixels. Getting the push-out algorithm to detect this exactly is tough. It seems better to say it will land you within 1 pixel of the floor. It seems to have done the job OK in Classic. Does that sound OK? Has anyone actually had real problems with the sub-pixel float in games they've made in Classic?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed May 18, 2011 5:44 pm

I thought in CC upon pressing 5 would place the hotspot at the closest integer pixel to the center, not placing it at a subpixel?

Since C2 has no hotspots yet and I assume is mathematically calculating the center, perhaps simply round that number then?
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Wed May 18, 2011 8:11 pm

That would be a possible solution, yeah. Not sure that Classic does that though because I did seem to be able to reproduce the issue. I think the nearest-pixel-hotspot would be good for C2 if Classic doesn't.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests