Using Production Suite from JavaFX for Gaming Design Concentrate on the Logic and Effects; Leave the Heavy Lifting to the Graphic Artists
The Production Suite is a powerful though not well known feature of JavaFX, one that enables gaming designers to concentrate on the logic and effects of their game while leaving the complexities of the design to the expert graphic artists. The Production Suite, writes software architect Jim Connell, delivers a JavaFX UI design tool that he demonstrates in creating a simple dice game using an elegant UI produced by a real designer. "Accomplishing a design like this in pure JavaFX would be almost unthinkable. Using the Production Suite though, this task becomes not only possible, but almost trivia," Connell writes.
Connell's blog includes a demo, "Pig the Dice Game" that readers can download and play for themselves. Users will need to install the following software:
NetBeans IDE 6.5 for JavaFX
JavaFX 1.1 Production Suite
(Optional) Adobe Illustrator CS3. If you’d like to open the asset and manipulate it yourself. You can also gain limited viewing of the assets by double-clicking on DesignerBoard.fxz in NetBeans.
Connell provides a link to the source code for the application, the structure of which is a standard NetBeans project layout, with the addition of a directory to hold the artwork.
The author explains that the Production Suite allows users to conveniently connect to assets designed in illustrator through the UI stub. Often though, it will be necessary to modify the design programatically before using it in an application. Including some small animations without making full-fledged classes for each animation and effect might be attractive, for example, or applying some translations and also hooking up the button states. One way to isolate the changes you need to make from the DesignerBoardUI stub, is to place them in an adapter. Our adapter will be responsible for picking which nodes go where, Connell writes.
Using an adapter also has the added benefit that one can also use multiple designs in the same application, even if the names of the nodes don’t quite match in each design. One could potentially add more than one design to the application. As long as each adapter provides the same interface to the rest of the application, users can simply plug in the appropriate adapter on the fly. Using this approach enables one to produce designs targeted for specific devices such as the Desktop or Mobile.
Connell next considers the game's controls and supplies the code for the PlayerMarker, ScoreControl and Button controls, noting that one can apply a JavaFX Scale Transition to a node though, unlike many other animation examples on the web, this transition can be applied to a node created in Production Suite.
Connell points out that the JavaFX code for the entire application is around 800 lines of code. If you consider that number includes all of the comments, the automatically generated DesignerBoardUI.fx and the re-usable Button code, the source code would be less than 500 lines of "new" code that results in a complete game.
Production Suite frees designers from the burden of laying out the UI, instead allowing them to go through several designer/developer iterations with almost no effort. The code merely focused on the game logic and the dynamic aspects of the game itself.
Customized news reports about Sun Microsystems. Just the news you need, none of what you don't. 50,000+ Members. 20,000+ Articles Published since 1998.