Archer Fish: High Score

The History

On the Summer Break of 2011, I was working on the SeiON sound engine and the High Score of Archer Fish.

The High Score system would come with achievements for completing various parts of the Game. Some of them were standard, like a Star for finishing each round of the game or achieving a score of 9999. Some were challenges, like shooting down 20 Flies from behind. Others were silly, like not having eaten a single Fly throughout all 9 stages of the game. All of these Achievements required the user to play through the game in one sitting, or restart from round 1.

Users could choose to use their DeviantART id to sign their name in the high score table. If using DeviantART id, their deviantART avatar would be fetched from dA and displayed in the high score table.

Users will be ranked by day, week, month, all-time. They can be sorted by raw score, or by achievements.

The High Score Table would be powered by MochiScores. The high score is 13 digit number encoded with a 6 digit numeral score and several boolean values representing the status of achievements.

I wasn’t able to finish it before school started and me taking a 4 month long hiatus. But at the end of those  months, I was ready to stop development there and then, and prepare to release Archer Fish. Why?

Taking Far Too Long

I have been working on Archer Fish since 2003. Surely doing it into 2012 wasn’t that much of an issue?

Thing is, 8 years is far too long that I’m not longer passionate about the game. I do get a sense of passion and pride when I fire up the game and play it – it looks incredible.

That said, looking so incredible as it is already, I feel that my work here is done. The core gameplay has already been refined, everything, yes everything, is finished. To be bogged down by a High Score component that was growing over 3000 lines of code (the core game was only 10,000 lines) with no end in sight was ridiculous. Enough is enough.

Marginal Worth

While achievements do enhance gameplay, their worth lies in a sense of accomplishment. A high score table allows them to flaunt it. But the achievements are either unremarkable, or ridiculously hard. I could weed it down to a few, but then the achievements would also feel too insubstantial for the effort needed.

Moreover, is my game going to have that many players? It would be embarrassing to have a High Score Table with very few entries. This is especially glaring in the Daily/Weekly score sections.

Pity

I already deleted the High Score component from my harddisk, but it is a pity in a way. I spent quite a lot of time developing the images and the code, and it seems a waste to delete it. What I regret though, is that I ever decided to make a high score component. It was such a pain. I think what I took away, was a new respect for those who do interface design and backend, in raw code of course, without an interface layout manager. That’s what I did. Unconventional, but I think there isn’t much choice when dealing with interfaces in games.

Tags:

Archer Fish: The Features

Some details about Archer Fish:

  • Started in Yr 2003, Finished in Yr 2011
  • Redone 4times from scratch
  • Contains 10,948 lines of code across 78 files/classes, not including libraries

Shooting Mechanics

In my previous post, I mentioned about the old shooting mechanics of the old versions of Archer Fish. I noticed that while Version 3 was certainly better made than Version 1, it wasn’t as fun. Being able to shoot-on-the-move (SOTM) at aerial targets (lol) was much more exciting than having to stop and shoot.

It turns out it’s thrilling to play it fast and hard, and just use your luck to get as many flies as possible while trying not to have to stop. It is also not as game breaking as I thought it would be.

Fly AI

The Flies are using a modified version of the Sinusoid algorithm this time. While using a fixed sinusoid was nice, it didn’t behave like a Fly. Not as much as I wanted it to, at any rate. So I dumped the sinusoids.

Bezier Curves Animated Quadratic Bezier Curve

Bezier Curve. P0 is start , P2 is end, P1 is control point.

The current AI uses Bezier curves. Each Fly is using a Flight Path, which consists of a Start Point, an End Point, and a Control Point. The latter refers to the Control Point of a Bezier Curve. When a Fly finishes its current Flight Path, it will construct another Path.

This new Path can be constructed to flow naturally from its previous old Path. This is done by extrapolating the new Control Point from the old Control Point. Simply, we draw a line from the old Control Point to the old End Point. If we mirror this line and extend it, it will point to our new Control Point. For example, from the above diagram, if we duplicate and extend the line P1P2, we would get the position of the new control point.

The new Start Point is also the old End Point. Hence we just need to randomly assign a new End Point, and the Fly will be able to flow smoothly from its old Path to the new one.

Coding this was a real pain since I’m not good at translating Maths to code, but I’m really pleased with the results. Even with a lot of Flies, the result is a form of orderly chaos and really feels like real buzzing Flies!

Sound

Never having had any experience controlling sound using code, I was quite surprised that I ended up coding an entire Actionscript Sound Engine. It’s just that the music code in Archer Fish grew so large and complex, that I thought, heck, why not just rip the whole thing out and dress it up as a sound library?

