Farseer.BMX 1.0 Released

And there was much rejoicing! It does feel great to finally ‘finish’ something. I started out this project as something to give me a foundation to code my own game project on, and now after 110+ hours of coding there is a 2D physics library for Blitzmax :)! I hope it proves useful to those that end up using it. While the engine hasn’t been tested for ‘real-world’ use it I think the demos do a good job of putting it through its paces. It’ll very soon have a good test through a ‘real world’ application once I get it integrated with my own game project. Anyway, Farseer Physics for Blitzmax is ready for download. The zip file contains:

  • A compiled version of the physics demo application with 4 new demos!
  • Ready-to-compile source code for both the core physics engine and the demo application
  • A ‘quickstart’ application that shows someone how to setup a basic physics scene with minimal code.
  • a ‘quick start guide’ that pretty much is a walk through of the quick start application. Which can also be found online.

For those eager to get their hands on it:

Download: Farseer.BMX

Since the last update, things came together rather quickly. I finished up the last of the classes that needed to be ported earlier in the week, which I then spent the rest of the week adding in demos to the demo application. This port is a very close implementation of the original Farseer in C#. The only times the source would deviate in any major fashion were in time-critical algorithms where optimization needed to be done differently considering how different C# and Blitzmax handle things (particularly garbage collection). With that said, you may find it helpful to visit the codeplex site of the C# version of the engine if you find yourself wondering how to do something in Farseer. While the answer you get may be in C#, keep in mind the methods, functions, and variable names are similar, if not identical, in Blitzmax. I’ve also implemented additional demos on top of the standard ones that came with Farseer to show the use of most of the available types in the engine. So if you wish to know how to implement a certain feature, try looking at the source code of one of the demos that does the said feature.

Here’s just a quick run down of what was added/updated since last post:

  • Added Demo 11 – Slider and Pin Joints
  • Fixed a minor bug in the main menu causing the about screen to stick
  • Sweep and Prune Collider implemented (not completely optimized)
  • Bilinear Interpolator
  • Added the Convert Units class for easy transformation between screen and world coordinates
  • Added IFluidContainer
  • Added onEntry and onExit event handling for fluid containers
  • Added Collision event handling
  • Added Demo 12 – Fluid Drag Controller
  • Added Demo 13 – Collision Event Handling

The fluid container objects turned out to be a bit cooler than I expected it to be. Not only did it simulate buoyancy but there was a controller that simulated wave formations on the surface of a container. Cool stuff indeed…

Pictures don’t do it justice so here’s a video…

By default Farseer doesn’t come with any code that allows geometry to create disturbances in a fluid container, but it comes with a nice, easy to use Disturb() function along with handy callback events for when a object enters and exits the container. With this I threw together a basic water container class that does some very ‘rough’ interaction between geometry and the waves. It’s far from realistic, but still yields an interesting effect I think. Someone could easily take this code and improve upon it. I’ve kept it outside of the ‘core’ physics engine and put it in the demo source since it was something that was kind of thrown together last minute (you can tell that by the rather rushed rendering code).

So that’s about it for now. I hope this engine finds some use in the Blitzmax community. Thanks to those on the blitz forums that provided feedback and data to help me optimize the engine. An especially big thanks to Jeff Weber for writing such a robust 2D physics engine to begin with!

*Crosses fingers and hopes the code will compile without issue on OSX and Linux*… 😉

11 comments

  1. Waaw ! You finish this one 🙂
    Great !

    Very impressing portage as it’s full BlitzMax code.

    But I’m wondering if FarseerBMX is fast enough when game logic and rendering is added.

    Currently the demo example (which are very similar in term of speed with the official one) is too slow for the games I’m planning.

    I hope it would not be an issue since it’s the only 2D physics engine in Max that support concave and convex poly shapes.

    Thanks for the source by the way !
    It’s an excellent news for the BlitzMax community ^^

    I will probably play a bit with it to see if it fit my needs.

  2. Perhaps better tutorials could help? I cant reaaly understand most of the things in the C# codes for it and the ones that are included that are in BlitzMax, Are done making it in a graphical mode so i dont get how i could recreate those in “Debug Mode”

  3. Well… You know the quickstart example? Its got that square thing that stays the same angle around the physical square, How would i get rid of the “Same Angle Box” and add a texture to it? Im pretty new to BlitzMax and i dont know what most of the stuff in the demos does lol… Im also currently learning how to do Joints

  4. This is a great module for Blitzmax 🙂 I’ve been playing around with it and will be testing it for some time, so far it’s performing nicely in my modest laptop.

    It’s great to hear you’re improving the documentation.

    Thanks Alex! Great job!
    (and thanks Jeff Weber too, of course)

  5. @Leonard
    I believe you’re referring to the AABB (axis-aligned bounding box) of the physical square. That can be disabled in the viewer by setting the the “EnableAABBView” to false.

    As for setting the texture of a physical body Farseer is not a 2D sprite system and is beyond the scope of what farseer set out to do. That’s not to say it’s difficult to do, but Farseer is meant for calculating physics, not graphics :). If you’re just starting out in Blitzmax I’d recommend you’d visit the community forums as there’s plenty of info there to help you grasp most of blitzmax’s concepts. A good starting point would be Wave’s beginner’s guide:
    http://www.truplo.com/blitzmaxbeginnersguide/wave1.html

    and more specifically for your case:
    http://www.truplo.com/blitzmaxbeginnersguide/wave19.html

  6. Hey, ty for posting the tutorials although i kinda knew how to draw images to the screen as it was very similar to BLitz3D’s… I just dont know how to get the physical objects current rotation and position so that i can keep apply them to an image during the While/Wend Loop

  7. Nvm, Found out now… I had a bit of trouble because i couldnt figure out how to draw to images made in the code so i had to manually make one and include it 🙁 lol

Leave a Reply to Wiebo Cancel reply

Your email address will not be published. Required fields are marked *