The Power of SVG / Vector (Updated)

  • Regarding the polygon object suggestion. Didn't Construct Classic support pixel based collisions, couldn't the code for that be ported?

    I know it was more of a "hack" back then but I guess if it works, it works.

    That's why we have polygon, per point is way too slow for html5.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • > Regarding the polygon object suggestion. Didn't Construct Classic support pixel based collisions, couldn't the code for that be ported?

    >

    > I know it was more of a "hack" back then but I guess if it works, it works.

    That's why we have polygon, per point is way too slow for html5.

    I don't think that's the case any more, especially with WebAssembly. The main reasons for polygon collisions are:

    • it's simpler
    • easier for user to edit
    • likely faster than per-pixel checks (regardless of implementation)
    • other parts of the engine need a polygon e.g. Physics & ShadowLight, so you need a polygon anyway. So you may as well use the polygon for collisions too.
    • per-pixel collision was extremely difficult to get right in Classic - lots of difficult bugs, even years down the line when we thought it was mature, and often the bugs crashed the game or corrupted memory
    • if there are N collision systems, you need N^2 algorithms, because every type of collision has to be able to collide with every other type of collision. Adding new collision types becomes exponentially more work, which is a very good reason to only support one, or the very fewest possible. (E.g. if you add per pixel collisions, we'll also need poly-pixel intersection tests, which means rasterising polygons to a bitmap... lots of tough code to write there, and carries opportunity cost accordingly)
    • I've always asked for, but never seen, a convincing case where something really definitely needs per-pixel collisions and just can't be done with polygon collisions. So as far as I can tell polygon collisions are perfectly sufficient for game design purposes.

    As is typical with designing complex software, there's a lot more to it than performance or "just port the old one".

  • Worth mentioning that I personally wasn't for or against the current system, just curious about per-pixel collisions in HTML5. Thanks for the info!

    If anyone knows any edge cases for polygon collisions, feel free to post them.

  • I've always asked for, but never seen, a convincing case where something really definitely needs per-pixel collisions and just can't be done with polygon collisions.

    Worms-like terrains and terrain destruction. I tinkered around with it some time ago and it is pretty much impossible. A tilemap works but imo not that well. I had the idea to divide everything into reasonably tiny pieces/triangles. Works ok with simpler terrains but then you can´t really use textures, unless you manually cut it up and individually place each piece. Well if that process could somehow be done at least semi-automatically it would be really cool. Like a "shatter" plugin that sort of triangulates the object automatically into multiple small ones and then allows the pieces to be broken away individually.

    I wouldn´t mind though if you go ahead and prove me wrong about it beeing that complicated, maybe make a worms-type template :)

    But I would agree that this is a rather specific case and isn´t that important on a larger scale.

    (Also that´s kinda offtopic from what OP wrote)

  • Worms-like terrains and terrain destruction.

    That's a much more specific case though: per-pixel collisions and dynamic updates by removing parts of it. You could have an equivalent dynamic-polygon-updating feature. If you take per-pixel collisions on their own vs. polygon collisions, I still haven't seen anything that convincingly makes the case for per-pixel collisions.

  • I could see how a polygon solution to wormz might be better than per pixel, especially with some interpolation.

    It would be pretty mathy however.

  • Hmmm,it's so interesting , but i can't understand one thing. Who can help me with it?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)