Thursday, April 19, 2012

Game and video resurrected

My original 'host' for my game deployment has since 'lost' my compiled game...so I spent a day or two trying to rebuild from source (ended up having to install 'old' version of Netbeans)...but she lives again!!
Enjoy the vid!!

Tuesday, May 26, 2009

My JavaFX Contest Entry Part VII



Submission

Officially submitted to the JavaFX Coding Challenge. Click here to play.

Enjoy!!!




My JavaFX Contest Entry Part VI

Technical Notes and Credits

There is probably a memory leak here somewhere....(my limited knowledge of profiling showed many high-generation objects as well as lots of heap usage). Not sure if inside JavaFX core or my own incompetence. (probably the latter) Regardless, should change the default help size with -Xms128m -Xmx1280m (my JNLP/web start settings are actually higher than this)

Also...I've been using this setting to smooth out the animation. Not sure if really necessary, but...it was mentioned in a JavaFX post somewhere:
-Dcom.sun.scenario.animation.vsync=true -Dcom.sun.scenario.animation.pulse=500. (These ARE set in the JNLP file)

Some of the structure and design of integrating a physivcs engine with javafx came from http://piliq.com/javafx/?page_id=669 (not sure of the fellow's name). While I integrated with a different engine (jbox2d), this information was invaluable

