Legacy GM Any Collision Solution for Delta Time?


When using delta time my collisions fail, I have seen that they have spoken many times of this topic in the forum, but nobody has given solution to this, it is as if they said "You can do a game with delta Time" but when I ask for the collisions No one knows what to do, I think it's time to make this clear.

Any help is accepted!
 
When using delta time my collisions fail, I have seen that they have spoken many times of this topic in the forum, but nobody has given solution to this, it is as if they said "You can do a game with delta Time" but when I ask for the collisions No one knows what to do, I think it's time to make this clear.

Any help is accepted!
My solution may not be what you want because it's more expensive processing wise. You could use a while loop (repeats until you tell it to stop all within 1 frame) and check ever pixel to see if there's a collision and increase the number of checks based on how many pixels the player must travel to in the next frame to appear. If there is a collision end the loop and do the collision events. You may be able to reduce the amount of checks by checking every fourth of the size of the smallest object or tile that you collide with. If no collision is found stop checking, but if one is found only check only the range where there could be one.
 
My solution may not be what you want because it's more expensive processing wise. You could use a while loop (repeats until you tell it to stop all within 1 frame) and check ever pixel to see if there's a collision and increase the number of checks based on how many pixels the player must travel to in the next frame to appear. If there is a collision end the loop and do the collision events. You may be able to reduce the amount of checks by checking every fourth of the size of the smallest object or tile that you collide with. If no collision is found stop checking, but if one is found only check only the range where there could be one.
I also thought about that, but it would be heavy when in a game many things move.

I also thought about using collision_line returning the id of the first instance that collided, but it seems a rather awkward solution considering that a line would not cover the collision mask and could let the collision go by ...

Thanks for answering!
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
You don't need to do every pixel, but rather move the object in steps up to half of it's size (or it's whole size, if it's perfectly rectangular). This way it won't skip over obstacles.

For smaller/faster objects doing collision_line\collision_rectangle over movement region is also a viable tactic to quickly estimate if it should be hitting something.
 

zbox

Member
GMC Elder
Points for the picture hahaha

I see YA has already made note of this but really in practice my only real concern has been projectiles/bullets where I usually use a collision line between (pos) and (pos-previous).
 
You don't need to do every pixel, but rather move the object in steps up to half of it's size (or it's whole size, if it's perfectly rectangular). This way it won't skip over obstacles.

For smaller/faster objects doing collision_line\collision_rectangle over movement region is also a viable tactic to quickly estimate if it should be hitting something.
Do you use move to contact to do this, or do you just make sure the player moves at a speed to line up exactly with object placement and also have objects at the intervals?

eg. player moves 4 pixels per step objects 32 pixels wide every 32 pixels

What's your method here?
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Do you use move to contact to do this, or do you just make sure the player moves at a speed to line up exactly with object placement and also have objects at the intervals?

eg. player moves 4 pixels per step objects 32 pixels wide every 32 pixels

What's your method here?
If collision is detected at the next position, do the per-pixel movement loop until collision.
move_contact_ should work too, but I've found it to generally stop the object a pixel or two short of where it should, meaning that you'll need a loop to postfix it anyway.
 
If collision is detected at the next position, do the per-pixel movement loop until collision.
move_contact_ should work too, but I've found it to generally stop the object a pixel or two short of where it should, meaning that you'll need a loop to postfix it anyway.
Got it.
 
Top