I need a few brave people to test a pre-beta app for me. No, this is not Cloudy; it’s another app I’ve been working on in parallel. It’s called Your Move, and it’s the expanded version of my GeekGameBoard sample code. It lets you play board games against a human opponent; either at the same machine, over a local network, or by sending moves via email or iChat.
To test Your Move you need to
If you’re interested, please
Thanks!
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:
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:
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 or later. iPhone support is coming soon.
Read the rest of this entry »
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
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.
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 porting isn’t a big deal. Building on some work of some others who’d written makefiles, I put together an Xcode project. Now you can download the demo app if you want to play with it. If you want to experiment, you can copy the Box2D dylib itself out of the app bundle, or download my patch and apply it to revision 49 from the Subversion repository.
There’s a killer opportunity here to plug Box2D into Core Animation. Then you’d have the gorgeous high-speed compositing of the latter, coupled with far more sophisticated animation capabilities. (The animation functionality in CA is fully subclassable, so this should be straightforward to do.) I’ve been fooling around with Core Animation lately, and having a lot of fun making pretty pictures that slide around smoothly. I’ve never before felt the need for a game-physics engine, but the prospect of making my pretty pictures move with that kind of realism is suddenly very enticing!
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. Read the rest of this entry »
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.
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 in different form. You’re crushed in his hairy and odorous embrace as he bellows sweet nothings into your ear.
>FIGHT TROLL You can’t move a muscle. The troll has, surprisingly dextrously, removed your adventurers’ tunic and flung it into the corner.
>RUN You can’t move a muscle. The troll is struggling with the buttons of your Frobozz Magic Boxer Shorts. Your terror is beginning to dissipate, and the scuffle is not-unpleasantly reminiscent of scrimmage back at Great Underground University, not to mention some post-scrimmage locker-room hijinks you’d nearly forgotten about. (Perhaps you shouldn’t have been sampling those chocolates, earlier?) You attempt to reach toward the recalcitrant buttons…
“What’s all this commotion, then?” drawls an amused voice from the doorway. As the troll abruptly drops you, you turn your head and see a seedy looking gentleman carrying a large bag, into which he is depositing your sword.
>HIT THIEF WITH BOTTLE “Ooh, rough trade!” chortles the thief as he dodges your chocolate-smeared blow. “You boys mind if I join in?” He pulls from his bag a lava lamp, a silk scarf decorated with a scenic view of Flood Control Dam #3, and a set of rusty handcuffs.
>|
— Excerpt from Zork IV: Time Considered As A Helix Of Little Twisty Passages, by P. David Lebling and Samuel Delany, which Infocom refused to release in 1988.
(Here’s some context, for the perplexed.)
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 a real game that I’ve just been playing:
Section 2 – Smells A thing has a property called scent. The scent of a thing is usually “nothing”. A procedural rule: ignore the block smelling rule. Carry out smelling something: say “From [the noun] you smell [scent of the noun].” Instead of smelling a room: if a scented thing can be touched by the player, say “You smell [the list of scented things which can be touched by the player].”; otherwise say “The place is blissfully odorless.” Definition: a thing is scented if the scent of it is not “nothing”. Before printing the name of something scented while smelling a room: say “[scent] from the ”
A thing has a property called scent. The scent of a thing is usually “nothing”.
A procedural rule: ignore the block smelling rule.
Carry out smelling something: say “From [the noun] you smell [scent of the noun].”
Instead of smelling a room: if a scented thing can be touched by the player, say “You smell [the list of scented things which can be touched by the player].”; otherwise say “The place is blissfully odorless.”
Definition: a thing is scented if the scent of it is not “nothing”.
Before printing the name of something scented while smelling a room: say “[scent] from the ”
Now that’s wild!
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.
Here’s a list I found back in 1995:
(Information Superhighway anagrams copyright©1995 by the author, Mike Morton. All rights reserved. You may reproduce this, in whole or in part, in any form provided you retain this paragraph unchanged.)
The correct way to generate anagrams is to write or print the source word/phrase in large type, cut out the letters, and push them around. But if you’re feeling lazy, you can try an automatic anagram generator. Of course, you’ll still have to pick through a huge list of anagrams for the few that actually make any sense at all.
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 posts.
Once the patio was cleared I was faced with the trickier lawn level, where all the leaves had now collected. I started at one end and moved back and forth in a raster scan for a while. The leaves get stuck in the grass blades so the best technique seemed to be to aim low to levitate them, then high to blast the levitated leaves forwards. Combined with the horizontal raster scan, this required continuous nozzle movement. Grabbing the middle of the protruding pipe helped make this easier.
The gameplay was kept fresh by the innovative use of different types of leaves. The small ash leaves move more easily, of course, while the larger mulberry leaves take more lift to go airborne but prove more aerodynamic once in flight. I appreciated the ability to move at will from one end of the lawn to the other — this type of open-ended GTA-3 style play kept my interest.
Finally the endgame — or so I thought! — came with the final mission: forming all the leaves into a pile. Once the leaf area becomes compact enough, you have to deal with the more subtle effects of the blower, such as that it sends the leaves not straight forwards but across about a 90° angle, which can easily move other leaves away from the pile if you’re not careful. Switching back to the “rake” item helped here.
It was at this point that the game went into an unexpected final twist. “Princess N” — the requisite cute-sidekick NPC character — had been around throughout the game. It’s possible to switch the leaf-blower to her (use the Z button). While her small size and frankly limited AI make her not very useful with the blower, it must be said that the animations and detailed facial expressions make the experience quite amusing.
When not controlling the blower, Princess N occupied her time playing in the leaves with little doll figures. The twist, then, was that as soon as I’d gathered all the leaves into a perfect pile, there came a heart-rending cutscene in which Princess N tearfully announced that she’d lost her beloved Garden Fairy doll. I of course selected “Yes” when asked to find the doll, and we went into a painstaking fetch-quest for the missing 2” item.
Unfortunately I didn’t have any luck, even after D very sweetly took advantage of the two-player co-op mode to lend a hand. So I didn’t get the best score for the episode, although I thought I did quite well for a first time. I saved the game right before the final task, carrying the leaves to the curb; I need to finish that up before the real-time clock hits Thursday morning, when the “trash collectors” arrive, or I’ll be hit with a stiff penalty.
Here’s my off-the-cuff rating: Gameplay: 9.0 [surprisingly hard to master, but satisfying once you do] Graphics: 8.0 [beautiful motion-capture and particle effects] Sound: 5.0 [loud whirring is realistic but gets boring. Good voice acting, though.] Replay value: 8.5 [you can play this nearly every day, with new randomly-generated leaf configurations] Overall rating (not an average): 7.9