During the development of the game, I hit a big problem: I needed to make static and dynamic objects play nice together when it comes to the character’s platform detection system, and I found myself making too many edge cases for the dynamic objects. Alarm bells were ringing, and so I have decided to do some research to see how other developers have solved this issue. After all, this had already been worked out going into the 1990s.
I’ve seen some good ideas that I may yet implement into the engine, such as detecting the amount of overlap in both axes to determine where the player should end up after a collision. This can be useful for allowing the player to jump easily into one-block gaps. At this moment, it is very difficult to do this, and this bothers me.
The best source I’ve seen so far is this guide by Rodrigo Monteiro, the smooth tile-based collision system (#2) in particular. He combines static and dynamic object detections in one axis pass. That is, the X and Y axes are handled separately, checks which static and dynamic objects are the closest in the path, then move the player towards the target without passing the collision point. This system makes it possible to detect collisions before they happen, and easily makes it possible to collide accurately with obstacles that are outside of the grid. The guide goes on to describe methods of implementing slopes, ladders (which I have already done), one-way platforms (also already done) and moving platforms. These are some of the things I planned on implementing anyway, so I shall definitely be considering this guide when implementing them.