PebbleQuest, a 3D fantasy roleplaying game developed for the original black-and-white Pebble watch, was released on December 25, 2014, weighing in at 25,020 bytes: 25kB or 24.4KiB. The concept for the game germinated in 2013 as I first started reading about the Pebble and other smartwatches. I was studying mobile game development at the time and the thought of creating an RPG for a wristwatch intrigued me. Before long I found myself ordering my own Pebble, typing up PebbleQuest‘s design document, and answering Team Pebble’s clarion call to “make awesome happen!”

I can’t say exactly how many hours went into PebbleQuest‘s development, but it was a true labor of love, consuming much of my spare time over the course of about fifteen months. Starting from scratch and armed only with the C programming language, the Pebble SDK, and the CloudPebble IDE, it took about two months to complete the basic foundation: a simplistic 3D environment navigable via the Pebble’s three right-side buttons, released in late 2013 under the title MazeCrawler.

As I started adding RPG elements, it soon became apparent that memory was going to be an issue. If a Pebble app’s size and memory usage cross a certain threshold, the app may still install successfully but will crash at runtime, either just after launching or after one too many allocations of dynamic memory (such crashes can also be caused by memory mismanagement, of course, so that possibility must be ruled out before concluding you’ve surpassed the memory limit). I was thus faced with the hard necessity of significantly scaling back my design. A bit flustered, I set PebbleQuest aside and spent the next few months on a slightly simpler game: SpaceMerc , a sci-fi first-person shooter released on March 23, 2014, as a last-minute entry into the 2014 Pebble App Challenge

After that, my attention strayed somewhat to other projects, but by late September my spare time was once again dedicated almost entirely to PebbleQuest. Perusing my code with fresh eyes, I discovered several more ways to save memory, allowing gradual incorporation of, if not everything, then at least all the most essential elements from my original design. Overjoyed to see the game finally approaching my initial vision, I continued testing, fine-tuning, and polishing it until my self-imposed absolute deadline: Christmas morning.

Working Magic with Memory

Without further ado, I’d like to share a few details regarding PebbleQuest‘s design and development, my sources of inspiration, and the techniques and trade-offs used to provide a quality action-RPG experience within the memory constraints and other limitations of this unorthodox gaming platform. I’ll then conclude with some thoughts on the future of smartwatch gaming. If instead you’d rather just see basic information about the game and how to play it, head to the official PebbleQuest page

Readers of my SpaceMerc postmortem will recall repeated assertions of “I couldn’t do this” and “I had to drop that” due to memory concerns, but it turns out I should have been more optimistic. I have since discovered several more strategies for reducing app size without sacrificing much, if any, content and I’m sure many more would have been found if only I had more time to experiment or had greater expertise with the C language.

For my fellow smartwatch app developers, I present a handful of memory-saving tips I picked up while working on SpaceMerc and PebbleQuest, some of which may be context- or compiler-dependent:

Unless you have a strong design-based reason for doing so, don’t reinvent features already present in the Pebble SDK. For example, use provided fonts rather than custom fonts, a MenuLayer rather than your own custom-designed menu, etc.

As much as possible, use integers rather than floating point numbers, and use int8_t or int16_t rather than int32_t or the generic int type. Also, where constants are concerned, bear in mind that powers of two (1, 2, 4, 8, 16, 32, etc.) can often be handled more optimally than other values. For example, rand() % 10 consumes slightly more memory (eight bytes more, to be precise) than rand() % 8 . Finally, if you’re feeling bold, consider delving into the world of bit manipulation.

or rather than or the generic type. Also, where constants are concerned, bear in mind that powers of two (1, 2, 4, 8, 16, 32, etc.) can often be handled more optimally than other values. For example, consumes slightly more memory (eight bytes more, to be precise) than . Finally, if you’re feeling bold, consider delving into the world of bit manipulation. Avoid using your own typedef -defined variable types. Having said that, defining a struct might still be a good idea for some tasks, at least for the sake of convenience and readability, but keep them to a minimum, read this tip for reducing struct size, and ensure a struct ‘s size doesn’t exceed 256 bytes if you plan on saving it to persistent storage through a single call to persist_write_data .

-defined variable types. Having said that, defining a might still be a good idea for some tasks, at least for the sake of convenience and readability, but keep them to a minimum, read this tip for reducing size, and ensure a ‘s size doesn’t exceed 256 bytes if you plan on saving it to persistent storage through a single call to . If you’re using function calls, array indexing, or pointer dereferencing to get at the same value multiple times within a given function, it may be better to instead get that value once and store it in a local variable, especially if more than one call/index/dereference is required to get at the value.

