You are not logged in.
I don't want to keep 0.5.0 a forever work-in-progress. I actually want to release it, and there's a well established guideline for that.
The collision system is being reworked; the old stuff will be ditched, and the new system will be A5-compatible.
In the new system, you'll be using colliders (rather than pixel-perfect collisions). Spawn a collider as a child of the object and it will detect collisions with that object.
By the way, I'm working on player colliders at this very moment.
Last edited by Alexandre (2018-11-06 02:45:51)
Offline
could we just make the colliders visible for debugging?
https://discord.gg/w8JqM7m ---> Open Surge's Discord server
Offline
could we just make the colliders visible for debugging?
Yes, there is already an option that allows you to do that. It will be documented soon enough, together with the Player API.
Offline
ok, so here's my experience with this issue:
the collider disregards transparent pixels, and takes the whole frame's width and height instead of the opaque area. this produces very inaccurate object collisions.
https://discord.gg/w8JqM7m ---> Open Surge's Discord server
Offline
the collider disregards transparent pixels, and takes the whole frame's width and height instead of the opaque area. this produces very inaccurate object collisions.
Colliders can be customized and combined in SurgeScript, so it doesn't have to be inaccurate.
Due to architectural differences, we won't be using pixel perfect methods in A5.
Offline
KZR wrote:the collider disregards transparent pixels, and takes the whole frame's width and height instead of the opaque area. this produces very inaccurate object collisions.
Colliders can be customized and combined in SurgeScript, so it doesn't have to be inaccurate.
Due to architectural differences, we won't be using pixel perfect methods in A5.
If I recall correctly, the pixel-perfect collision in my proof-of-concept port was implemented on top of the bitmaps themselves. I know that querying pixel information from A5 bitmaps is generally slow. I may (read: have forgotten since I wrote it) have ported an OpenSurge version that predated the collision mask feature.
If the collision masks were implemented outside of the A5 environment, maybe they could run faster than the bitmap-based version.
Just a thought.
-- svgmovement
Offline
A5 bitmaps are generally stored in video memory (if we want to take advantage of hardware acceleration) and therefore, querying individual pixels is extremely slow, given an expensive bus transfer.
By working with colliders (one or more geometric shapes like boxes, balls) for detecting collisions between sprites, you can have good results with much higher performance. I believe retro games like Mortal Kombat 3 use this method.
Collision masks: I have designed a fast data structure that works on regular RAM, outside A4/A5. It allows really fast querying of pixels and other things, however it's intended for bricks (no animations). The physics engine needs it. Though masks could be adapted to sprites in the future, I won't be working this way. There's a better way. Collision masks use memory, not every sprite needs it and they're not designed for animation. I do not discard totally having sprite-compatible masks in the future, because who knows what the future brings. But that's outside the point.
What we want is fast & cheap collision detection on PC or mobile. And acceptable accuracy.
Offline
What we want is fast & cheap collision detection on PC or mobile. And acceptable accuracy.
I think the answer is what practically every engine is doing nowadays - polygon collisions
However masks are the "messenger" so to speak, let me elaborate.
the user makes a sprite, assigns it a mask based on its rough shape, and the engine mathemagically computes a polygon outline. this polygon becomes the actual collider.
I'm sure there are plenty of algorithms floating online that you can study and adapt for this purpose.
more advanced game making solutions like Construct have a basic image editor where you can assign multiple hotspots as well as polygons per frame. this is off the point, as an image editor would be a great undertaking, but the way it works with animations is worth a peek.
Last edited by KZR (2018-11-07 15:44:11)
https://discord.gg/w8JqM7m ---> Open Surge's Discord server
Offline