So I did. The refinement of SeiON, the sound engine, took me 1.5 months I believe, but I’m pleased with the end result. What I have now is a rather reliable and simple sound engine. Problem is, with Flash’s waning popularity I’m not sure if I have any Flash projects left to use it for! :(

Water Ripples

This was one of the things I redid Archer Fish for. It was quite complicated, till date I do not really understand what’s going on behind the scenes.

All I know is, given a background image, firstly, I outline the water areas in Flash using black colour. Secondly, using Pixel Bender, a form of Shader code (gasp!) I copied the pixels outlined in Black and put it in a new image. Kinda melodramatic that I’m using Shader for such a rudimentary function, but it worked.

Thirdly, I applied the Ripple generator onto this duplicated part of the image. It seems to work using Perlin Noise and Displacement Mapping, but that’s all I can figure out.

The end result was kinda taxing on the Flash Player, so I sampled down images whenever I could, and eventually got it to a workable state. It still needs a good CPU though, so I made the default non-ripple, otherwise the game would be laggy for most people.

To be continued…. —–>

Enhanced by Zemanta

Tags: ,

Archer Fish: The Motivation

I figured this might be a long post so I’d better split things up.

What It’s Supposed to Be

It was back in 2002 when I had just finished the Platy’s Journey series of games. I was getting bored at how simple my games were, being linear and basic (ie. the game was dictated by me, not the player, and the game mechanics was just a simple collision test between mouse and sprites). I wanted to do more, to break out of the mould of my game just being an interactive Flash Movie.

English: Archer Fish Polski: Strzelczyk Latina...

Image via Wikipedia

So I made the first iteration of Archer Fish in 2003. It was called Arching the Fly, “Arching” as in Archer Fish shooting the fly. It was intended to be short discourse for me, to get the experience of  programmatically controlling Flash.

However, I wasn’t satisfied with how the game looked. Back then I had next to zero drawing ability, so the graphics looked terrible. The AI wasn’t very smart either, and game play mechanics could be better.

I would have worked on the same code base again. But unfortunately my computer crashed and I lost all my code. So I had to redo, and I resolved to make a newer version of the game.

Version 2

Not much can be said about Version 2 of Arching the Fly, because while making the prototype I quickly ran into a technological barrier.

What Version 2 was supposed to be, is a top-down shooter. Instead of the original sideways shooter, now the player controls the fish from a top-down view. By rotating the fish to face each of the 4 directions, he will shoot straight at the flies around it. A bit like the Asteroids game.

Unfortunately, Flash couldn’t handle the way I did the game. I drew a huge picture to act as the background. This picture would scroll up/down sideways as the player moved around, and the scrolling taxed Flash Player heavily.

The right way would have been to use blitting, but even now I still haven’t succeeded in blitting techniques yet. Hence, it was fortunate that Version 2 died before it could “epic fail”, so to speak.

Version 3

Version 3 was right on the heels of Version 2, and I used much better animation techniques and graphic assets.

The Flies received better AI control in the form of a sinusoidal function that is unique to each Fly. The concept of a Bonus Fly and Baby Archers were introduced.

I added a new shooting mechanic where the Archer Fish has to stop moving in order to shoot bullets. It was done partially to deter players from potentially shooting on the move, which I thought was very hackz.

I wanted to add in a Piranha version of the game, where instead of docile Baby Archers, a Piranha would disturb the player. But the game got so terribly buggy that I couldn’t develop it properly so I abandoned the game.

Note that on DeviantART, I uploaded Version 3 as Aqua Archer v2.0.

Version 4

A few years later, after I went training deep in the mountains with C#, Java and C++, I came back and learnt Actionscript 3, and set forth to redeveloping the Archer Fish Game.

And yes, I renamed it, because it’s old names “Arching the Fly” and “Aqua Archer” were very corny. “Archer Fish” is a better fit, nothing beats literal names after all (as described in tips to naming a  manga series – when in doubt, name it after the main character like Naruto).

—> To be continued….

Enhanced by Zemanta

Tags: ,

Thinking..

For me, Flash remains a viable strategy for deploying applications on the desktop and on the web using just a single codebase. If needed to, it can also develop for Android and iOS via AIR, though the latter is highly unlikely given its entry cost.

Corona (software development kit)

Image via Wikipedia

If Flash is not feasible for mobile development, I still can use Lua via Corona SDK, which I have a faint grasp of. Still not free though, since releasing on any App Store would require upgrading the Corona license to a premium one.

HTML 5

Another alternative is HTML 5, which can run “anywhere” and performs “better” than Flash. Emphasis on quotations.

I’ve been trying to find a good JS game library, because there are just so many things that do not work out of the box in Javascript nor HTML 5. Unless one enjoys reinventing the wheel or simply to serve the most technological advanced (and smallest) demographic, engines and frameworks need to be involved.

For JS Game libraries I saw that there was (in ranking):

  • Akihabara (very basic 2D engine, but extremely cross-platform)
  • CraftyJS (really popular and regularly developed, but full of dead links)
  • LimeJS (needs Python to compile)
  • GameQuery (Feels undeveloped – 9 Git commits in a 1-year span)

That’s about what is generally recommended so far. Surprisingly there are very few Google hits on JS game engines and StackOverflow.com in general.

That got me thinking that maybe most people do not rely on Game Engines, but rather mash different engines together. If so, then this is my new Javascript stack:

  • jQuery (DOM manip and animation)
  • EaselJS (gSkinner’s AS-themed Canvas library)
  • SoundManager 2 (HTML 5 Audio with Flash fallback)

With this mashup, it’s almost like what a bare-bones Flash runtime is. I say almost, because it’s still lacking some things like video support. But this is still enough to get things done.

Adobe Flash Player Icon

Image via Wikipedia

 

I’m not switching to Javascript development anytime soon though, as it just does not have the raw processing power and demographics that Flash can provide. But since HTML 5 is the new Web, I would have to start learning it soon since my XHTML knowledge is getting really old now.

Enhanced by Zemanta

Tags: , ,