Monday, May 25, 2009

My JavaFX Contest Entry Part II

I played quite a bit with the phys2d engine...just creating little demo apps (using their demo framework).  Originally I had thought about some sort of castle destruction game...where you use catapults to launch rocks and missiles and such.  I thought more about it and couldn't really come to terms with the gameplay and decided to go another route.  I'm glad I did, because about halfway through my development, I stumbled across this (relatively new) flash game called "Crush the Castle".  (http://armorgames.com/play/3614/crush-the-castle).  Then I hit upon what I thought might be an original idea.  I'd make a hardcore controlled demolition game.  You get to see the skeleton (steel beams) of a building and you set and time specific types of charges to bring the building down.  There would be cutting charges to slice through the beams....kicker charges to push out cut beams....directional charges, maybe general explosives...and of course, a wrecking ball.  The user would be challenged to destroy the building to rubble not exceeding some height so as to earn their 'fee'.  
    I mapped out the UI on the back of a paper plate and started experimenting.  I found out quickly that simply stacking beams (vertical and horizontal) on top of each other and knocking them over didn't look realistic...so I had to try to create the concept of 'welds'.  I started using the phys2d engine and they had a variety of joint types that I experimented with.  Making a joint 'breakable', however, ended up being a bit of a challenge.  In fact, the only joint type that worked was a 'fixed joint' that connected 2 bodies through their center points.  
This seemed to work ok in initial tests.   In addition to breakable joints, I knew I also needed destructable beams.  Regardless of the explosives, when a building collapses, steel twists and breaks so as to create rubble.  So I created some techniques to 'split' beams and create 2 new bodies which seemed to work fairly well.  Originally I coded this to be based upon sudden changes in speed (when beam rapidly accelerated or decelerated....as the phys2d engine exposed some delta functions (force and movement vectors) for each body.  

Experimentation with the physics engine was done and it was time to work on the UI...that's where JavaFX made me smile. 




No comments:

Post a Comment