Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1076049 Posts in 44157 Topics- by 36124 Members - Latest Member: Fitzgerald

December 30, 2014, 04:41:55 AM
TIGSource ForumsFeedbackDevLogsToy Pirate
Pages: [1]
Print
Author Topic: Toy Pirate  (Read 559 times)
mduffor
Level 0
**



View Profile WWW Email
« on: January 17, 2012, 11:42:43 PM »

Greetings all,

I'm just now getting back into game development after a long hiatus, so I thought I'd start with something simple.  I'm starting development on something that is not so much a game as it is a toy.  If you've ever played with Talking Carl or Talking Tomcat or the like on a smartphone/tablet, that's the direction I'm going with my first project. 

The good thing about writing a toy instead of a game is that 1) higher chance of finishing it soon since there is less to it, 2) I can learn Android and iOS development, and the ins-and-outs of having something in the app store, and 3) gives me a platform to test out my sprite, script, animation, sound, interface, and overall framework routines on a wide audience.  This way I'll be working from a stronger base once I start in on larger games.  I've also set myself a goal of finishing this entire project by mid-March, so that only gives me about 8 weeks of development time, all while holding down a full-time job.  Should be interesting.

Design:

This toy will consist of a background scene with a foreground character laid over it.  The character can be interacted with via the touch screen of a tablet/phone (or mouse during testing), and it will respond to touch, swipe, multi-swipe (series of swipes in the same direction), and rubs (back and forth swipe).  Depending on where the character is interacted with, a different sound/response and animation will be played.  For example, if you poke him in the eye, he will cry out "Stop poking me in me eye!" and an animation of him closing his eye and reeling back will play.

Planned Animations:
  Idle
  Blink
  Speaking
  Listening
  Poke in the eye / eyepatch
  Poke in the head to hear randomly chosen phrase
  Poke in the belly to knock the wind out of him
  Rub belly to tickle
  Swipe hat to knock it off of his head
  Poke leg/foot to make him hop on the opposite foot and hold the painfully poked one
  Swipe to knock off balance / off scren
  Swipe belly to spin him
  Swipe body to throw into the air
  Flick sand to kick it at him
  Swipe parrot on shoulder down to soothe the bird
  Swipe parrot up to ruffle her feathers and make her squawk.
  Poke parrot to hear randomly chosen phrase.
 
Art:
  The current plan is to model, rig, and render the characters in a 3D program, likely Maya.  This may change if I'm unable to transfer my Maya license to my new machine.  In the meantime, I will prototype the engine/routines with quick mock-up art.  I still need to design the look of the character and environment, and though I don't know exactly which direction to go yet I know that it must appeal to a wide audience and to children.  My 2 year old daughter and 5 year old son will be the primary beta-testers. :-)

Tools: 
  My current platform is Ubuntu Linux with the XFCE window manager.  I'll be using the gcc compiler and open source art tools (except for Maya, for which I have an old license).  I plan to develop and test natively on Linux, and then sometime soon port it over to Android utilizing the native SDK so I can write in C++.  My long-term plans require that I get my code libraries working on Android and iOS devices.  Once the toy works on Android, I'll look at porting to iOS/iPad.



Well, that's the rough plan at least.  My current status is that I have the sprite routines, scripting engine, immediate mode GUI widget set, rough sound playback routine, and overall framework running on an SDL/OpenGL base.  Game-wise I have a screen in a lovely shade of blue, and that's it.  Time to get cracking!

Cheers,
Michael
Logged

Blog + website = www.mduffor.com
mduffor
Level 0
**



View Profile WWW Email
« Reply #1 on: January 22, 2012, 02:10:08 PM »

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:

Code:
#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

Logged

Blog + website = www.mduffor.com
mduffor
Level 0
**



View Profile WWW Email
« Reply #2 on: January 30, 2012, 04:27:56 PM »

Update: Monday, January 30th, 2012

I need to make sure I stay in the habit of updating this thread so I stay focused.

Didn't get to work a lot this past weekend, since I had to work a full day on Saturday (yea! crunchtime), and Sunday was eaten by laundry/kids/life. 

Since last update I have
  • Completely re-written my mouse handler so it tracks mouse movement and button history.  This allows me to detect when the mouse movement is in a "slashing" state.  Also added support for mouse wheel and the framework for storing stylus pressure (possibly for future games).
  • Created a unified callback system so that sprites, bitmaps, 3D models, etc. can all react to the same interaction messages.
  • Implemented a sample script to handle these callbacks and trigger animation/sound playback.
  • Installed the Android SDK
  • Began implementing a particle system that I had spec'd out years ago but never found the time to work on.


I've also started studying the newer versions of OpenGL to get caught up with the changes since 3.0 rolled around.  I'd been aware of how the API was changing, but hadn't needed to use it.  So now I'm getting caught up to the point where I can use the new features/approaches.

Here's an example of my scripting language handling the callback from an onClick() event.  I haven't implemented an object oriented object system per-se, but if you access a string with the "dot notation" then it treats that string like a node name, and de-references it into the actual node in the world representation. 

Code:
script gstPirateBody (string strNodeNameIn)
  {
  print ("Calling gstPirateBody\n");
 
  int  iNumMilliseconds = shellGetMilliseconds ();
  int  iLastMilliseconds = strNodeNameIn.lastActionTimeMs;

  // only allow clicking once per second
  if (iNumMilliseconds - iLastMilliseconds > 1000)
    {
    strNodeNameIn.lastActionTimeMs = iNumMilliseconds;

    playSound ("sndPirateArr", 0);
    };
  };


The "brains" of the actor will be stored here, and this system should work well for future games as well.

That's all for now. 

Cheers!
Michael
Logged

Blog + website = www.mduffor.com
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic