16 November 2009

Hedgehog-Headed?

One of my favourite subjects is etymology. I was reading the dictionary recently, and came across a little tidbit that caught my fancy, and I thought I'd share it.

caprice

n
1. impulsive tendency: a tendency to sudden impulsive decisions or changes of mind
2. sudden change or action: a sudden unexpected action or change of mind
3. whim: a sudden idea, impulsive decision, or change of mind

Well, it's not too far a stretch to describe Sonic the Hedgehog, especially as the modern Sega portrays him, to on occasion be taken by caprice. So I was amused to read the etymology:

[Mid-17th century. Via French from Italian capriccio, literally "head with hair standing on end," from capo "head" (from Latin caput) and riccio "hedgehog" (from Latin (h)ericius)...]

Encarta ® World English Dictionary © & (P) 1998-2004 Microsoft Corporation. All rights reserved.

So, someone who is capricious is literally "hedgehog headed". It's a funny language we speak!

14 November 2009

Game Review: Sonic Boom

There's a new hack on the Sonic scene - Sonic Boom. It's been three years in the making, the brainchild of snkenjoi and iojnekns, with music by Tweaker and a host of others. It's not finished - it's only a single zone demo, but it's a big release for the community and deserves a full review.

The first thing I did after firing it up was to check out the Sound Test. I was met by a bevy of expertedly ported songs, mostly from the Megaman X Series, and a kickass (if a little wandering) original composition by Tweaker. The best of all, though, has to be the 16-bit versions of the "Sonic Boom" vocal tracks from the North American Sonic CD sountrack. Both the intro and outro versions are included, and they simply shine.

Then I returned to the intro to check out the game itself. I have to lodge a minor complaint here about the two options on the intro screen, though. Since there are only two, there is no way to tell which is highlighted and which is not - like all those bad DVD menus we have to struggle with. I would have assumed the lighter colour to be the selected item, but it wasn't. Furthermore, since the game remembers where you left the "cursor", and I wasn't expecting this, I went straight back to the Sound Test by accident when trying to start the game. I'll let this slide, though, since the finished version will most likely have more than two options here.

Now for the game - or rather, the zone: Power Plant Zone.

First, the art:

I have to be honest here and say that I'm disappointed by the visuals. The foreground art is nice enough, and so is the background art - but together they create a colour scheme I'm not sure works at all. It's generally not a good idea to have all three primary colours in the same scheme, and the addition of both bright whites and dark greys doesn't help matters.

Sonic's sprites are slightly better, but I have a few beefs with them, as well. For one, I think he's too dark, especially for the dark background of the zone. Also, I've never been a fan of the green eyes. On the more technical side of things: because he faces away from you when he takes damage, and he remains facing straight ahead (instead of looking at you) when he enters his waiting animation, he loses some of the expressiveness, and therefore appeal, that the original Sonic had. A distant, uninterested looking Sonic with low contrast in the eyes and face can throw a pall over the whole thing, breaking your connection with the character on the screen, and thereby your engagement in the game. This is why I've always preferred the Sonic 1/CD style sprites to the Sonic 3&K ones. I'm not advocating replacing Sonic Boom's sprites with Sonic 1's - I like the fact that they're different - but I do think that he needs to be a little more expressive and attitudinous. Also, the raised arms in the springing animation look retarded, but that rounds out my criticisms for the sprites. To end on a positive note, I like the way the kicking animations look, and the combination of Advance style sprites with the classic set is clever and rather seamlessly executed.

The bosses look absolutely fantastic, though. The shading is very well done, but of course they're perfectly round, so we'll just have to wait and see if later, more complex bosses come out as nice.

And now, the gameplay:

One of the first things to be learned about Sonic Boom is that there are new moves for Sonic to perform. And unlike a lot of hacks, you'll be needing - and in fact, wanting - to use them.

The Super Peel Out and Spindash have been included, which is pretty standard, but also pretty nice, and Sonic now has a double jump (much like the Electric Shield affords him in Sonic 3&K, only it takes him higher).

Then there is a class of moves that require Rings to perform. Sonic can shoot straight downward by pressing Down after jumping, which costs one Ring. This is a cool move, related to the Bounce from Sonic Advance 2 and Sonic Adventure 2, only without the rebound at the end. I like it, but I'm annoyed that it only takes a press of the D-pad. This causes it to happen accidentally, which is never good when trying to clear a pit of spikes. I would like it a lot more if you had to hold down and press A, B, or C.

Rounding out the Ring consuming moves are two types of Air Kick. One sends Sonic flying horizontally, costing 5 Rings, and dealing damage to enemies. The other is much like the first, only it sends Sonic diagonally towards the floor, and costs but 2 Rings. The great thing about this downward kick is that Sonic hits the ground running at close to top speed. It is a much more satisfying way of gaining speed than the Spindash or Super Peel Out, as long as you can spare the Rings.

