Unbelievably bad collisions with small objects?

0 favourites
  • 9 posts
From the Asset Store
********* Bad snowman enemy game character ********
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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).

  • 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__Q

  • 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.

  • 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.

  • this is what I noticed (8x8px sprites):

    <img src="http://dl.dropbox.com/u/37009800/Construct%202/Help%20Others/Collsion%20small%20object%20problem/PLATFORM.jpg" border="0" />

    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...

  • 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

  • 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.

  • 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.

    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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)