Keep conditional statements to a minimum, but where they can’t be avoided, if – else is often more memory-efficient than switch , in my experience. Experiment on your own, case-by-case, to be absolutely sure.

– is often more memory-efficient than , in my experience. Experiment on your own, case-by-case, to be absolutely sure. On that note, keep in mind that array indexing is often an excellent alternative to conditional tests. For example, if you catch yourself using conditional tests on an integer n to determine which string constant to copy to a text field, you can replace those conditionals with a constant array of string constants that can then be indexed by that same integer n.

In general, eliminate any function that’s only called once throughout your program. In other words, directly incorporate that function’s code into the function that called it.

Speaking of functions, although a void return type is often suitable, there are times when specifying a return value will actually decrease a function’s memory footprint even though that value is never used. This one is a bit mysterious to me, so I recommend experimenting with your own function return types one-by-one.

return type is often suitable, there are times when specifying a return value will actually decrease a function’s memory footprint even though that value is never used. This one is a bit mysterious to me, so I recommend experimenting with your own function return types one-by-one. Finally, the most obvious way to save memory: Simplify your design, cutting out any elements that aren’t absolutely necessary. Challenge all your assumptions about what “needs” to be in the game.

One thing to bear in mind: As reduction of memory footprint rises in priority, other software development values, such as the readability and modularity of code, might need to be sacrificed to some extent (as evidenced by my less-than-ideal source code). If you’re not careful, this can make the process of modifying, debugging, and polishing your app more difficult than usual down the road.

Akalabeth Meets Arena: Real-Time Action in a Simplistic 3D World

My vision for PebbleQuest was to create the smartwatch equivalent of an old school action-RPG. I took inspiration from a variety of classics, including two of the earliest RPGs to feature real-time, first-person combat: Ultima Underworld and The Elder Scrolls: Arena.

However, where movement was concerned, I decided early on to go with abrupt 90° turns and simple forward/backward motions more evocative of older classics, such as Dungeon Master or Eye of the Beholder.

Or, going back further, the first-person segments of the Gold Box AD&D games.

Or, going all the way back to the first computer roleplaying game ever published and the precursor to Richard Garriott’s Ultima series, Akalabeth: World of Doom, although once we reach this point I’m happy to say PebbleQuest finally manages to look better and smoother than at least one of its predecessors!

I hasten to note that, although I chose to employ simplistic 3D and abrupt movements, the Pebble device is fully capable of supporting more sophisticated forms of 3D representation. For example, this 3D FPS demo features more visually-impressive environments as well as free, fluid movements controlled entirely by the Pebble’s accelerometer (in other words, by tilting your wrist or otherwise tilting the Pebble).

Why didn’t I make use of the accelerometer? Well, accelerometer controls are fun to play around with, but, if you ask me, they end up feeling awkward when applied to games of this sort, so I chose to stick with button controls. Admittedly, my control scheme is awkward in its own way: movement forward and backward is facilitated by single-clicking (or continuously pressing) the “Up” and “Down” buttons, respectively, while turning left and right is accomplished by double-clicking those same buttons. It takes a little getting used to but was, to my mind, the best way to allow the player to turn left and right and move forward as well as backward while still leaving the “Select” button available as an attack button and the “Back” button as a way to return immediately to the main menu, all without worrying about how your Pebble is currently tilted.

For a slightly different take on button controls and another impressive example of the kind of 3D gaming Pebbles can support, check out this dungeon crawler by JeckleCed:

Clearly, that game is better-looking than PebbleQuest, but it has yet to be completed and released, mainly due to the Pebble’s memory limitations. I hope to see it released in the near future along with many other games of this sort, even if they do end up outshining my own creations. Oh, and for the record, I do have experience related to programming those kinds of richer 3D worlds, but, for the sake of keeping my Pebble games simple, compact, and easy to complete within a relatively short time frame, I opted for a more old-fashioned approach.

