Update Sunday January 22nd, 2012:
I was able to check a few items off my to-do list this week:
- wrote sprite animation loading system that loads sprite animations given path
- wrote animation clip routine
- Fixed bitmap display to work with OpenGL
- Added reading of top and left edge of sprite to encode and set hot spot.
- Implemented pixel-accurate point vs sprite hit detection routine.
Currently the app looks like this:
The graphics are entirely temporary. The background was taken from an image I found online, and the sprite is from an old, old engine test that was never completed. The pirate graphic will be another half again as tall, and much wider.
The graphics exist as script-instantiated objects. The script is a very C-like, with concepts from Python thrown in as needed. The goal is to have a script system that is very tied to the object model of the underlying engine so that a minimum of code needs to be written to interface with the world representation. Also C has crap for string manipulation, so the script interpreter is designed to handle strings as painlessly as possible. The code that creates the above image looks something like this:
#include "./scripts/widgetConstants.rsh"
script createPirateMainInterface ()
{
print ("Calling createPirateMainInterface\n");
string strMainInterface;
strMainInterface = uiContextCreate (name="pirateMainInterfaceContext");
uiContextPush (name=strMainInterface);
// create the attrs that will serve as the interface to the uiContext objects
// that are part of rvnMainInterfaceContext
createAttr (ln="bgFile", type="string", node=strMainInterface);
// background image
string strBitmapCtx; strBitmapCtx = "pirateGameContextBG";
createNode (name=strBitmapCtx, type="bitmapContext");
connectAttr (strMainInterface+".bgFile", strBitmapCtx+".fileName");
uiContextShowNode (node=strBitmapCtx, depth=0.0);
strMainInterface.bgFile = "gfx/bg_half.tga";
// pirate image
string ctxRig;
ctxRig = createNode (name="pirateRig", type="spriteContext");
ctxRig.tx = 0.5;
ctxRig.ty = 0.85;
uiContextShowNode (node=ctxRig, depth=1.0);
ctxRig.fileName = "gfx/man.stand.1x1h.tga";
// placeholder for game interface (currently a yellow square)
string ctxPirateGame;
ctxPirateGame = createNode (type="pirateGameContext", name="pirPirateGameContext");
ctxPirateGame.size = "240 400";
ctxPirateGame.sizer = 0;
uiContextShowNode (node = ctxPirateGame);
print ("Exiting createPirateMainInterface\n");
};
A good chunk of my time this week was also spent upgrading to a new computer. My previous desktop was about 10 years old, and my main development machine over the past few months has been a Toshiba Netbook. That actually worked out pretty well since I did most of my coding while commuting on the train each morning and evening, but now that I'm getting back into dedicated coding at home I needed something a bit more modern. My old machine ran the current app at around 50 fps. My new machine clocks in at 630 fps. Niiiiiiice. I'm also happy to be moving from a single core machine to a multiple core machine, so I can run processes in the background that don't kill my foreground work.
Anyways, it took a couple of sleepless nights to put the computer parts together, install Ubuntu and all the graphics/sound/development programs I need, and transfer all of my code and utility scripts over to the new machine. I also had to rewrite the rsync wrapper script that I use to keep the netbook and the desktop machines in sync, especially since I now have to be able to target multiple desktop machines (my old machine is now going to serve as a file server).
The only downside is that my Maya license is on the old machine and it is so old (Maya 7.5) that I'm not sure if I can transfer the license to the new machine or not. So if I do the pirate graphic in 3D, I'll have to run Maya on my old machine or have to come up with a modeling/texturing/lighting/rendering solution on the new machine. Blender could be an option, but I don't know if I have the time in my development schedule to ramp up in time.
So that's where I sit now. Next on the to-do list is to write a unified event handling structure (so I can call an onClick script method when the sprite is clicked on, onDrag when the sprite is dragged, onSwipe when the user swipes their finger across the sprite, etc.), and to make sure I can trigger both animations and sound playback from the callback methods. After that I need to design the pirate and other objects in the app, and start roughing the temp graphics into the game to prototype playablity while I start work on the finished graphics.
Cheers,
Michael