For the past few weeks, I've been working on a set of software for a hypothetical product/service called Fitcoin. I really enjoyed working on it and learned a lot from it, so I thought it'd be nice to write a blog post about my thought process in designing and coding it.
This blog post is essentially an expanded-upon version of the Fitcoin project page. If you'd just like to get the raw details on what Fitcoin is, you can find its page here.
Background
Back in 2011, I bought a Nintendo 3DS game console at midnight the day it came out with money I'd been saving up. The 3DS had a built-in pedometer, and along with it, a feature called Play Coins. For every 100 steps you took, you would earn one Play Coin, and you could spend Play Coins in various games on small bonuses or hints. I enjoyed this mechanic and used it frequently.
Fast-forward ten years. I bought myself a Nintendo Switch console, and on a whim, decided to pick up the 2019 game Ring Fit Adeventure along with it. This game quickly became my favorite on the system, and is one I'm still sinking hours into.
Ring Fit Adventure's ability to make exercise fun and interesting reminded me of the Play Coin feature on the Nintendo 3DS. It occurred to me that creating a cloud-based version of the Play Coin feature could be a great learning experience, since it would involve programming multiple distinct parts that would all mesh together in order to create one distinct experience.
Components
Fitcoin Server
The brain of the service - what makes everything else work together - is the Fitcoin Server program. This provides a REST(ish) API that the Fitcoin iOS app and Fitcoin for Unity API interface with to provide the end-user experience. I designed the API calls based on my experience with the Instructure Canvas LMS API, as I was developing my own client for it. Using the Flask library for Python, I was very pleasantly surprised with how quick it was to get something up and running.
Fitcoin iOS App
The iOS app is how users manage and interact with their Fitcoin account. I had originally intended to take this opportunity to try out UIKit, but in the end chose to stick with SwiftUI instead, since I'm more comfortable with it and wanted to make faster progress.
The majority of development on the iOS app went very quickly and smoothly. As I continue developing apps with SwiftUI, I continue to get a better and better understanding of how to structure an MVVM app, and the speed with which the Fitcoin app was created made me feel like I'm making good steps.
Fitcoin for Unity API
Fitcoin wouldn't be very useful if there was no way to spend it. The Fitcoin Server API includes calls for creating "services" (i.e. games), linking them to users' accounts, and making purchases on the users' behalf. These are just URL requests, nothing particularly special about them.
I do a lot of Unity game development, and wanted to ensure that interfacing games with Fitcoin would be as painless as possible. To this end, I created a small C# library that takes advantage of Unity coroutines and anonymous functions. A lot of the "flow" of the library is heavily inspired by Swift.
service.MakePurchase(
// Pass in the cost of the item
item.cost,
// Execute when an error is returned
onError: (message) => {
Debug.LogError($"Error purchasing {item.name} - {message}");
},
// Execute when the purchase was a success
onResponse: (newBalance) => {
// Add one to the player's current count of the item
int currentCount = PlayerPrefs.GetInt(item.id, 0);
currentCount++;
PlayerPrefs.SetInt(item.id, currentCount);
Debug.Log($"Purchase of {item.name} successful - now have {currentCount}");
}
);
I created a small demo game using the library, with a user interface heavily inspired by Ring Fit Adventure. This was probably my favorite part to work on, since it was the last "piece of the puzzle", so to speak. I was able to use the iOS app to link a user account with the Unity game, via calls to the backend Flask server, which felt really satisfying.
Issues
While I'm quite happy with how the Fitcoin project turned out, there are definitely issues that would need to be considered if it were ever to be expanded into a full-on service.
Monetizing the Service
If I could, I'd make Fitcoin available as a public service, as soon as possible. Unfortunately, server and software development license costs exist. As a result, one of two things would need to happen:
- Someone who really believes in Fitcoin could fund it, knowing that it's money they almost certainly won't be getting back, or
- Fitcoin would have to be monetized in some way.
Option 1 would be really great, but I doubt it's going to happen, and I can understand why. Option 2 would be the more conventional route to go, but after spending a fair bit of time thinking about it, there aren't any great avenues I can see for monetizing Fitcoin.
Subscription-only model: While I would love to use something like Fitcoin, I honestly couldn't see myself paying a monthly subscription fee for it, and I'm the one who created it! If I wouldn't be up for that, I can't imagine many other people would be.
"Fremium" model: I briefly considered allowing users to sign up for a free Fitcoin account, then choose to pay a monthly subscription fee for access to other features. But then that begs the question: what features could be added to the service to make it worth a subscription? Perhaps users could earn more Fitcoin per unit of activity (i.e. where a free account earns 1 Fitcoin for activity, a paid account earns 2), but that just feels cheap to me. And since the user can spoof Fitcoin so easily (see below section), there would be very little value provided to the user.
Doing a Facebook: The service could, perhaps, in theory, go the Dark Route and sell user statistics to make money. This is something I really do not want to do, though. Because I dismissed this idea so quickly, I didn't even get as far as looking into the official Apple guidelines on how users' Health data can be used in this manner, but given how strict Apple is about Health data safety in their documentation, it wouldn't surprise me that they would explicitly disallow this kind of data collection.
Faking Fitcoin
For those of you who also happened to have a 3DS and used Play Coins, it'd surprise me if you never once started shaking the system in order to rack up the "steps" necessary to earn the coins so you could buy some item in a game. Similarly, in the hit mobile game Pokémon Go, there were Eggs that players could hatch by walking a set distance, thus incentivizing players to move and get exercise - but quick Google searches will net you articles that describe how to trick phones into thinking the player is walking, and even physical devices designed to fake it.
The Fitcoin iOS app uses data from the Apple Health app to determine how many Fitcoin the user has earned, and unfortunately it's even easier to spoof the information there, since the Health app allows users to manually input data entries.
So if users can just tell their phone they burned 35,000 calories in the last five minutes and rack up hundreds of Fitcoin in no time, what's the point? Ultimately, I think it comes down to a very simple answer: those users are only cheating themselves. The purpose of Fitcoin is to incentivize taking care of oneself, not to provide a "solid currency". When developers incoroporate the Fitcoin service into their games, I would advise them against allowing players to purchase anything with Fitcoin that would give them an advantage over other players in multiplayer games.
Closing Thoughts
Working on Fitcoin was really fun and allowed me to get some valuable experience with a variety of different topics, ranging from backend server design to frontend UI design. Seeing as there's no clear path to making Fitcoin into a fully-fledged product, I think I'm going to leave Fitcoin as it is and move on to work on other projects for now. I have quite a few other things I'm excited to work on, and I hope to write more blog entries in the future covering those!
Developers for Humanity Discord Server
As I was getting ready to start working on Fitcoin, I discussed the idea with a friend of mine, @ryanslikesocool. We came up with the idea of a Discord community dedicated to using technology in ways that are not only cool but also seek to actively help people. If this sounds like something you're interested in, we'd love to have you at Developers for Humanity!