Now that we’ve discussed movement and the overall 3D environment, let’s dive into combat. At one point during development I considered going with turn-based rather than real-time combat, especially since casual “look at your watch now and then” games are naturally quite popular on this platform, but that wasn’t the experience I was aiming for. I wanted real-time battles governed by “dice rolls” in the background, like those of my favorite RPG series: The Elder Scrolls. Unlike the first three Elder Scrolls games, however, all attacks will deal at least a minimal amount of damage. Also, I dropped bows and arrows at one point, so there are no ranged physical attacks, but all spells are ranged, including spells from enemy mages. Finally, to compensate for awkward controls and overall difficulty, the player can attack (and move) up to four times per second, whereas enemies attack (or move) only once per second.

So, what about combat-related graphics? Spells and enchanted weapons cause an inverter layer to appear and then disappear, creating a “flash” effect. Physical attacks from enemies aren’t animated, but damage to the player is indicated by a short vibration. Physical attacks from the player generate a white line across the central portion of the screen from one random point to another. I would have enjoyed creating distinct graphical effects for each type of spell and weapon, but didn’t have enough spare memory to justify such an extravagance. As for the appearance of the NPCs themselves, I considered using bitmap files, but transparency would not be supported by such files, so I stuck with drawing primitive shapes, lines, and pixels instead. Again, in order to save memory some visual details were left to the player’s imagination. Nonetheless, I think you’ll agree that, while in active gameplay, the resulting images are sufficient to create an intense gaming experience.

The Player Character

One of the first steps in any RPG is the creation or presentation of a character (or team of characters), sometimes with customization options. PebbleQuest automatically creates a default character for you without any need to choose race, sex, class, skills, or anything else. Because you never actually see your character, you’re free to imagine his or her physical appearance and cultural background however you please. You’re also free to choose which items to equip and which attributes to increase as you level up, thus roleplaying your preferred character type, whether that’s a heavily-armored sorceress, a leather-clad assassin, or a naked axe-wielding barbarian!

To keep things simple, I settled on three primary attributes—Strength, Agility, and Intellect—corresponding to the three major fantasy archetypes of Warrior/Fighter, Thief/Rogue, and Wizard/Mage. Each time you level up, you can increase one attribute.

In a more complex RPG, I would have gone with a wider range of basic attributes, perhaps something like the six attributes of Dungeons & Dragons, the seven “SPECIAL” attributes of the Fallout series, or the eight attributes of the first four Elder Scrolls games. As it is, PebbleQuest‘s attributes and leveling system actually have a lot in common with the latest addition to the Elder Scrolls series: Skyrim.

Like PebbleQuest, Skyrim features a classless system with three major attributes, one of which may be increased each time you level up, although in Skyrim these attributes are (surprisingly) Health, Magicka, and Stamina: the quantities drained when the player takes damage, casts a spell, or swings a weapon, respectively.

PebbleQuest features a Health bar like that seen in Skyrim (and countless other games), but instead of separate Magicka and Stamina bars there is a single Energy bar that diminishes anytime either a spell is cast or weapon swung. Finally, PebbleQuest is also similar to Skyrim (and Oblivion) in that Health and Energy are both automatically replenished over time: no need to find a place to sleep.

While we’re on this topic, I’d like to argue a more general point: Simplification isn’t always bad, nor is increased complexity always good, even in a “hardcore” RPG. Balance between absolute realism and smooth, enjoyable gameplay is crucial in any game. As such, although some fans of the Elder Scrolls series were disappointed by Skyrim‘s departure from the previous class-based, eight-attribute system (among other things), I didn’t mind their abandonment of character classes, which often just end up feeling like a source of arbitrary restrictions, and I found their experiment with a streamlined, skill-based, perk-focused leveling system fascinating and effective. There are definitely some things I would criticize about Skyrim‘s design, but the leveling system and dearth of traditional attributes aren’t among them.

Getting back to PebbleQuest, although characters in this game don’t have skills or perks, they do have the following minor stats, each affected by the primary attributes and sometimes by equipment:

Physical Power

Magical Power

Physical Defense

Magical Defense

Max. Health

Max. Energy

Health Regeneration Rate

Energy Regeneration Rate

Fatigue Rate (energy loss per attack)

Those “Power” and “Defense” stats are undeniably generic, but remember: I had to keep things simple. Rather than a bunch of separate stats along the lines of “Resilience,” “Evasion,” “Armor Rating,” etc., there’s a single “Physical Defense” stat incorporating all of the above. Might sound odd, but with memory this tight, why not? Whether you reduce physical damage through sheer toughness, dodging, or glancing a blow off your armor, it all amounts to the same thing: damage reduction. Similarly, raw power and the ability to effectively time and aim an attack are both factored into “Physical Power.” As for “Magical Power/Defense,” these too are affected not only by Intellect, but also by Agility because dexterous, coordinated movement is involved in the casting, aiming, and dodging of spells.

