Thursday, July 31, 2008

Stiria Website

I've gone ahead and set up a little website for Stiria at http://galacticicecube.com. Check it out!

Thursday, July 24, 2008

Quick code sample

A rather innoculous C++ class (of static functions) for placing/extracting 32-bit ints and floats to/from a C-style byte array. As mentioned in the comment, this was written for use in UDP network programming.

DEFAULTARRAYLENGTH is a constant declared elsewhere. It's helpful if the majority of the char* buffers passed in are of the same, fixed size.



/// implements some Bit library type functions for use with UDP/char* buffers

class PBitLib
{
public:

// assumes 32bit int
static void toBuffer( int num, char* buffer, int start = 0, int buflen = DEFAULTARRAYLENGTH )
{
if (buflen < 4 + start)
return;

int x = num;
unsigned char * bytes = (unsigned char *) &x;

for (int i = 0; i < 4; i++)
buffer[i+start] = (char) (bytes[i]);
};

// assumes 32bit float
// copies float into buffer from buffer[start] to buffer[start+3]
static void toBuffer( float num, char* buffer, int start = 0, int buflen = DEFAULTARRAYLENGTH )
{
if (buflen < 4 + start)
return;

float x = num;
unsigned char * bytes = (unsigned char *) &x;

for (int i = 0; i < 4; i++)
buffer[i+start] = (char) (bytes[i]);
};

// assumes 32bit int
static int bufferToInt( char* buffer, int start = 0, int buflen = DEFAULTARRAYLENGTH )
{
if (buflen < 4 + start)
return 0;

unsigned char bytes[4];
for (int i = 0; i < 4; i++)
bytes[i] = (unsigned char) buffer[i+start];

int num = *(int*)(bytes);
return num;
};


//
static float bufferToFloat( const char* buffer, int start = 0, int buflen = DEFAULTARRAYLENGTH )
{
if (buflen < 4 + start)
return 0;

unsigned char bytes[4];
for (int i = 0; i < 4; i++)
bytes[i] = (unsigned char) buffer[i+start];

float num = *(float*)(bytes);
return num;
};
};

Thursday, July 17, 2008

Stiria - Demo 1!

There's still work to be done, as mentioned previously, but I've decided to throw caution to the wind and release the first demo of this game.

STIRIA - Galactic Ice Cube game

Download here (Stiria.jar, 152 kB)

Phone requirements:

The game runs under Java Micro Edition. As such, if your phone does not support Java, this game will not run on it. If you're not sure if your phone has Java, you can do a few things:

  1. Take a look at what games/apps you have on your cell phone. If they mention Java when they start up, you have Java.
  2. Try to install it anyway. It shouldn't cause any harm, apart from the time it takes to try.

Apart from that, your cell phone should have a reasonable resolution, something in the range of 150x150 pixels (hopefully larger) to enjoy the game experience. That last phrase is code for, "if your screen is too small you won't be able to see where you're going".  However, the game should run, and if you want to chance it on a smaller resolution, go ahead.

The current version of the game has a maximum resolution (of sorts) at 400x400 pixels. I have not tested it at that large a resolution, but some graphics stuff is likely to be messed up.

How to install on cell phone:

Download the above .jar file onto your phone.  If you can transfer files directly from your computer to your phone, that will work as well. (in that case just download the .jar onto your hard disk, then move it onto your phone)

.jad installer - Certain phones may require an installer to help them figure out what to do with the .jar.  This is it.  Transfer it onto your phone with the .jar, then (if it doesn't auto-install), run it from wherever it is on your phone.

Hopefully these instructions are enough to get the game up and running.  If not, complain in the comments section of this post or something. Hopefully I'll be able to resolve most issues. =)

How to play

Okay, now that the lame stuff is out of the way, it's hopefully running on your phone.  You have no idea what you've gotten yourself into!

  • Control our nameless, heroic ice cube as he adventures in OUTER SPACE! Why is he in outer space? That's a mystery.
  • Up = jump.
  • Right = accelerate to the right.
  • Left = accelerate to the left.
  • Fire = attack with ICE FURY (less impressive than it sounds)
  • Select = pause/unpause the game.
  • Up, Down, and Fire navigate the pause menu.

Tips:

  • Space is an unforgiving place. A jump in the wrong place or at the wrong time may result in your heading in exactly the direction you want to avoid. So plan ahead! That's how NASA does it.
  • There's no direct penalty for dying, apart from forcing you to restart the level.  There are many hazards in space, including asteroids and fire.  Ice cubes happen to be very negatively impacted by fire.
  • You have a mini-map than can be accessed when the game is paused.  On the map, the center of the screen is marked as your current location.  Things marked with a light blue "X" will lead to the completion of the level.
  • There are two levels in total.  Both are rather difficult.

That's it! Have fun, and don't be afraid to die!

Thursday, July 10, 2008

Stiria - status update

Slowly but surely, the demo is approaching completion. There's some stuff that needs to be done but is best left until after the demo -- an overhaul of the slow collision detection code, for example -- but by and large it's getting very close to where I'm comfortable releasing it into the wild.

The current plan is for the demo to have two levels and a boss. Initially I had planned to have a single level demo, but I don't want to waste anybody's time by making the gameplay shorter than the download time. =)

Stay tuned.