Wednesday, 30 March 2011

Post 6 - Analysis and Game Progress

After a brief hiatus for various coursework assignments and group projects, work has resumed on the project.

Animation Creator
A large part of the animation creator code has been completed. This part looks at the frames generated by the background creator, and searches for repeating patterns to use as animations. The code here seem to work, except for two problems:
  1. An implementation for choosing letters from an alphabet using some sort of even distribution hasn't been written yet. This is crucial to finding appropriate matches, and without it typically everything is found to match (almost) everything else!
  2. The original videos captured for this project probably aren't working particuarly well with the current algorithm. The algorithm will work best with some sort of structured, repeating pattern of various different moves, while the current videos are a bit haphazard and random. A re-shoot is in order.
As a result, when the current implementation runs it finds lots of matches, but none of them are very useful!

Game
Whilst the animation creator is still being completed, I thought it would be a good idea to start work on the actual game itself. Plus there aren't many pictures to show you for the animation creator, and we all love pictures! So here we are (click to embiggen):




Currently you can move left/right, crouch, and punch. There are no animations, hit boxes, or a lot of other things, but it's a start.

As an aside, if I can't get the game up to scratch, I've started looking at an alternative to place animations in. jmugen looks promising, if a little involved.

Tuesday, 15 March 2011

Post 5 - Populating arrays (again)...

Quick post of a discovery. Yet again I want to create a (comparatively) small array, and initialize it to contain 'false'. In a previous post I discovered the way to do this is:

Boolean[] mask = new Boolean[maskSize];
for (int j = 0; j < maskSize; j++) {
     mask[j] = false;
}

In my travels across the interwebs I have also discovered another way to fill it, which looks a bit neater:

Boolean[] mask = new Boolean[maskSize];
Arrays.fill(mask, false);

I do enjoy cutting down for loops to single lines. However, digging a bit deeper, Arrays.fill() simply uses a for loop inside it, so usually runs in the same time. Worse though, (at least in eclipse) when Arrays is first called, presumably it must load the class, which puts another overhead, increasing the runtime by quite a lot! I suspect if you were to compile it to a .jar file and run it, either way would be equivalent, but seeing as I'll mostly be using this in eclipse I might as well leave it as a for loop!

As an aside, some of my posts here are actually quite embarassing, but I figure if I don't post embarassing stuff, I'll never learn! Not to mention this blog would be a lot shorter too!