Perusing the full list of character stats from PebbleQuest‘s main menu will also reveal current experience points, level, depth (how deeply you’ve descended into the dungeon), and two special minor stats:

Spell Absorption (chance to absorb enemy spells as energy)

Backlash Damage (damages enemies when they physically attack you)

These start at zero but may be increased by equipping a robe, shield, or suit of armor infused with the appropriate Pebble of Power. For complete information on the effects of various items, including the seven Pebbles of Power, please refer to the official PebbleQuest page.

To Quest, or Not to Quest: That is the Question

With a name like PebbleQuest, you’d be correct in assuming you’ll embark on a quest: a quest to collect Pebbles of Power, no less! I faced two quandaries on the questing front, however: (1) whether the main quest should feature a complex storyline and diverse locations and (2) whether to include a system of side quests similar to the mission system in SpaceMerc, complete with gold coins earned as rewards that could then be spent at a marketplace. As development progressed, I weighed my priorities and opted for a simple roguelike (or “roguelike-like“) dungeon crawl as the main quest, did away with side quests, and dropped the marketplace idea. Sacrificing such desirable but nonessential elements enabled the inclusion of a wide range of stats, items, enemies, and other basic features that were far more crucial to my creative vision.

To me, the list of critical elements boiled down to the following:

A variety of 3D environments (even if the only “variety” is provided by procedural generation) filled with a variety of enemies. Equippable weapons, armor, shields, and clothing. Pebbles of Power that may be equipped to cast spells or infused into other items to imbue them with magical properties. Needless to say, I also hoped these would provide a fun connection to the name of the device on which the game runs!

Beyond those three features, everything else was negotiable, including “questlines” and other forms of storyline. Thus, the only narrative in PebbleQuest, aside from that generated by the player’s own imagination and unique interactions with the game world, is provided by the following text, displayed each time a new character is created:

Evil wizards stole the Elderstone and sundered it, creating a hundred Pebbles of Power. You have entered the wizards’ vast underground lair to recover the Pebbles and save the realm. Welcome, hero, to PebbleQuest!

There are, indeed, exactly 100 Pebbles that may be collected in PebbleQuest, one for each level of depth in the dungeon, meaning you must descend to the maximum depth of 100 to collect every Pebble. This arduous task is rewarded only by a simple congratulatory text:

Congratulations, hero of the realm! You’ve vanquished the evil mages and restored peace and order. Huzzah!

Each Pebble is held by one of 100 mages who constitute the “bosses” of the game and are the only enemies capable of ranged attacks. Oh, and speaking of the number 100, that’s also the player’s level cap.

One final point about questing in PebbleQuest, which also illustrates the impact one design choice can have on another: Because the “main quest” and the game overall ended up being simplistic and somewhat lacking in diversity, I feared players would bore quickly, so I decided to increase intensity by making death permanent (one of the key features of any roguelike), meaning that you must start over from scratch whenever your character dies. This feature would be intolerable in an RPG of grander scope, such as any of the Elder Scrolls, Fallout, or D&D-based titles, but it fits nicely in a simple dungeon crawler like PebbleQuest because the added tension contributes to the pleasure and sense of accomplishment derived from each victorious battle and each level survived and yet there isn’t too much frustration when a character dies because there really isn’t that much to lose nor is there a great, expansive narrative to complete.

All that Glitters…

Though gold coins and commerce didn’t make their way into PebbleQuest, I aspired to make money in the real world through this humble RPG by selling it for a dollar per download. I imagine this may have surprised some people, but, as detailed above, designing and programming this game from scratch required a significant investment of time and energy, so I felt justified in seeking a little remuneration from my fellow fantasy enthusiasts.

As a matter of fact, I initially planned on selling SpaceMerc as well, but for various reasons ended up releasing it for free, just like MazeCrawler, on the official Pebble App Store, which didn’t support paid apps at the time and still doesn’t to this day. Early on, there was some talk from Team Pebble about eventually supporting payments, but this has yet to materialize. For a few months in mid-2014, I actually delayed PebbleQuest‘s development specifically because I didn’t want to release it until it could be sold on the official store. There were a handful of unofficial online stores selling Pebble apps at the time, but I wanted to stick with the official store as much as possible and figured it was only a matter of time before they would announce they were ready. As weeks and months continued to go by without any indication they were working on that feature, I decided I might as well finish up PebbleQuest and sell it through my own website.

