play
Check out some of our latest releases here.

Learn more about intuition
Apr
10
Posted By
fucrate

I’ve been working on a new game, we’re not exactly ready to release much in the way of details as we’re not exactly sure what those details are yet, but there will be platforms, and you will probably be jumping on them for a large percentage of the experience. Given that information, I’ve spent some time trying to prototype up some platforming action and I’ve got some cool results.

My first impulse was to run out and grab Box2D, an awesome physics library that has a port in AS3 and is pretty much the standard for flash physics solutions these days. There are a bunch of other great libraries for physics, but I’ve used Box2D a bit and found it to be awesome, so I figured it would be a pretty good fit.

The problem with Box2D, and with any 3rd party library that you try to integrate with your code, is that you didn’t write it, and thus you don’t really understand how to use it without a lot of time spend researching and experimenting. This can lead to a lot of little problems that add up into a lot of hacking and workaround code to help you shoehorn the library into whatever goal you have for your game. The problem for me is that Box2D is basically super optimized for random objects bouncing off each other and flying through space, where a platform game needs to simulate the experience of a man/creature walking, running and jumping around on terrain or other objects. These goals don’t match up as well as you might think, and I began to have serious trouble getting the action of my little avatar to work exactly as I wanted. I especially had trouble with moving platforms, which is a feature I know I want in my game, but Box2D just isn’t built to handle.

Deciding that Box2D, as awesome as it is for dynamic physics, isn’t right for my project made things a lot scarier. Now, instead of being able to rely on much smarter people than I for my collision detection and physics, I had to rely on my own brain, which is always terrifying. Luckily, I knew that the equally awesome Metanet team, the kids behind N and N+, released some great tutorials on flash-specific solutions to collision detection and resolution. Their tutorials are also pretty platformer specific, as they relate to their own research for N. Armed thusly I started out and made some cool stuff.

Use them arrow keys to move around, space to jump and if you jump, you can use w to fly a bit. Right now this is just a testbed for the collision detection and resolution, and it doesn’t do too much, but I understand everything that’s going on and I can modify any aspect of the simulation. If I just kept on trucking with Box2D, I wouldn’t understand half of what was going on and it would be really painful for me to modify the the interaction of the different bodies. I’m not trying to re-create Box2D either, I’m doing a lot simpler interactions, so the power I need for the simulation is a lot less than what Box2D provides.

Another cool feature I’m working on is making the level editing process as easy as possible for noobs like Greg to use. The one great thing about using flash is you already have a solid 2D editor in the Flash CS3 application, and I’m just using it’s existing functionality to set up my levels.

level edit

In the final implementation, whoever is designing the level will just have to drag those green block guys out of the library and place them wherever they want a platform. They can even resize the box to be a long platform or a wall or whatever. Then they’ll just draw the actual art for the level over top of the collision boxes to create the actual environment. When the game loads the level up, the green boxes will be removed and all you’ll be left with are the pretty drawings and your dude running around.

I’ll try to keep posting more about this one as it develops, so far it’s been very educational for me, maybe it will be for you as well.

COMMENTS
005
Apr
10

5 Responses to “Platform-ey, Physics-ey Goodness”

  1. AndyDrum


    I’m digging the test-bed you’ve got going there. I think the physics are coming along nicely. I couldn’t get my ‘o’ to fly though :(.

    I did notice that when you land and you are holding the jump button still, the circle jumps right away. Say when you go up the stairs to the left and jump on the floating square. Since the jump is so high, I’ve learned in video games to hold the jump button to jump higher. So I’m still holding the button when I land on top of the square and the circle jumps again off in a random direction because I wasn’t prepared for that.

    Just something to think about.

  2. Aaron


    I found the easter egg at the top!!!!!

  3. mike


    @aaron: This pleases me greatly. Did you actually climb up?

    @andrew: It’s true, there’s a ton of tweaking to do to make a platformer “feel” good. That’s why I rolled all the physics myself, this way I can tweak those values a lot easier.

  4. AndyDrum


    Jeeze Mike. I figured out how to use the W key. So unprofessional :)

  5. gabriel


    heya i like that its SIMpLE can you send
    Platform-ey, Physics-ey Goodness sourcey code?
    thanks

Leave a Reply

COMMENTS
005