Mar 7 2008

GeekGameBoard — Getting closer to iPhone-ready

To encourage development, I’ve started an open source project based on the GeekGameBoard game-development sample code that Apple published last December (which, by a strange coincidence, I wrote.) I hope to have it ready for iPhone game development soon. It runs on iPhones, too!

You can browse or download the source code over at bitbucket.org. It’s BSD-licensed, and your contributions are of course welcome.

The changes since Apple’s original sample-code release are:

It no longer requires garbage collection. I love GC, but it’s not supported on the iPhone, where I am definitely planning to use GGB.
I fixed some memory leaks of CoreGraphics objects.
I fixed an assertion-failure when kinging a checker.

What Is GeekGameBoard?

GeekGameBoard is a small Objective-C framework for implementing the user interface of a board or card game. Many games can be implemented in less than 150 lines of code.

It also demonstrates generally-useful Core Animation techniques like:

Hit testing
Dragging CALayers with the mouse
Loading images from files and setting them as layer contents
3D “card-flip” animations

Framework classes include Bit, Piece, PlayingCard, HexGrid and more. It comes with sample games from Klondike solitaire to Checkers and even Tic-Tac-Toe. It’s all ready for you to add AI, network play, new game definitions…

GeekGameBoard runs on Mac OS X 10.5 [...]


Dec 20 2007

GeekGameBoard

Santa has an early Xmas present for all you good Leopard programmers: GeekGameBoard, a new piece of sample code by the anonymous engineer elves at Apple.

[Update: GeekGameBoard is now an open-source project hosted at bitbucket.org.]

GeekGameBoard is an example of using Core Animation to present the user interface of a board or card game. It implements a small framework for implementing such games, with domain-specific classes like “Grid” and “Piece”, and examples of several game definitions built on top of the framework.
Some of the generally-useful Core Animation techniques illustrated are:
• Hit testing
• Dragging CALayers with the mouse
• Loading images from files and setting them as layer contents
• 3D “card-flip” animations

Framework classes include Bit, Piece, PlayingCard, HexGrid and more. It comes with sample games from Klondike solitaire to Checkers and even Tic-Tac-Toe. It’s all ready for you to add AI, network play, new game definitions…

PS: Icon websites like IconFactory, InterfaceLift and DeviantArt are great places to get artwork for game pieces. (My personal favorite game pieces are Ginko’s Icons, shown on the right.) Just be aware that most icons, even if freeware, require you to get the copyright holder’s permission for anything other than personal use.


Nov 18 2007

Box2D

Thanks to Steve Dekorte’s blog, I just ran across Box2D , an open-source 2D physics engine for games. In other words, it simulates the motion over time of convex polygons, taking into account inertia, gravity, collisions, friction, angular momentum, torque — all the things I once painstakingly learned in college and then completely forgot. Now they’ve suddenly become fascinating again, since Box2D does all the hard work. The app just has to describe the objects, then call Box2D in a loop to find out how their coordinates change over time.

Box2D comes with some demos that are bare-bones graphically, but amazingly realistic in motion, including a swinging chain, a web of springs, and a pyramid of blocks that you can undermine and collapse:

A far more sophisticated usage of Box2D is in the indie game Crayon Physics Deluxe, “in which you get to experience what it would be like if your drawings would be magically transformed into real physical objects.” You must watch the amazing video on that site. (Then cry, because it’s only for Windows.)

Speaking of Windows, the official Box2D package only builds on that platform, so far. But the core library is platform-independent C++, and the demos use OpenGL, so [...]


Nov 1 2007

Review: ZackAndWiki

It’s a sure sign that wikis are going mainstream when one appears for a video-game console. “ZackAndWiki” has the requisite goofy name (like TikiWiki or WikkaWiki), but once you try it out, you’ll find it approaches its job very differently than you’re probably expecting.


Aug 6 2007

The Hero Passes

We love to play the Hero — exploring dungeons, grabbing treasure, saving the world from evil. But I started wondering about the reasons behind some of the actions in such games, and especially about what my Heroic deeds looked like to the ordinary people of the lands I passed through. (As my wife once put it: “Why isn’t there a Hug button?”) The result is this story.
I don’t normally write this sort of antiquated prose, but the genre does require it. It was actually a fun exercise, and I’ve tried to affect more of a James Branch Cabell or Lord Dunsany voice, rather than the tiresome faux-Tolkien of most current heroic fantasy.


May 5 2006

Only Known Instance Of Zork Slash

My friend Tanya asked her friends to write her a short bit of Slash fiction as a birthday present. Which is not something I’m accustomed to, but here goes…

>N

The Troll Room
This is a small room with passages to the east and south and a forbidding hole leading west. Bloodstains and deep scratches (perhaps made by an axe) mar the walls.
A nasty-looking troll, brandishing a bloody axe, blocks all passages out of the room.

Your sword has begun to glow very brightly.
The troll swings his axe, but it misses.

>SWING SWORD
Whoosh!
The troll swings, you parry, but the force of his blow knocks your sword away.