Sales started trickling in and I was deeply grateful for each one, but there weren’t nearly as many as I hoped, even with all the newly-gifted Pebbles around Christmastime. I posted links here and there, and my website already had an abundance of Pebble-related content for search engines to pick up, so a lot of Pebblers were checking out my PebbleQuest page, it’s just that precious few were taking the next step of making a purchase. This tale of woe is common in the indie game development world, though, so I was mentally prepared and only slightly disheartened. I also learned a few valuable lessons. For example, I should have provided a free trial version on the Pebble App Store with the option to purchase the full game through my website (or elsewhere). I arrogantly assumed PebbleQuest‘s description would be so appealing to any fellow Pebbler and RPG fan that a demo was unnecessary, but it later became clear that some folks wanted a test run before laying down any money.

In any case, by late February sales had tapered off and Pebble had revealed a new Kickstarter campaign for their next-gen watch, Pebble Time, featuring 64 colors, expanded memory, and other improvements, so I decided it was time to go ahead and provide my now humbler-looking, black-and-white RPG free of charge on the Pebble App Store as well as MyPebbleFaces.com. The code is also open source, as it was from the beginning, so feel free to check it out on GitHub and borrow from it as you make your own Pebble games. I may eventually produce color versions of each of my Pebble games, along with a handful of new Pebble apps and watchfaces, but the bulk of my time is now dedicated to screens larger than 144×168 pixels as I’m in the midst of establishing my own indie game development company: Golden Drake Studios.

The Future of Smartwatch Gaming

What does the future hold for smartwatch gaming? First of all, we can expect a lot more color as the much-anticipated Pebble Time and Apple Watch join the ranks of the already-colorful Android Wear devices. We can also expect casual games to dominate here just as they do in the realm of smartphones and tablets, though semi-hardcore games like PebbleQuest will pop up now and then. Finally, free-to-play will definitely be the norm, but the income potential from freemium games (and perhaps the occasional pay-to-play game) could be significant, as evidenced by the recent appearance of a Finnish game studio devoted entirely to wearable tech: Everywear Games.

In order to get more specific, let’s see what lessons and predictions can be gleaned from the current top seven games on the Pebble App Store:

So, what’s the takeaway here? Smartwatch games should be simple and intuitive, possibly nostalgic or familiar in some way, and perhaps capable of being left on to be played sporadically throughout the day. You’ll notice that none of the top Pebble games are of the first-person action variety since these will generally fail the “simple and intuitive” criterion. That’s not to say there isn’t a niche market for such games, but they’ll never be as popular as casual games, and that’s understandable given the tiny screen size, limited controls, etc. So, if your heart’s set on crafting an experience similar to your favorite first-person game, be sure to thoughtfully consider various ways the basic concepts behind that game could be adapted to the unique characteristics and typical use cases of your target platform.

For example, say you want to create something like Minecraft. Simply cloning it with a first-person perspective would be interesting, but would also most likely result in awkward, frustrating gameplay that gets old real fast. On the other hand, focusing on the core element of block-building and employing a more small-screen-friendly isometric view could result in simpler, more intuitive, and ultimately more satisfying gameplay, as we now see in Block World!

And why not venture out into unexplored territory? If you ask me, one particularly exciting frontier for smartwatch game development is augmented reality (AR). The popular AR smartphone game Ingress is already being ported to Android Wear devices and clever game designers are sure to come up with similar territory-based games along with completely novel AR ideas specifically suited to wearable tech. Some of these may blur the line between AR and the general gamification of life. Fitness tracking, the primary (or only) function for many wearable devices, is essentially a gamification of exercise and could easily turn into AR just by adding something as simple as a number indicating the distance of an imaginary beast that will devour you if you stop or slow down too much. What other ideas can you come up with to add an extra layer of fun and excitement on top of your daily activities?

Wherever the burgeoning field of smartwatch gaming takes us, I hope it can be said that PebbleQuest and its predecessors, MazeCrawler and SpaceMerc, have contributed to its early development and inspired some of today’s young tech enthusiasts to envision and implement their own app concepts. In other words, I hope I did indeed “make awesome happen” and that I encouraged others to do the same!