I rewrote some assembler code I did 10 years ago in C and my collision detection got better but I still have some edge case that I need to figure out. I know without the code it is hard to guess but since the C code and the code that retrieve the metatile data (still in asm) is spread a little bit and mangled with other part of the view, it would be too complicated and long to paste all the code. I will just explain the symptom in the hope to either found the cause or being suggested better way to do it.
For example, let say the actor is walking right then jump on an edge and ends almost on the corner of that edge. The actor ends up inside the block and then gets ejected to the left even though it should have landed on the corner. I usually checks vertical ejection first then sideways so you see it gets pushed up then left. I didn't have time to debug and check the why yet.
Another similar case is let set you are close to an edge when walking right then you quickly go left/right. The actors start to fall because it was too close but for some reason gets ejected hard like if it ended up deeper into the block or something, jerking the camera along with it. I'm not sure if it's the quick movement that cause an issue with the code that checks the location and cause it to be pushed harder than expected. I would expect to slide on the side of the surface, so there must be something going on with the quick movement.
When just colliding with a wall left/right on ending up on a surface while jumping, the ejection is done and not noticeable. Maybe I should try to capture some animated gif that would should the current symptom.
Are those common issue with collision or maybe it is just my code that is still erratic at this point?
edit:
Included an animated gif of one of the bug. The more I look at it, the more I think that it's like the detection ends in the second metatile from the left somehow and it get pushed hard from the second block.
falling_from_edge.gif [ 715.92 KiB | Viewed 2893 times ]
P.s. Since I didn't write code for 10 years I do not have any new assets so I'm just continuing an engine with my old code/assets. It doesn't means anything about "that" project. It is very useful than restarting something from scratch when you're not an artist.
For example, let say the actor is walking right then jump on an edge and ends almost on the corner of that edge. The actor ends up inside the block and then gets ejected to the left even though it should have landed on the corner. I usually checks vertical ejection first then sideways so you see it gets pushed up then left. I didn't have time to debug and check the why yet.
Another similar case is let set you are close to an edge when walking right then you quickly go left/right. The actors start to fall because it was too close but for some reason gets ejected hard like if it ended up deeper into the block or something, jerking the camera along with it. I'm not sure if it's the quick movement that cause an issue with the code that checks the location and cause it to be pushed harder than expected. I would expect to slide on the side of the surface, so there must be something going on with the quick movement.
When just colliding with a wall left/right on ending up on a surface while jumping, the ejection is done and not noticeable. Maybe I should try to capture some animated gif that would should the current symptom.
Are those common issue with collision or maybe it is just my code that is still erratic at this point?
edit:
Included an animated gif of one of the bug. The more I look at it, the more I think that it's like the detection ends in the second metatile from the left somehow and it get pushed hard from the second block.
Attachment:
falling_from_edge.gif [ 715.92 KiB | Viewed 2893 times ]
P.s. Since I didn't write code for 10 years I do not have any new assets so I'm just continuing an engine with my old code/assets. It doesn't means anything about "that" project. It is very useful than restarting something from scratch when you're not an artist.