Log In  

Could someone make 2d physics engine for pico, something like box2d or chipmunk (though probably w/out rotation as pico doesn't allow for them)?

P#14782 2015-10-01 09:14 ( Edited 2015-10-03 15:09)

Yes, and it would probably perform quite well as long as the right precautions are taken. The only problem is that it would likely take up an incredibly large number of tokens.

You can even manage it for 3d, as I have done in a 3d racing demo I made a while back, but I could only get a single spherical collision in before the game started chugging, and that's even with partitioning the collision model.

It's also incredibly buggy due to fixed point overflows, and the 3d+collision code leaves very little space to work with.

P#14794 2015-10-01 12:41 ( Edited 2015-10-01 16:41)

Awesome looking demo! :)

P#14802 2015-10-01 15:19 ( Edited 2015-10-01 19:19)

I've been thinking about this for a while. My solution for the token limit would be to create a minifier and exporter of modules you really need (à lá jQueryUI), with dependent checkboxes.

A WebService would then generate and minify only the code necessary for your game.

For example: I need only BoxCollisions for non-rotating boxes. That would be ~1500 tokens, and would also import the Box class, a dependency from BoxCollisions. If I needed BoxRotatingCollisions that would be another dependency. Importing also QuadTreeCollisions would add tokens but save performance. Really modularized stuff.

@Rhys @tbsp Agreed! This is a piece of art!

P#14813 2015-10-01 19:35 ( Edited 2015-10-01 23:35)

@cauli I've been thinking similar thoughts and thinking about which subset of features would be most useful. Circles and lines would be pretty reasonable token wise. OBBs might be, but since you can't render rotated sprites easily that might be a good thing to forget. For spatial indexing, 1D sort and sweep would be very token friendly yet still offer good performance in a scrolling or single screen game.

Fixed point overflow for physics can be very frustrating. It's much easier to avoid with graphics when you can work with a nice fixed range of input values, and the math is straightforward to analyze. Impulse solvers? Not so much. It might be possible with a lot of limitations though, like a small coordinate, velocity and mass range.

(Note: I'm wrote Chipmunk2D ;)

P#14855 2015-10-02 10:04 ( Edited 2015-10-02 14:04)

"I've been thinking about this for a while. My solution for the token limit would be to create a minifier and exporter of modules you really need (à lá jQueryUI), with dependent checkboxes."

Or Linux Kernel config tool ;)

And awesome we have Chipmunk2D programmer here, slembcke! I think the most important shapes for physics would be boxes, circles and "slanted" boxes:

 __
/  \
|  |
\__/

for when character is still "squarish", but you don't want it to get stuck on the walls.

Also imo "rotation" should be simulated but not immediately visible on the object. This way, if you want, you can draw rotated sprites manually and then change it depending on the "angle" returned by the physics engine.

P#14920 2015-10-03 11:09 ( Edited 2015-10-03 15:09)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-01 02:09:32 | 0.014s | Q:23