Incidentally, I had envisioned a downward kick as a way to gain speed long ago, so I'm happy to see someone finally using a similar idea. I had come up with it because of Sonic Chaos. In Sonic Chaos, Sonic can do the Strike Dash (which is much like the Super Peel Out, only he is briefly invulnerable as he launches). Tails can Fly, but in order to make Sonic and Tails have similar controls, he must now hold Up and press the button to do so. This sucks (mainly because he can only start to fly from a standstill), but the idea of making Sonic and Tails perform their iconic abilities in the same way was intriguing. In Sonic 3&K, both Tails and Knuckles do their special abilities by jumping and pressing the button a second time. Sega had to give Sonic a comparable ability, and introduced the Insta-Shield. Now, some people don't give a fig for the Insta-Shield (I like it though), and one might want Sonic to have a more speed-oriented ability anyway. So I thought the Super Peel Out could be redesigned as an aerial ability, like Tails' and Knuckles', and that led to the speed-gathering dropkick idea.

Anyway, the move works very well and makes the game fun to play. Which brings me to the level layout. The layout is a strong point. It reminds me of the best speed levels from Sonic 2 and 3&K, like Chemical Plant or Flying Battery, and I suppose that's high enough praise.

They're just long enough, and don't drag, and you don't get lost. They also have to have the best sense of speed I've ever encountered in a fan game, and very nice loop structures. I'm not sure I'm wild about the "clear the room of badniks" parts, but they aren't nearly as onerous as the ones in Sonic Rush and don't mar the experience.

Well, what about the badniks? I counted four types on my way through, and they're all great. The challenge is higher than the Mega Drive games, but I think that was supposed to be the point. The best part about them is that they encourage the use of the new moves, which helps the game feel coherent, rather than a bag of ideas the developers just want to fit in.

Which brings us to the Bosses. The boss in Act 1 is absolutely brilliant. It too encourages the new moves, is challenging yet beatable, and has damage modelling, which is always cool. The Act 2 Boss, however, has a few technical glitches, and is significantly harder. I probably don't play enough Megaman, and my skills are atrophied, but this is like the Metropolis boss (my personal bugbear), only reimagined by a sadistic Dr Wily on LSD. Don't get me wrong, I like the boss, and am awed by the proficiency of the programming. I do however think that the choice to make Sonic invincible after hitting it (sort of like what happens when Sonic is hit) indicates that it may not be as balanced as it should be.

After defeating the Boss, and "surviving" Act 2, we are treated to a real surprise. Act 3, where Sonic has to high-tail it out of the plant with a wall of onrushing flame hot on his heels (pun intended). Again, my twitch gaming skills - underdeveloped as they are - conspire to let me down, but the concept is awesome.* It may sound strange for me, then, to advocate making it even harder, but I think that the edge of the flame should probably kill Sonic immediately. I suppose there might be some perspective or parallax going on, but it seems weird to be halfway into a wall of flame before you finally decide to die.

* It reminds me of Dino Run, which by coincidence I had played mere days before Sonic Boom. I'm not pointing fingers (after all, I think good ideas should be reused), but I am curious for curiousity's sake if inspiration was drawn from Dino Run, or perhaps they both share a common memetic ancestor.

Upon completion of Act 3 are credits (set to the aforementioned 16-bit remix of Sonic Boom) with a welcome "Cast of Characters" scroll showcasing the enemies, in the tradition of Kirby, Mario World, and Mean Bean Machine.

Overall, Sonic Boom is fun, sounds great, and is a technical juggernaut. With some spit and polish on the visuals, it could carve its way into the pantheon of Sonic Hackdom. I eagerly await the next demo. Good work guys, and ganbatte!

13 November 2009

Code of the Ninja: Watchers

If you haven't already, read the Code of the Ninja: Introduction

Welcome, Code Ninjas!

Today I have a simple fix for something that bugged me about Game Maker. First, let me tell you about the problem, and then I will move on to the solution.

Many times I would be running my game, and realise that there was some variable I needed to know the value of. Game Maker allows you to list the values of variables that you specify in a readout, but only when running in Debug Mode.

The trouble is, once you are already running your game, there is no way to dynamically switch to Debug Mode. You have to close the game, and run it again. This is kind of an annoyance, because compile time can get quite lengthy.

So, I thought, is there any way to have a list of "watchers" built into the game, that I can invoke and dismiss at will?

At first I used a simple method that worked much like any HUD (heads up display) in a video game. The values I needed to keep an eye on were just printed on the screen. This was fine and all, but there was no good way to add to it while the game was running. Game Maker's built in Debug Mode allows you to add watchers at any time.

Then I got the idea to - instead of printing out the values of a fixed set of variables - read the variables from a ds_list.

This ds_list would contain a series of strings, each of which would contain the name of the variable to watch (mouse_x, image_speed, etc). By right-clicking the list, I would bring up an input box that would let me add a new variable name to the ds_list.

