TannerRogalsky / punchdrunk

An attempt to replicate the LÖVE API in the browser using moonshine.
http://tannerrogalsky.com/punchdrunk/
MIT License
81 stars 10 forks source link

Physics #38

Open bengolds opened 10 years ago

bengolds commented 10 years ago

Right now love.physics is unsupported; before I take a crack at it I wanted to discuss what the best way to implement it would be. Some options:

Create new Box2D JS implementation Use existing Box2D JS implementation:

Emscripten the box2d code straight from Love2D's distribution.

Thoughts? box2d.js-kripken seems the most current.

TannerRogalsky commented 10 years ago

It's worth noting that the Box2D version used by Love has been modified although I'm not sure how much or in what ways. We should probably find out how much it was modified and why.

Once that has been figured out, I would love to use an emscripten'd version of Love's Box2D. I strongly considered using emscripten on graphics module but in the end it didn't seem practical. I suspect that the physics module would be a stronger candidate for this process.

If we decide to go ahead with this, we should probably have a separate repo that is a fork of kripken's work set up to build our box2d.js and then we can just depend on that repo from this one.

How does that sound? :D

bengolds commented 10 years ago

Seems reasonable. I just noticed that my original markdown was a bit messed up; the box2d.js-kripken repo is not actually pulled from Love2D's distribution. That leaves two alternatives; modify kripken's repository manually to match the version distributed with Love2D, or directly emscripten the Love2D module. I'll examine the differences in Love2D's distro of Box2D.

TannerRogalsky commented 10 years ago

:+1:

slime73 commented 10 years ago

I think the only modification was to change the b2Assert define to throw a love::Exception so that box2d errors are propagated to Lua.

TannerRogalsky commented 10 years ago

In that case, it hardly matters since the love::Exception stuff hasn't been implemented yet. Still, the version of Box2D used should probably match Love's at 2.3.0 so kripken's work would need a minor update.

Bobbyjoness commented 10 years ago

If I knew coffeescript I would help with this