Skip to main content
Topic: box2d-sphere (Read 127593 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

box2d-sphere

I've been working off and on on a port of box2d.js to miniSphere, which would allow a developer working with miniSphere to make more dynamic platformers. If you aren't familiar with box2d, it's a physics engine used in games like Angry Birds, LIMBO, and Happy Wheels.
The screenshot shows the stage in "Debug draw" mode, which would be the equivalent of drawing only collision objects in miniSphere. When it's more stable, I would be able to attach a Person object's position and rotation to a box2d object.
Unlike box2d.js and the original, I'm also working on a stage object to make stage building easier. So rather than writing boilerplate code for each static and dynamic body, you can just create a JSON file and save a lot of effort. For example, this is the file that sets up the stage shown in the screenshot:
Code: [Select]
{
"name": "Test stage",
"gravity": { "x": 0, "y": 32 },
"allowSleep": true,
"border": {
"top": 5,
"bottom": 5,
"left": 5,
"right": 5
},
"objects": [
{
"type": "rectangle",
"dynamic": false,
"position": { "x": 32, "y": 32},
"size": { "w": 50, "h": 10},
"angle": 5
},
{
"type": "circle",
"dynamic": true,
"position": { "x": 55, "y": 64},
"radius": 10,
"angle": 0
}
]
}


I wanted to make an animated GIF showing it in action, but OBS studio wouldn't play nicely.
This is a somewhat low-priority project compared to the other ones, but I figure you guys might be interested. I'm going to hold off on uploading the code, since it's a bit of a mess right now. As soon as it's at least a little bit more stable, I'll probably upload it to GitHub or something.

 

Re: box2d-sphere

Reply #1
This is nice! I want to create a platformer in miniSphere eventually, so this would come in mighty useful. :)

Re: box2d-sphere

Reply #2
Nice!  miniSphere 5.0 will make this kind of thing more practical too, thanks to Chakra's blazing-fast performance.

I spotted that SSj Blue badge in your screenshot.  I imagine you might have leaned on the debugger a lot while developing something like this! ;)

Re: box2d-sphere

Reply #3
This is nice! I want to create a platformer in miniSphere eventually, so this would come in mighty useful. :)
That was what I had in mind. I've had an idea for a while now for a game with similar gameplay to Abuse, using this.

Nice!  miniSphere 5.0 will make this kind of thing more practical too, thanks to Chakra's blazing-fast performance.
I figured that was the case. It runs decently with Duktape, but I'm definitely looking forward to ChakraCore.
I spotted that SSj Blue badge in your screenshot.  I imagine you might have leaned on the debugger a lot while developing something like this! ;)
Actually, I was just frustrated with OBS, so I just pressed F5. I do usually make decent use of SSJ, but I haven't used it much with box2d-sphere.

Re: box2d-sphere

Reply #4
@Eggbertx Have you tried it on the 5.0 beta at all?  Beta 2 is fairly stable, there might be a glitch here and there but it should run pretty well.  For the next beta I should probably have it install in a different location so that people can use 4.8.x and the 5.0 beta side-by-side.

Re: box2d-sphere

Reply #5
This project stagnated for a long time because I ran into some hiccups and had larger projects that needed my attention (and still do, technically), but it's actually starting to work decently, as you can see from the video. It still currently relies on the debug draw mode, but I'm figuring out how to make it more flexible. When I get a proof of concept "game" working, I'll post the source code to my changes to the original box2d-js, my box2d-stage module, and the game itself.