Bacon and Games

Year: 2012 (page 3 of 3)

Simple AS3 Debug Window

Sometimes when you’re chasing down a bug, the quick and dirty ‘caveman debugging’ approach is easier than using an actual debugger with breakpoints and ‘all that happiness’ (as my father says). The trace() function is great for this, but if want to view flash traces in a web-browser you have to deal with the debug player and Flash-tracer setup. And if you want to get input from someone who doesn’t have those tools you’re out of luck.

The other day I found myself in the above situation and so I wrote up a very lightweight and VERY basic class called DebugWindow. It recreates the trace() functionality within your swf, by adding a “debug window” to the display list. To use it, just call its output() method instead of using trace()

This movie requires Flash Player 9

As you can see from the demo, you can use SHIFT + SPACE to hide/show the debug window. CTRL + UP/DOWN allows you to scroll to view older text. There are a few other helper functions that allow you to clear the window entirely or clear then output in one call. You can also set window size, text, background and border colors in the constructor. It’s all commented in the class.

If you’re not done with your project and still wish to use the debug window but don’t want users seeing it, set the enabled property to false. This will remove all event listeners, hide the window and block any output calls. It’s still recommended you remove all debug code from your project when finalized.

I considered adding features like a scroll bar, line numbers and some other stuff but at the end of the day this is just meant to be a light and dirty way to get some data out of your swf no matter where it’s running, test mode, browser, iPad… whatever.

Here’s the AS3 DebugWindow Class

Oh and in case you’re wondering, I grabbed the bacon facts and Nintendo facts from these two sites… much more interesting than using Math.random()*5000 :P

Bacon Bytes 2 – E.T.

Even E.T., considered to be one of video gaming history’s biggest follies, couldn’t be saved by the magic of natural bacon enhancement.

What Cries From the Screen is Your Mistakes

This morning I watched a documentary called “Thumb Candy – A History of Computer Games”. It centers on interviews with many early video game pioneers, beginning with Steve Russel who wrote Spacewar! in 1962 for MIT’s PDP-1.

While worth watching, I’m not here to recommend the film. I wanted to point out a snippet taken from around the 44 minute mark, during the interview with legendary Tetris creator Alexey Pajitnov. The host asks Pajitnov a familiar question:

Why is Tetris so addictive?

Pajitnov points out that when the game ends, the remaining clutter that once was your game board becomes “a picture of your mistakes”.

Gesturing at the HUD, he remarks that “your results are somewhere in this number, in the score” but “what cries from the screen is your mistakes… and you want to fix it right away”. It’s subtle, but I think there’s some truth to that.

To lose and have your score staring you in the face is one thing, it’s just a number. But it’s another thing all together to be forced to look at your game board, sad and cluttered after you’ve worked so hard at keeping it clean. Without scores to compare yours to, a number has little meaning. But there’s no ambiguity to the meaning of the tangled wreckage that is your final screen.

I know I can do better.

We talk about this a lot at the office and often refer to it as the “just one more game” effect. How do you create a game that always makes you want to play just one more? Surely there are many contributing factors:

  • length of a single game
  • how easy it is to restart the game quickly
  • how much progress the player loses upon restart (no items to re-collect or abilities to re-acquire)
  • how fun the game is – duh

and so on. But I think there’s something very elegant about the idea of having a history of your failure splayed out in front of you at the end. A straight piece standing defiantly just one block from its intended home, another desperately over-rotated into an awkward final resting place. The final moment of Tetris can be a horrifying window into 20/20 hindsight and there’s no doubt it lends a hand in coaxing the user to give it just one more go.

I know I can do better.

It’s such a simple concept but one I’d never really considered on this basic a level until now. I will be thinking about ways to incorporate it into my games in the future. And in the spirit of it, why not read just one more article. :P j/k

Bacon Bytes 1 – This is What You Sound Like

I’m sorry, but after 10+ years in this industry it’s finally gotten to me.

Newerposts

Copyright © 2024 Bacon and Games

Theme by Anders NorenUp ↑