3 ms·
It's fairly disingenuous to say that implementing polygon-based (the article calls it "vectorial") collision detection on platforms is "very difficult to implem
by yoklov 11y ago
It's fairly disingenuous to say that implementing polygon-based (the article calls it "vectorial") collision detection on platforms is "very difficult to implement properly" without a physics engine.
The collision detection code for this can be done in probably less than a thousand lines (probably less if everything is OBBs). Adding support for arcs, and even bezier curves becomes much, much easier as well (for both, probably another thousand lines, at most). It is also easier to add support for continuous collision detection this way, should that be something you want (although this would increase the amount of code a fair amount).
FWIW, I used to go the pixel-based route, but after having done it this way I'm not sure I would do it again. It ends up being much cleaner, more robust, and easier to extend. I'd go as far as to say that your collision detection and physics code shouldn't have any knowledge of pixels, only your renderer (and maybe the gameplay code, if you insist) should have an idea about these.
I will say that it requires a stronger math background, however, but in all honesty, probably not that much stronger than is required to make the rest of a game.
- hesdeadjim 11y agoCould you recommend some resources or a good place to start for this approach? I've experimented some with what I consider to be "hack" solutions where your character is basically covered in collision shapes and sensors and I've yet to feel it is robust compared to a solution that uses actual math. My reference point for "great controls" would have to be Super Meat Boy and N+ -- though for all I know they've taken an approach described in the article.
- dyarosla 11y agoN+ (and I believe Super Meat boy as well) don't use pixel-level physics and rely on AABB collisions and computations. There's even a tutorial published on how the original N game resolved basic collisions and physics: http://www.metanetsoftware.com/technique/tutorialA.html http://www.metanetsoftware.com/technique/tutorialA.html
- hesdeadjim 11y agoAwesome, thank you.