Tuesday, November 29, 2005
Innovative, enjoyable Games
Ha! Interesting they should mention "No One Lives Forever". I just picked that one out of the bargain bin on PS2 for a Christmas Present. Hope that this version is as good as on the PC.
The FPS games that really took my notice of late is the Splinter Cell series, which very effectively uses excellent AI and the new lighting technology of today's GPUs to create an immersive story-driven game experience with an extra dimension - that of true stealth and espionage. The other game I really enjoyed from it's storybook feel, interestingly from the same developers, was Prince of Persia, the Sands of Time. (Such a disappointment that they felt to turn up the gore and somewhat lose the fantastic epic adventure storybook feel in the sequel. This shows where the focus of the industry lies nowadays.)
Games having true invention like this are becoming more and more rare. The newer game types are coming with new kinds of input device, and in some cases inventive use of new technology enabled by the hardware. Truly original game experiences of late have been things like Dance & Karaoke Revolution series which use floor mat and microphone as input devices and games that use a camera (like the EyeToy) to detect physical body movement. I am looking forward to trying the EyeToy out with my family this Christmas.
My list of truly inventive games over the years starts with Elite. The game that realized the one of the most powerful aspects of game design is imagination. The true skill of game creation is to unleash that power within the gaming environment.
Other games showing true innovation to create a truly memorable gaming experience that come to mind are Lemmings, The Incredible Machine (and it's classic comical counterpart The Incredible Toons) and Battlezone 3D by Pandemic.
Friday, November 25, 2005
Howard Jones - Revolution of the Heart
Howard Jones is my favourite music artist. He makes us wait for his new stuff, but when it comes it doesn't disappoint. You can't rush art.
His new CD came out recently and is available from Howard's DTOX webstore,
Revolution of the Heart (Limited Edition)
and from Amazon.ca:
Revolution of the Heart
This album is a back to the roots rich electronic production with thumping beats and filled with Howard's signature catchy uplifting melodies. It doesn't feel formulaic, however. As I have come to expect from Howard, the lyrics are thought-provoking and topical. This is not shallow lovey-dovey manufactured pop.
It's fresh and smart with a lot going on in the production department to keep it interesting on subsequent listenings. It's definitely a grower, and you'll find yourself singing the tunez long after you've left the house.
There is not a bad track on the album, and it's obvious that Howard and his co-producer Robbie Bronniman have put their heart and soul into every aspect.
"Celebrate Our Love" is a strong intro track. I also much like the first single, "Just Look At You Now", the title track "Revolution of the Heart", and especially "Stir It Up", which I think would make a great single if Howard manages to get back in the limelight with this one.
The album doesn't slow down and you are left with the strong driving beat of "For You, See Me" ringing in your ears and a voice inside you saying "That was great - let's do that again", as you almost subconsciously reach for the Play button to restart the experience.
I got hold of the limited edition Australian release which has a bonus CD containing dubs and remixes. Of the new tracks, the John B Drum and Bass mix of "For You See Me" is the only ROTH track that I really prefer to listen to over the album version. It is extremely catchy and danceable and actually enhances the album track. The remixes are meant to be danced to, and are probably great for that, but are a bit repetitive when they are just passively listened to. We have more than just remixes of new tracks. We have some new takes on classics like "Things Can Only Get Better" and "What Is Love". The other highlight of this disc, is the remake of "Like to Get to Know You Well" by The Young Punx called "Slip Away" which they released under the name "Mohito".
This is a great new angle of a classic song in the vein of many other similar tracks which are reviving the dance clubs with a fresh rejuvenation of classic 80's tracks.
The Australian release can be found here:
Revolution of the Heart [Import]
Thursday, November 03, 2005
Bag that! Eclipse way off base with Visual Editor.
The AWT GridBagLayout has been around for a long time. It takes some getting used to but once mastered is the mother of all layout managers, enabling just about any configuration of components
... and that's the problem...
all too often what you get is not quite what you want.
The quirks of the GridBag are well summarized by Totally GridBag a must-see animated blog by a developer who probably discovered a better way! (...more about that at the end.)
For anyone who's tried, a few helper classes usually are in order to prevent the types of problems that guy was having, as is well described in the 1000-page book "Master the GridBagLayout in just 99 days", which has 10 chapters on the idiosyncrasies of the 101 parameters of the GridBagConstraints class. (The book doesn't exist - I'm still writing it. Or rather, Eclipse is. They have probably added about another 5 chapters with their new Visual Editor.)
So with the GridBag being such a veteran of the Java world, you'd think that they might have actually have got somewhere with Visual GUI Designers by now. So after seeing the new features of the Visual Editor, keenly I download the Eclipse plug-in with high expectations. And at first it's not bad! I manage to develop a pretty neat looking GUI which allows me to add components here and there. My previous knowledge of GridBag helps me out, I'm sure - so I'm not sure how a newbie would fare, but all-in-all, Good stuff. Much better than writing all that tedious UI code, even with helper classes.
UI looks good, time to save & go home.
Next day - Katrina strikes. I open up the Visual Editor once more to add a few buttons and some new fields. So I start plopping a few components onto the canvas. All looks good. Go to save my work and "Oh no!" dialog pops up. "The class you are trying to save has compile errors - Proceed?"
What the heck kind of code has this thing been writing behind my back? So I go into to see my code in tatters. Not only has it hashed things up, it has done so royally. I find references to contraint objects that weren't created, and much, much worse, generated code inserted in the middle of other code, even inserted into comments. So I back out the changes, one undo at a time to see the UI in the visual view disappear right before my eyes. Now that's toally messed. Good job I didn't save the thing half-way through!
So a little more evaluation leads me to discover that:
- it's almost impossible to make changes to my UI in its current state (every time I try the code is inserted at the wrong place),
- the code it generated even before the compile errors is so messy and convaluted it's not even worth trying to maintain by hand and,
- the grid references in the GridBagLayout have gaps.
(I also found issues with how the vanilla GridLayout is handled too, but this blog is too long already.)
Time to find a better way.
Enter the TableLayout manager. It's been around for a long time, almost as long as the infamous GridBagLayout. Maybe everyone else knows this already and I'm slow on the uptake...
A little planning up front is always a good idea. For this layout, you want to have a good idea of how many rows and columns in your grid up front.
Add your row and column dimensions as arrays of doubles. For each dimension, specify absoutes as positive integers, percentages as a decimal between 0 and 1, or get it to respect PREFERRED sizes or FILL available space.
Components are added using a formatted string convention in the constraint argument:
"1,3" - add component to col 1, row 3
"1,3,4,6" - add component to col 1, row 3; spanning cells to col 4 row 6
"1,3,R,T" - add component to col 1, row 3; horizontal align right, valign top
"1,3,4,6,R,T" - all of the above
Here's a snippet:
TableLayout layout = new TableLayout();
layout.setColumn(new double[]{TableLayout.PREFERRED, TableLayout.PREFERRED});
layout.setRow(new double[]{TableLayout.FILL});
layout.setHGap(4);
modulePanel = new JPanel(layout);
modulePanel.add(new JLabel("Action:"), "0,0");
modulePanel.add(new JButton("Click Me"), "1,0");
or if you prefer:
...
double[][] colsRows =
{
{TableLayout.PREFERRED, TableLayout.PREFERRED},
{TableLayout.FILL}
};
TableLayout tableLayout = new TableLayout(colsRows);
modulePanel = new JPanel(tableLayout);
modulePanel.add(new JLabel("Action:"),
new TableLayoutConstraints (
0,0,0,0,TableLayoutConstants.RIGHT, TableLayoutConstants.TOP
)
);
modulePanel.add(new JButton("Click Me"), new TableLayoutConstraints(1,0));
...
This definition string thing feels a little strange. But in practice it's a nice, welcome shorthand.
However, if you want a more conventional, type-safe API then the TableLayoutConstraints object can be utilized instead.
This grid doesn't care if there are vacant cells. It doesn't even care if there is more than one resident in the same cell - it will render them all!
Add some padding to the layout with HGap and VGap, and either add a standard border or create a margin by adding blank rows and columns around the edge.
Did I say 'adding rows and columns'? I certainly did! this puppy allows you to create your component grid and then mess with it dynamically after the fact in code or at runtime! They even have an example of how to create animation in the grid by messing with the settings in real time.
Some observations:
The documentation thinks it's a good idea to add blank columns and rows as borders. I don't have an issue with having the option to do it, but Borders are also a viable option that shouldn't be overlooked.
The TableLayout guys present the layout manager as a one size fits all solution, and see it as an advantage to not have to use nested layout managers. I think that nesting layout managers is a wise technique for complex forms, whatever manager you use. The good news here is that TableLayout is often a better (or at least equivalent) alternative to the more simple layouts like FlowLayout, BoxLayout and GridLayout and even BorderLayout. So my gut feel is that nesting TableLayouts sensibly is good advice. (For example, when you find yourself adding a column for one field and you find that every thing else has to be adjusted to span it.)
This is almost an aside, or maybe a note-to-self: Managing layouts during development is almost always a pain when you want to add a field in the middle of a bunch of other fields. A technique to add the components from a dynamic array or collection would not be a waste of effort in conjunction with this layout manager, IMO.
Baffles me why this hasn't been adopted by Sun so everyone can benefit?