Z/X - previous/next demo
up - turn on/off aabb tree
down - reset simulation
Several physics demos I've written in pico-8. These follow from the work of Erin Catto (see http://twvideo01.ubm-us.net/o1/vault/gdc09/slides/04-GDC09_Catto_Erin_Solver.pdf)
The solver solves both inequality constraints (e.g. collisions) and equality constraints (e.g. joints).
I've reduced the framerate for web down to 30fps, but it works well at 60fps (in face the higher framerate is better for the solver).
Still issues to solve, e.g. jitter on resting contact, so I probably need to do a rewrite at some point.
I've added a couple more demos including mass-spring-damper systems
Astounding, @jimmi ! This kind of game creation method has always eluded me. The ability to link one object to another. Star for you.
I have a suggestion for the wiggle. Use a filter, that is if you received cached values of , "1, 3, 1, 3, 1, 3" then the actual value would be "2" where it does not wiggle.
Hehe.. you are welcome 👍
- min is probably better, I sometimes fall into patterns like this and then forget why
- I wrote this code with closure based classes, the global you’re referring to are likely defined in an enclosing scope... there may be some globals I missed tho, will have a look.
- without the tree you have a O(n^2) problem, probably fine with only a couple of objects, but performance will deteriorate quickly as you add bodies
- what you are referring to would be damping, which unfortunately doesn’t work well with a constraint based solver. The jitter is because corrections applied to one part of the object can cause another part to collide and it ends up going back and forth.
Now that I'm messing with your code, I can see one thing that might give trouble to most Pico-8 users. You are declaring lowercase characters for variable names.
These cannot be typed in current Pico-8 and, @zep, perhaps there should not be a distinction ?
That is, any lowercase variables entered can also be addressed and accessed by uppercase, IE: "pi=3.14159" is the same as "PI=3.14159"
Currently there is a distinction and lowercase cannot be entered via the keyboard nor can it be searched for.
Here I recoded your program where all variables are normal (uppercase) and can both be edited and searched for:
Here is a variation, where everything is super bouncy bouncy ! :)
Either that or SUSHI KITTY, @jimmi.
Sushi kitty is an interesting game because although the cat is a circle, it's like a very soft ball that bends according to entering a type of Pachinko machine.
In these ledges and edges there are FISH for the cat. You drop the cat from the top and watch the charming animation of the cat slowly bouncing around, squishing on the sides like a big squishy ball to finally hit the bottom and a bonus.
You might actually have to see the game in play to understand what I am talking about. But as for your "physics" demos above, I think it would be perfect for a demake of SUSHI KITTY.
Can you do a squishy ball in Pico-8 ? I have a cart planned for January to show a way to make a ball APPEAR stretchy, but you're doing the real thing here.
[Please log in to post a comment]