How would I implement a collision manager? (top down game)

Hey, I’m currently trying to figure out to resolve collisions, have different collision types, and optimize collisions (I’ve thought about using a grid for optimization, is this any good?) The hitbox code has the collision type (an enum), width, and height. I used to handle collisions within my player component class, but that seemed like bad design where only the player knew about the collision. Thanks!

1 Like

Sweeping AABBs and Minkowski is what I prefer. It just depends on what you want to happen as a response to collisions. Here’s a couple references that helped me get started if you’re interested:
https://www.gamedev.net/articles/programming/general-and-gameplay-programming/swept-aabb-collision-detection-and-response-r3084/



1 Like

Thanks! I’ll check out Minkowski collision resolution.

If you are not making an accurate physics based game, I guess you can get away with a very simple single-point collision system (Dead Cells use them same, and it’s a pretty complex game).
The creator of Dead Cells has some very nice tutorials on this topic and also an open github repo that you can translate to monogame:

Most games can easily get away with such a solution, take a look at it. It’s very very simple to implement and runs very fast. Dead Cells uses the exact same gamebase and logic that you can find on the link :slight_smile: