Precise collision for static sprites

Discussion and feedback on Construct 2

Post » Sat Nov 21, 2015 12:29 pm

dilk wrote:I am re-creating a limbo-type level, and the terrain is compiled in a single image (1920*8000pi).

We strongly recommend against designing games like this. See remember not to waste your memory. The memory use will be very high, and an image that large will not even load on systems with a maximum texture size of 2048x2048 or 4096x4096.

You don't need to design the collision mask point-by-point for an entire level like that. Just create some collider objects which are invisible sprites with a simple shape (e.g. triangle, rectangle, etc) with a matching collision mask. Then you can design the collisions for your level in the layout view by arranging those objects. The collision cells optimisation keeps this fast regardless of how many collision objects you have scattered across the level.

Given the high complexity of the per-pixel collisions feature, I really don't want to have to support that. As I said earlier in the thread the implementation complexity is very difficult, it has high performance and memory overheads in some cases, it was an ongoing source of bugs and crashes in Classic, it would be even more difficult in C2 (since there is a new poly-to-pixel-mask case), and every new collision feature exponentially increases the types of collision interaction that must be supported, effectively ruling out ever adding any other new collision features. I really think it's best to stick to polygons. AFIAK, that's how all 3D games work anyway - I don't think many games use voxel collision masks (which would be the 3D equivalent) - and if polygons are good enough for 3D...
Scirra Founder
Posts: 22,829
Reputation: 176,664

Post » Wed May 25, 2016 5:23 am

If you need a precise collision mask for an object, in my point of view, you can use two or more simple shapes connected together. For example you can have a big robot character with iron fists, iron feet, a heart and a head; you can attach 6 objects to a really complicated shape that for sure needs a lot more collision points. In this way, you can also focus on curved areas more effectively.
Posts: 3
Reputation: 367


Return to Construct 2 General

Who is online

Users browsing this forum: aldoalvarado, Yahoo [Bot] and 10 guests