Blog

3D Ball Adventure (JigLibFlash, SpringCamera3D, Papervision3D) Mashup Part 1

February 2, 2009 by Devin Reimer

3D Ball Adventure Version 1 Screenshot

A couple of weeks ago a new 3D physics engine for AS3 called JigLibFlash was released into early alpha. I’ve been playing around with different 3D physics engine for Papervision3D for a little while now. The problem was I could not get the ease of use and performance I wanted out of anything that was currently available. This finally changed when I came across JigLibFlash. This library is relatively easy to use and the performance is quite good. Check out the code base at http://code.google.com/p/jiglibflash/ or jump over to their blog at http://www.jiglibflash.com/blog/. Important Note: This library is currently undocumented, has no tutorials and is in early alpha so it is not for the faint of heart, but if that does not bother you go check it out, you will be impressed.

I have been working on a new camera type for a while that would realistically follow around a 3D buggy. I thougth this class was starting to get pretty good, that was until Benoit Beauséjour release his SpringCamera3D class, which blew the version I’ve been working on out of the water. This class is easy to use and will make your 3D apps look a lot more profession. For a good example on how to use the new SpringCamera3D class in Papervision3D check out a demo at http://pv3d.org/2009/01/23/springcamera3d-and-driving-a-car/

So while playing around with both these very cool new developments I thought wouldn’t it be great if I mashed these two together and create a cool game. At that moment 3D Ball Adventure was born.

Continue reading for a working demo and source code.

Instead of waiting until I was completely finished the game I have decided to release working builds throughout the development process. The first demo is the basic integration of Papervision3D, JibLibFlash and SpringCamera3D. I have also created a basic xml driven level generator for this application.

In this version you must navigate your ball around the course and push off all the small red boxes to win.

This movie requires Flash Player 10

You can download the source code here

To run the source code you must have Papervision3D revision 870 or newer and JigLibFlash revision 25 or newer.

Download the source and check it out, even if you are not a hardcore programmer you can play around with the xml files to create some cool levels.

6 Responses to "3D Ball Adventure (JigLibFlash, SpringCamera3D, Papervision3D) Mashup Part 1"

  1. Jay says:

    Hay! great work! I am not a hardcore programmer but I try to make it more completed so I add following lines

    removeChild(viewport);

    stage.addEventListener(MouseEvent.CLICK, setup, false, 0, true);

    it works but it seems doesn’t clean up the previous game. Any idea?

    BTW, it’s fun to play around such great stuff. Thanks!!

  2. Devin says:

    Hi Jay

    I don’t know exactly what you are trying to do, but I’m going to take a guess. You are trying to clear this level to start a new level. My recommendation is never to remove the viewport. Papervision3D and Flash are not great for cleaning up memory, so always use the same viewport. What will need to be done instead is cleaning up all the objects in the scene that are not needed (Environment objects) instead. So go through remove them and set them to null.

  3. Ben says:

    Nice work!
    Glad you like the camera! I’m happy people to get to use it! :)

  4. Allan says:

    How do you move the camera? Arrow keys move the ball around but I can’t figure out how to change the vantage point. Thanks,

  5. Devin Reimer says:

    Hi @Allan,

    In this version you can’t move the camera, but in the third iteration (http://blog.almostlogical.com/2009/02/22/3d-ball-adventure-jiglibmotionspringcamera3d-part-3/) the camera moves around the scene automatically via a spring camera system.

  6. pardeep says:

    nice game sample

Leave a response