>INVENTORY
You are carrying a brass lantern, a key, an elongated brown sack smelling of hot peppers, a bottle, and a heart-shaped box of chocolates.

>GIVE BOX TO TROLL
“For me?!” The troll grunts in disbelief as he eagerly pulls off the lid and eyes the Super-Deluxe Truffle Assortment of the Frobozz Magic Chocolate Company (By Royal Appointment To Lord Flathead). Unable to make up his mind, he stuffs all the chocolates into his maw at once and chews noisily.
The troll has dropped his axe.

>GO EAST
Too late—the magic chocolates have done their work, and the troll’s attentions now return to you, although [...]


May 1 2006

your sword is glowing with a faint blue glow

I dabbled in Interactive Fiction, aka Text Adventures, long ago—- I played Adventure on my Apple ][ and Dungeon/Zork on a VAX; I wrote a primitive game in BASIC and later in college partially implemented a language for building games in yacc; and then after graduating, my first serious Mac program was a souped-up and nearly finished version of that language. After that I was too busy with “real” jobs, but others kept the flame alive even after Infocom tanked, building their own adventure-design languages like TADS and Inform and spawning a cult scene of increasing complexity and literary merit. I kicked the tires of TADS and Inform a few years back, then got distracted by other shiny things. You know how it is.

Anyway: now I turn around and there’s Inform 7, a thing of splendor beyond my dreams. Not only does it have an IDE with a really interesting form of integration testing, but the syntax itself has become an ambitious attempt at natural language. I haven’t started coding yet—I have a dreamlike apprehension that the whole concept will melt like cotton-candy if I touch it—but as an example here is an unmodified section of the source code of [...]


May 19 2004

Anagrams

Way back in 1989 my friend M@ and I used to work at a font company called Kingsley/ATF Type Corporation. One evening after work—actually we were still at work, physically speaking—we began to consider the subject of anagrams of the company name. After running off the necessary letters (in 100pt ITC Galliard all caps from an Adobe Type 1 font, using Microsoft Word 4.0 on a Mac SE, printing to a 300dpi Apple LaserWriter NTX) and cutting them out (I forget the brand name of the scissors) we set to with gusto.

The results you can see below. Some phrases are innately anagrammable and some aren’t. KINGSLEY/ATF and KINGSLEY/ATF TYPE CORP had vast possibilities, some (SLAG TYPE FIN?) stretching the limits of comprehensibility, others (ALFKE GIN STY, ITSY FLAN KEG, TINTY SLOG) proving so useful that they worked their way into our daily conversation. I’ve highlighted my favorites in boldface.

KINGSLEY / A.T.F.

FISKY TANGLE FLY EATS KING G.I’S FELT YANK FINKS GET LAY INKY F.L. STAGE YET FIG SLANK SKY LIFE TANG FILA SKY GENT GEAKY S.F. LINTK.Y. FLING SATEKATEY FLINGSSKATEY FLINGTINKLY SAFE “G”E.G., YAK FLINTSSTAG, FLY NIKEK.Y. ANGEL FISTITSY FLAN KEGFLYING SKATELIFE’S TANGY [...]


Dec 8 2003

Super Leaf Blower 64™ Official Players’ Guide

Yesterday I got acquainted with our leaf-blower. It’s electric, thank Cthulhu, but not what you’d call “whisper quiet”. We got it as a gift several years ago, and I tried it once back then and it just blew the leaves into a huge swirling cloud that settled down exactly where it began. So I disappointedly put it in the shed and forgot about it.

This time, though, I treated it as if it were some new and powerful item from a game. The controls seem simple — just press the A button to turn it on/off and rotate the C stick to point it, kind of like Luigi’s Mansion — but it takes time to master. Here’s my brief player’s guide:

Anywhere near a wall you get the howling leaf tornado that I experienced before; I’m not sure if this is a bug or intentional, but avoid that. The brick patio was the best surface, though I had to evade obstacles like the picnic table to get those elusive remaining leaves for bonus points. The limited length of the extension cord added an element of strategy, as I often had to retrace my path to unwind the cord from around trees and [...]


Sep 4 2002

A Koan For Video Gamers

The Zen master Yoshi was playing a video game. Seated in the lotus position, he expertly maneuvered the controller with his gnarled hands. Nevertheless, on the screen Mario failed to leap from one block to the next and plummeted screaming into the void.

Again, Yoshi began the same level. Again, the moving platforms eluded the sprite onscreen.

Seventeen more times, master Yoshi caused the hapless plumber to fall into nothingness and lose another life.

Still, his pose remained serene, and a bud of a smile played on his lips.

At last the novice Ohta, who had been watching the whole time, could not contain himself. “Master,” he blurted out, “how can you remain so calm in the face of so excruciatingly difficult a level? Even when the platforms evaporate into thin air when you are yet a split second from reaching the Shine that is your goal? How do you restrain yourself from throwing the controller through the nearest shoji?”

Master Yoshi replied:

“The platform is not moving.
Mario is not moving.
Only the mind is moving.”

At that instant, Ohta attained enlightenment.