How can you read the value of a variable by its name? Game Maker helpfully includes the functions variable_local_get(), and variable_global_get(), which take as their only argument the variable's name in string format, and return the value of the variable.

However, there are still issues with this method. A) You can only return the contents of variables, not expressions. This means you can print out the value of mouse_x and things like that, but never the value of instance_nearest(PlayerObj), and other such useful functions. B) You can't tell whether a variable is global or local, a constant, or part of an array, so you're pretty much screwed.

But then I had the brainwave. Instead of using variable_local_get() and its ilk, I'd use the execute_string() command!

Using this method, the ds_list could be filled with strings containing variable names, expressions, anything - using the identical syntax as the Game Maker Debug Mode watchers use. In fact, I could even save and load the strings to TXT documents in the same format, making them fully compatible with Game Maker's normal Debug Mode.

When drawing the watchers onto the screen, all I have to do is read the strings from the list. Then, I use the execute_string() command to perform the string as if it were code. By prepending "return" and a space before the string when I do this, execute_string() will return the value, which can be then drawn on the screen.

Code will demonstrate this better:

Code:

//a for loop that steps through the whole list
for (t=0;t<ds_list_size(watchlist);t+=1)
  {
  //the code string in the list to be executed
  r = ds_list_find_value(watchlist,t);
  //align the text to the left
  draw_set_halign(fa_left);
  //print the code - this is how you'll identify the watcher
  draw_text(8,8+16*t,r+":");
  //return the result of the watcher
  r = execute_string("return "+r);
  //align the text to the right
  draw_set_halign(fa_right);
  //print the result of the watcher
  draw_text(192,8+16*t,r);
  }

Now we have a watcher display that's just as nice as the Game Maker one. With a little bit of polish, you can add functions for adding, removing, replacing, and editing watchers from the list, as well as saving and loading lists to TXT documents.

For Code Ninjas who may need a working example to make sense of all this, here is a zip file which contains a GMK example and a sample TXT document of watchers.

Happy coding!

If you use my code or scripts in your game or engine, no credit is necessary. But I'd love to hear about your project if you do! Just drop me a comment below, or e-mail me at us.mercurysilver@gmail.com

03 November 2009

Only a Theory?

I began my last post with this sentence:

Sadly, there are those who deny the fact of evolution....

Before I even leave the starting gate, many creationist readers will have already snorted in disgust and stopped reading, merely because of my use of the word "fact", instead of "theory". Why did I not use the word "theory"? To be perfectly honest, I used "fact" because Richard Dawkins does, and I admire his forthrightness. But I had a deeper reason, too - and I think it is the same reason that Dawkins chooses to use "fact" as well (and it's not because we happen to believe in its veracity).

It is because the word "theory" causes unnecessary confusion.

What is a theory?

Many would here quote definitions from major dictionaries, trying to make a point about how "theory" has been watered down with a second connotation. I'm not going to, because others have already done the job admirably. Anyone who doesn't know the distinction between the two meanings has only to spend one or two minutes in the culture of evolution and its deniers to learn it.

Instead, I'm going to point something out that should be obvious, but apparently isn't to some. A theory is manmade. It is similar to a book, a song, or even a religion. It is a group of cohesive ideas, knowledge, and descriptions about a subject. But it is made of language, and doesn't actually exist in the strong sense.

However, theories are usually about things that exist (but not always). The things a theory is about, and the theory itself, are discrete. One should not be confused with the other. This is not an overly subtle point - it's about as obvious as saying that we should not confuse the dark side of the moon*, and the Pink Floyd album, Dark Side of the Moon.

* which, like the night side of the Earth, is not always the same side, unless you take "dark" to mean "unseen until mankind launched probes".

Is evolution a theory?

Well, yes, if you are being colloquial or elliptical. The word "evolution" is popularly used to refer to what should more properly be called the "modern evolutionary synthesis". It is also used to refer to Darwin's theory of natural selection. It is shorthand, though, and whenever one uses a shorthand term, things can get confusing. For instance, if you took "evolution" to mean Lamarck's theory of inheritance of acquired characters, "evolution" would be false. So, I wouldn't strictly call "evolution" a theory, anymore than I would call "light" a theory. There are theories about evolution, and about light, but evolution is a process and light is... well, ask a physicist.

By a quirk of language and history, the theory of evolution has come to be called simply "evolution". This has not happened in other cases, such as with light or gravity. But evolution is a process, which either happens or doesn't, in the real world.

You would never hear someone say, "Evolution isn't a fact! It's a word!" But the "only a theory" argument amounts to about as much. This is why I didn't say "theory". Theories are incomplete, and some, like Lamarck's, are demonstrably false. Even Intelligent Design is a theory of evolution, and I deny it.

Evolution is a fact of history. Those who take advantage of the "theory" canard have either not learnt enough about the subject or are being willfully obscurantist. I like to think the former, because then the problem is remediable.