Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by rgiuly

Hello All,
I want to make a trajectory game where objects are being thrown and will bounce off of surfaces. The surfaces will have arbitrary shapes and curves. I've though about ways to approximate this with tiles. But do I need to?

Question:
(1) Do I really need tiles at all? Is there some way I can just edit a full screen sized map of pixels to define collisions?

A few related questions arise also:

(2) Is is possible to make tile size as big as the screen and then edit the tile to make an arbitrary collision image?
(3) Or, for another extreme, what about using tile size 1x1? Is that reasonable?


Best,
-rick

1 decade ago by Apiheld

1. The collision map – like everyting else in Impact – is just a tool you can use, but you don't have to. If you find that it's not a good fit, use something else.

Collision in Impact is based on collision boxes. This makes the calculation whether or not two entities, (or an entity and the map) collide quite fast.

If your entity/surface (the surface could be an entity) has curves, a per-pixel collision detection might be necessary and you can't get away with a "cheap" calculation based on boxes. Have a look at this thread: http://impactjs.com/forums/code/per-pixel-collision-detection-plugin
I didn't try it, but maybe it works for you.

2. If I understand this idea correctly, it still boils down to per-pixel collision. How are your surfaces generated? Randomly or do you make them somehow manually?

3. Probably not, because a collision map in Weltmeister is just an array. So if you have a 640x480 resolution, you'd get an array with 307.200 entries, which is just very inefficient to calculate collisions.

In short:

- there are fast per-pixel collision algorithms, you'd need to research them a bit
- see link above
- check Impact++, which also has per-pixel collision if I'm not entirely mistaken
- check Box2D whether this helps you with non-box shapes and their collisions

1 decade ago by rgiuly

Hi Apiheld, thanks for the great information. This will give me a start. FYI: I looked up more information on Box2D as you suggested and found this:
http://box2d-js.sourceforge.net/index2.html

So it appears that in theory at least, it should be possible to generate a scene made of convex polygons.

Best,
-rick

1 decade ago by Apiheld

That's what I was thinking. And there's also a box2d-plugin for Impact. Try to search the forums and let us know how it went :)

1 decade ago by Joncom

(1) Do I really need tiles at all? Is there some way I can just edit a full screen sized map of pixels to define collisions?

Have you seen DigRig? Levels made out of pixels, not tiles. Destructible landscape.

1 decade ago by Apiheld

That's pretty cool, I need to look into that :)
Page 1 of 1
« first « previous next › last »