Unbelievably bad collisions with small objects?

Get help using Construct 2

Post » Sun Apr 15, 2012 8:39 am

Ive been usin the platform physics for a few weeks now with little to no problems. Today Ive started usin it with smaller objects and now its hardly working.

Each block is 8x8 and the player is roughly 6x11 with no animations or anything its strictly a collision object. Each block has its collision poly set to the full sprite a solid 8x8 square.

The player uses no custom controls just the platform behavior with Default controls set to on.

The collision polys Ive tried with a flat bottom Ive tried with a point bottom nothin helps. The origin is in the middle bottom

Almost always when I jump the player goes 2-3 pixels into the floor and the top of it never hits the blocks above it it always stops a few pixels early. It seems I can walk to the left ok but do good to walk to the right at all and slopes goin up or down to the right it wont even attempt.

I should mention that almost every block in the layout has been stretched to make platforms so rarely is the 8x8 object still 8x8 in use.

It also almost 100% of the time gets stuck on the right edge of a block and wont fall. I can also walk off a block and push into it goin right as I fall and get completely stuck in it.

So my question is: is this because the objects are small or is there somethin Im missin? Ive been usin all the same sprites (same art different projects) at a larger scale for weeks (4x exactly... each block is 32x32) and its work without a hitch. Again each block has been stretched to make different width/height platforms.

Im stumped so far. Ive reimported (even tried different) graphics and redone collision polys and changed scalings nothings helped. I cant go with a bigger overall size in this project right now cause literally everything is designed around the size it is right now
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Sun Apr 15, 2012 9:37 am

Sounds like an interesting problem, have you tried to reduce the project to a base (just with the movement controls) to make sure its not coding related?

Providing a Cap.x will get you help quicker (I know this from experience, lol).
ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Post » Sun Apr 15, 2012 9:55 am

I found out after some painful trial and error it is indeed the size. I went thru all my events for sizing the blocks to make platforms (the levels are randomly generated) and added a configurable globalscale global.

So now everything thats created is scaled by that global var including the player. With no changes to any objects from my first post Ive tested scales upto x6 (48x48 blocks) and the bigger everything gets the better and more smooth the collisions.

x1 - Same issues as my first post
x2 - Dont get stuck on the right side edges of blocks but still cant walk up slopes to the right
x3 - Everything works but moves faster goin up/down slopes to the left
x4 - Same as x3 but smoother
x6 - VAST improvement in smoothness of movement and collision response. Still goes too fast up/down slopes but now its the same speed goin left or right so its no where near as badly noticeable

The next issue now its gonna be how my unresized graphics are gonna look scaled up x6 Q__Qaridale2012-04-15 09:57:25
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Sun Apr 15, 2012 12:20 pm

Can you post a .capx showing the problem?

The problem with small objects, especially at low framerates, is often they can simply step entirely past a barrier. For example an object travelling at 600 pixels/sec at 30 fps is travelling 20 px per frame. If it is only 5x5, it's actually "teleporting" in steps 4 times bigger than itself every frame, and this means it could entirely jump over another 5x5 object without registering a collision.

However, this is no reason for objects to be floating above other objects, so a .capx would be useful.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sun Apr 15, 2012 1:19 pm

This sounds a lot like the issue I brought up yonks ago, where sprites would be misaligned on the x and/or y axis when using extremely lo-res assets and a small window size: ie. A 8x16 sprite in a 320x240 window, when scaling to fullscreen mode, you could clearly see the sprite overlapping parts of the world it shouldn't be.

It even affected detection of the wall (ie. It sometimes became impossible to detect when the player was touching a wall) breaking some of the gameplay.

From memory, the response back then was that it couldn't really be fixed (easily) and I got the impression that it wouldn't be. I'd be curious to see if there's interest to look into this problem again.
B
28
S
7
G
7
Posts: 102
Reputation: 6,483

Post » Mon Apr 16, 2012 12:14 am

this is what I noticed (8x8px sprites):



if you wanna use such small sprites I guess you must make your custom movement/collision detection - check for overlapping in advance and calculate position in which object must be to prevent penetration when actual overlaping happens...
B
12
S
2
G
2
Posts: 96
Reputation: 1,583

Post » Mon Apr 16, 2012 3:24 am

yeah I dont have an example capx because its all built into a project that hugely over complicates it. podpathos explains it quite well tho
B
13
S
5
G
2
Posts: 306
Reputation: 3,262

Post » Mon Apr 16, 2012 3:34 am

For the time being... (Assuming collision tile hotspot is at the top left)

To fix player falling into / hovering over the ground a pixel or two
+Player is on floor
+Overlaps Collision Tile
-Set Player.Y to Tile.y

To fix wonky left & right wall collisions
+Player overlaps Tile
+Player has wall to right
+Player is not mirrored
-Set Player.X to Tile.X

+Player overlaps Tile
+Player has wall to left
+Player is mirrored
-Set Player.X to Tile.X+Tile.Width

These might fix some of those other problems too.Tokinsom2012-04-16 04:03:19
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Mon Apr 16, 2012 4:00 am

[QUOTE=Ashley] Can you post a .capx showing the problem?

The problem with small objects, especially at low framerates, is often they can simply step entirely past a barrier. For example an object travelling at 600 pixels/sec at 30 fps is travelling 20 px per frame. If it is only 5x5, it's actually "teleporting" in steps 4 times bigger than itself every frame, and this means it could entirely jump over another 5x5 object without registering a collision.

However, this is no reason for objects to be floating above other objects, so a .capx would be useful.[/QUOTE]

I might just be talking out of my ass here but what about using loops for pixel-perfect or instant-hit bullets? Could something similar be applied for the platform behavior's collision detection?

Here's an example I whipped up.Tokinsom2012-04-16 04:02:27
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, DemantDigitalArt, Unconnected and 34 guests