Also..thanks to the Sun Dukeman demo (http://www.javafx.com/samples/Dukeman), I utilized some of the splashscreen/level/config structures from that code.


Special thanks to the creators and maintainers of:
  • InkScape
  • Paint .Net
  • Audacity
  • Netbeans
  • jbox2d
Also to those behind:
  • freesound.org
  • openclipart.org

Audio credits:

By acclivity (http://www.freesound.org/usersViewSingle.php?id=37876)
Toby2.wav (http://www.freesound.org/samplesViewSingle.php?id=14865)
By morgantj (http://www.freesound.org/usersViewSingle.php?id=27178)
babycrying2.mp3 (http://www.freesound.org/samplesViewSingle.php?id=59579)
By Percy Duke (http://www.freesound.org/usersViewSingle.php?id=132851)
Balloon Inflation.mp3 (http://www.freesound.org/samplesViewSingle.php?id=23389)
By sandyrb (http://www.freesound.org/usersViewSingle.php?id=14771)
FAKE MONKEY CHATTER 001.wav (http://www.freesound.org/samplesViewSingle.php?id=41382)
By kjackson (http://www.freesound.org/usersViewSingle.php?id=71184)
Open_03.WAV (http://www.freesound.org/samplesViewSingle.php?id=32634)
By fauxpress (http://www.freesound.org/usersViewSingle.php?id=317797)
cash_register_printout.wav (http://www.freesound.org/samplesViewSingle.php?id=42196)
By Corsica_S (http://www.freesound.org/usersViewSingle.php?id=7037)
chargalzaza04.aif (http://www.freesound.org/samplesViewSingle.php?id=69363)
By Benboncan (http://www.freesound.org/usersViewSingle.php?id=634166)
Anvil & Steel Hammer.wav (http://www.freesound.org/samplesViewSingle.php?id=60649)
By nthompson (http://www.freesound.org/usersViewSingle.php?id=364925)
rocketexpl.wav (http://www.freesound.org/samplesViewSingle.php?id=47252)
By guitarguy1985 (http://www.freesound.org/usersViewSingle.php?id=533680)
buzzer.wav (http://www.freesound.org/samplesViewSingle.php?id=54047)
By bebeto (http://www.freesound.org/usersViewSingle.php?id=409)
Auto Photo Click.wav (http://www.freesound.org/samplesViewSingle.php?id=7309)
By cumesoftware (http://www.freesound.org/usersViewSingle.php?id=666662)
elevatormotor1.wav (http://www.freesound.org/samplesViewSingle.php?id=54522)
By bebeto (http://www.freesound.org/usersViewSingle.php?id=409)
Loop008-ambient.wav (http://www.freesound.org/samplesViewSingle.php?id=18980)

My JavaFX Contest Entry Part V

Gameplay

Each level presents one or more destructible buildings that need to be reduced in height below a pre-determined line. Each level has fee that will be paid upon completion of the destruction (and potentially a bonus if the bonus conditions are met). Some levels have collateral buildings that are not do be damaged. Flying debris, equipment impact, explosions...all can produce damage to these collateral buildings...incurring costs that will be deducted from your demolition fees.

The control panel provides access to your equipment to facilitate the destruction. Click on the 'TOOLS' button on the bottom of the screen to access your control Panel. Click on a specific icon to 'select' that tool (it will turn green). Set the timer at the bottom of the control panel to the desired setting and then click on a beam or open area of the level scene to deploy that piece of equipment. You can close the control panel by clicking anywhere within it that is not covered by an icon, or simply by clicking on the TOOLS button again. Note that there are 4 different building materials used: wood, brick, concrete, and steel (in order of relative density/toughness). Levels that combine the different materials with varying thicknesses makes proper equipment selection and timing a crucial process.

When you have deployed all of your equipment and properly positioned and timed everything, press the start button to begin the main demolition timer. You have 30 seconds before an evaluation is made to see if you have reduced the building structure(s) height to below the defined line. After 30 seconds, you will see a summary page showing your results. You then have the choice to reset that level (reset your balance to what it was before this level) or proceed to the next level. Note that you only get 10 resets per game. Also note that you CAN proceed to the next level without completing the current. You just will not receive the fees for that level (think of it as passing up on a hard job). You MAY stop a level early if you think you have destroyed everything below the aforementioned line or if you know that you have zero chance of completing the level on this round by pressing the stop button. This will bring up the same summary page as mentioned above.

There are 20 different levels of increasing difficulty and fees as well as occasional bonus fees (giving specific equipment requirements) .

My JavaFX Contest Entry Part IV

The Equipment:

Monkey with Hammer
Place this fellow on a vertical beam (click on any vertical beam) and set his timer. He will hang onto the beam diligently until his timer goes off, and then begin whacking on the beam with all of his heart. Monkeys will hammer until the beam breaks and then, once their job is finished, they will disappear into the voids of the building. One of monkey's hammering away at the structure will create building sway which can ultimately be used to force a building to fall certain direction (sorry, all monkeys used in the game are right handed and can only hammer from the left). Right click on the beam (or just click again) to get your money back and send him back to the pet store.

Laser Clamp Place this on a vertical beam and set the timer. The clamp will emit a cutting laser that will fire into the beam until it breaks. These are clean cuts that cause no building sway at all. Note that different density and thickness of materials will cause the laser to take longer or shorter periods of time to cut through. Once again, Right click on the beam (or just click again) to get your money back and remove the clamp.


Giant Beach Ball Click on any open area to determine the vertical path of this vinyl sphere of destruction. When it's timer expires, the ball will fall from on-high along it's positioned vertical path, reigning destruction along the way. Actually, air filled beach balls do little damage, bounce a lot and really get in the way of the other equipment. But they sure are fun (and cheap)!! Once deployed they can be dragged to a new position (before the main destruction timer is started) or right click on them to sell them back to the oversized toy-store from whence they came.

Explosive Balloons Click on any open area to deploy these explosive floaters. When the main destruction timer starts, these bad boys will float up until stopped by any building structure in their path. Then their individual timers expire, BOOM!!!. Balloons work best on compromised structures that have been weekend with lasers or monkeys. Don't try these as your only weapon against concrete/steel structures. Right click to deflate and sell these back. Careful with timers. When these balloons are let lose against small pieces of rubble, they can send pieces nearly into orbit, compromising your ability to get all destruction below the magic line before time runs out.

Bunny Wrecking Ball Click on any open area to set the path for these harbingers of doom. The balls are connected to a crane up above the scene and the dotted line shows their projected path. Feel free to drag the ball around to change the path as needed. Balls deployed to the left of center will swing in from the left (and vice versa). Timers indicate when the ball STARTS its journey (it always starts horizontal to it's anchor point way up high)...it may take a few seconds to swing down into view depending on placement. While these balls may slice through wooden structures like a hot knife through butter, sturdier materials and structures will cause them to bounce off like a bell clapper unless previously weakened by other devices. Combining multiple balls on a single level can cause destructive havok of unparalled proportions. Right click to remove from the level and regain your expense.

Screamer Click on any open area to deploy these noisy and expensive fellows. Note that they do not float and will fall/settle wherever gravity takes them. Whenever there timer expires, the emit about 3.5 seconds of destructive scream that will decimate structure around (and under) them. Extremely useful as a weakening tool, they can also be strategically placed and timed to clean up potential building structure that hangs above the line at the last second. Right click on them to remove.

Monday, May 25, 2009

My JavaFX Contest Entry Part III

JavaFX put the most smiles on my face througout the coding process since...well...since forever. I started with a sliding control panel with some sound effects (freesound.org is the BEST sound effects source there is) and glow/highlight effects for buttons. I was just in awe over how simple it was using JavaFX. Yes, I had some issues...to this day I still haven't mastered cetnering text nodes. :(

I absolutely RELIED on open-source or creative commons libraries like openclipart.org to get vector graphics that I could use or tweak with Inkscape for the game. I experimented with Inkscape's ability to export javafx classes but it just wasn't ready for prime time...so I exported things from Inkscape as PNGs and used themn that way. I still 'built' lots of UI elements with JavaFX's toolset...and of course of the mouse interactions and timelines made JavaFX shine.
I ran into issues with the physics engine that I found I could not solve. The phys2d engine (as good as it was) didn't expose certain elements that I would need to track (like current force or torque on a body). That was crucial for my breakable joints and destructible beams. In addition, once I started stacking things higher, the phys2d fixed joint tended to rubber-band things and yank beams out of position, flinging them into the sky for some reason. :(


I then spent a few days experimenting with jBox2d and found that it suited my needs better (and according to at least one benchmark , was faster handling larger numbers of objects...which I would ultimately need). In addition, their 'prismatic' joint worked really well for my weld joints (using a tweaked JointBreaker to monitor them) I spent 2 days tearingout the physics engine and getting things fxied up with the new one.
At some point in the development, I determined that the game wasn't 'fun'. Yeah...everyone likes blowing things up and knocking things over...but the pure 'simulation' nature of my creation was kinda boring. In intended to give the user a 'blueprints' view so they could see the relative densities of the various beams as well as the strengths of the joints so as to better set and time their charges. BOOOORRRRING....and way to much effort for the player for a casual game.

I was eating dinner with my five year old son and the idea came out of our conversation....."who doesn't like the idea of monkey's with hammers??". So a new game was born. You would still knock down buildings for fees...except now you would use monkeys with hammers...and lasers...and BunnyBall wrecking balls, and screaming babies....and giant beach balls and exploding balloons!!!


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.