Bitcoin Plays Pokémon

As a side project I recently launched ‘Bitcoin Plays…’, a Twitch stream that allows people to collaboratively play retro games, while at the same time donating to charity. As the name tends to suggest, it uses Bitcoin as its medium of payment.

If you wish to get stuck it or just try it out, the Twitch stream link is:

https://www.twitch.tv/bitcoinplays/

For those who want to check where their donations are going to, take a look at this Google spreadsheet:

https://docs.google.com/spreadsheets/d/1v39E57VoOI5u6FbEGqGHWcxT1zhqyb3ye7QcvioYH3o/edit?usp=sharing

Inspiration

I’ve been interested in Bitcoin since I heard of it several years back. Since then, I’ve been curious about some of its possibilities that are more troublesome with traditional payment methods.

Fast micro-payments is one of the features that you really can’t do well with traditional currency transfer methods. Bitcoin Plays Pokémon takes full advantage of this by performs moves near instantly for every Bitcoin payment received.

The idea of automating devices via crypto-currencies also fascinates me. A good example of this kind of idea is the Bucket Splash experiment at http://www.ucontrol.tv/buckets/. By donating to charity addresses shown on the site, you get to trigger water to be tipped from various buckets. You see the result within seconds via a webcam stream.

The Bucket Splash experiment and other Bitcoin powered automation systems, such as the Bitcoin fluid dispenser were strong inspirations for the project.

Software

This project three main pieces of software. These perform the tasks of emulating the game, streaming it to Twitch and controlled the game.

  • Visual Boy Advanced (VBA) – The VBA emulator is used to run the game ROM and is configured to accept input via specially defined keyboard inputs.
  • Open Broadcasting Software Studio – In order to stream to Twitch.tv, the project makes use of OBS Studio. This renders the video content, encoding it and streaming it to Twitch’s servers. At time of writing this, OBS Studio is well known as the best game streaming solution for Linux desktop systems.
  • Bitcoin Plays – The receiving of Bitcoin payments and control of the game is handled via a bespoke piece of software I’ve coded for the task. It makes use of the bitcoinj Java library (used by the Android Bitcoin Wallet, Multibit and others).

The Bitcoin Plays software sets up a new wallet that watches Bitcoin addresses associated with each GameBoy colour control (A, B, Start, Select, Up, Down, Left and Right). Upon receiving a payment, the software immediately makes a virtual key press for that control, causing the emulator to react as if a player was physically playing the game on the keyboard.

Previous iterations of the software were not real time. I initially experimented with a system I’ve now dubbed ‘timed democracy’, which is actually an option still available (but disabled) in the software.

Timed democracy mode would display a countdown of X seconds. This was configurable and I experimented with values between 10 and 30 seconds. During this time period, players could send payments to the various address and the total received in this time period would be displayed next to the name of the control. When the timer hit zero, the control with the most value received in this time period would ‘win’ and be carried out in game.

It turned out this most was not particularly fun. The idea of a move only occurring every 10-30 seconds was not only rather dull, but also impractical if I ever wanted to see players get siginificantly far gameplay wise.

Very early versions of the software didn’t make use of the bitcoinj library. They instead used thread party APIs. I’d experimented with using Electrum’s CLI and several online Blockchain explorer APIs.

The implementation of these required frequent polling of all the controls’ addresses. Not only did this involve additional communications and the complications of parsing the response into appropriate formats, but it also proved to unreliable. Electrum’s servers would occasionally refuse connection, possibly due to too frequent polling requests and the frequent starting of the Electrum CLI process produced quite high load. Third-party API would sometimes not respond, or serve data that was cached by several minutes. None of this was really appropriate for a system that needed to react in seconds.

To get around all these issues, a bespoke watch-only wallet was created using bitcoinj and integrated directed into Bitcoin Plays. This directly connected to the Bitcoin network like any other wallet software, download a thin SPV version of the Bitcoin Blockchain and proceeded to monitor the controls’ address for incoming payments. The relevant control could then be pressed.

This proved to be a much better solution overall. It is much more reliable than using a third-party to handle the Bitcoin network communication and address balance monitoring. For anyone developing any form of automation using Bitcoin (or any crypto-currency for that matter), I would strongly consider whether you need a third-party integration. In cases where reliable immediate reaction to micropayment transactions is required, a direct connection to the Bitcoin network was certainly a must for this project.

Hardware

Currently the Bitcoins Plays software, including the custom wallet application, the emulator and the streaming software all run on a reasonable low specification laptop. It connects via my home gigabyte network to a high speed fibre optic Internet connection, which is used for streaming to Twitch and also for Bitcoin network connectivity.

Charity

All donations are, after a time, sent to charity. There are two main reasons why funds are collected, and not directly sent to charity Bitcoin addresses.

  1. Charities don’t want to deal with microtransactions. Some of the tiny transactions sent by players can actually cause rather large transactions fees when grouping all the outputs together. I felt it best to keep this potential problem away from the charities, and instead wait until a reasonable amount is received before doing single larger payments.
  2. Without special arrangements, it would be difficult to tell if a donation to a charity bitcoin address was just a donations or whether it was specifically aimed at Bitcoin Plays. Without each charity providing a unique bitcoin address solely for the purposes of Bitcoin Plays, this could make controls fire in a seemingly random manner and make collective gameplay almost impossible.

I decided for the purposes of transparency to log details of every charitable donation made from Bitcoin Plays addresses. These details are stored in a Google spreadsheet available at the following URL.

https://docs.google.com/spreadsheets/d/1v39E57VoOI5u6FbEGqGHWcxT1zhqyb3ye7QcvioYH3o/edit?usp=sharing

If you’re got any questions, please contact me via this website or better still, send me a message on Twitter (@DivineOmega).

Balloon Bullies – A Ludum Dare 34 Game

I recently participated in the Ludum Dare 34 game jam. Participants are tasked with creating a game in 48 hours on their own (for the ‘compo’) or in 72 hours alone or in a team (for the ‘jam’).

I went for the hard ‘compo’ option. 24 hours to made game seemed like a challenge, especially with an already busy weekend planned. However, I squeezed something in.

It’s called Balloon Bullies, and it is a deep and thought provoking game about the plight of a singular red balloon.

Okay, maybe not. It’s a simple game, with simple graphics, ridiculous sound effects and funny little stick people that throw rocks at yourever so precious red balloon. And  you’ve got to move it out of the way.

Let Me Play!

If you want to give Balloon Bullies a go, I’ve put it up on itch.io, which is an awesome indie game developer website. You can even play it right in your web browser.

Here’s a widget with a button you can click on for fun.

I hope you enjoy it. And if you do, please rate it on itch.io and/or leave a comment.

If you want to here my thoughts on its development – a post mortem of sorts – keep reading.

Themes

The themes for Ludum Dare 34 (or LD34) were ‘Growing’ and ‘Two button controls’. When developing Balloon Bullies, I made sure to include elements of both.

  • Growing – When in game, the balloon you control (pilot?) inflates over time. Growing larger and larger, it becomes a bigger target, thus making the game more and more difficult. Yes, I know, balloons tend to deflate over time if left alone, not inflate. But the sake of a sensible difficulty curve it inflates.
  • Two button controls – You steer your balloon using two buttons. One swaps the up/down directions, and the other swaps the left/right directions. Simple!

It’s actually quite rare for there to be two themes in Ludum Dare game jams. The themes are voted for before people start developing, and usually one wins outright. In this case, these two themes got exactly the same number of votes.

Crazy.

Retrospective

Overall, I’m happy with the game. Sure, it is simple, but its a bit of challenge (especially on the higher difficulties) and most importantly it is fun to play.

I got a few awesome comments, like these:

Something like this would probably work very well as a mobile game. Bonus points for using both themes. I liked it! @oav

Cool game! Great use of the theme! @87meansSuhail

Nice take on two buttons. I like the toggle concept. Would be cool to see it taken further. @xopsx

Finally someone is talking about balloon violence. @awentzonline

So that’s great and of course, pretty motivational.

I’d like to participate in another Ludum Dare game jam in future, perhaps at a time where I put my full focus on the development. The things I really feel like I need to improve on for the next Ludum Dare I take part in are as follows.

  • Graphics – All the graphics in my game are built using basic 2D geometric primitives (lines, circles, rectangles, etc.) and nothing else. Despite having visuals, the game files actually contain no images whatsoever! This is great in that it keeps file size down and means the game runs speedily on all but the slowest of toasters, however it does mean you get some mixed-bag comments. Perhaps some pixel art next time?

The art style looks like something a 6 year old would draw, but it doesn’t matter because I had a good time.

  • Sound effects – This really covers audio production in general. I was a little limited in what I could do, because I was having to develop on my old on-its-last-legs laptop. However, all the sound effects were literally me making whoosh and weeeee noises into the microphone and then tweaking them slightly. My aim was to get sounds that were obviously made in this fashion, but in a comical way. I think I did this okay, but the sound quality and production methods weren’t great.

The sound effects were really funny, albeit not of good quality.

Technical

Balloon Bullies is a HTML5 game that makes use of the Convergame game engine, which I am also a developer for.

The game has been made so it is compatible with a variety of web browsers and devices. It works on the latest versions of Google Chrome and Mozilla Firefox at time of writing this. It also works fine on the mobile version of those browsers, so you can play it on mobile phones and tablets. Yay!

Regarding mobile browsers, unfortunately audio was not always working on the mobile version of Google Chrome. I didn’t have time to dig into why. Other than the sound, gameplay and graphics work perfectly.

Conclusion

I made a game and had fun doing so. Cool people played it, and most of them had enjoyed it as well

I’d say that’s a win! 😀

5 Reasons Open Source Software is Good For Your Business

In recent years, open source software has become more frequently used by businesses and individuals alike. Why is this, and what makes open source solutions so increasingly popular? Below I list five reasons why open source software can be good for your business.

Security

The security of software used in your business is very important. It is used to protect, process and store your company’s intellectual property. By its nature open source software has the code it comprises of visible to all. This means large open source projects are frequently reviewed by the community, allowing security vulnerability to be spotted and resolved quickly and effectively. Compare this to proprietary software. With programs that do not have the code publicly available, you must rely upon the vendor to identify security issues. Not only that, but you must then trust that these problems will be resolved (and distributed) in a timely manner – a task which often rubs against the vendor’s motives for profit.

Quality

Open source software is frequently made by people that have a real drive and interest in the software they are working on. They strive to create quality software and work with others to do the same. Additionally, open source software tends to meet the needs of its users very well. This is sometimes due simply to good initial design. However, a lot of the quality present in open source software is the result of users participating in its design and development. This can be as simple as reporting bugs or suggesting features or can be as involved as having meetings regarding the program’s design or even digging into the code itself. With proprietary solutions, the need for a feature and the amount of time dedicated to its quality development is mostly the function of the vendor’s or their clients’ budget. Improvement in the quality of proprietary code is otherwise driven only by market competition/demand and public relations.

Freedom

Many proprietary software packages will create lock-in for their users. This can be done by using custom protocols, undocumented file formats or otherwise not complying with established standards and best practices. This ensures users and companies that use the vendor’s software will be forced into upgrades, new versions and compatible software in order to continue accessing their data. Such vendors often dictate their own vision of their software which may conflict with your business practices or requirements. Additional hardware may also be required to run the latest and greatest version of their software package. Therefore, as a business, you may often be at the mercy of your proprietary software vendor(s). In contrast to this, open source systems allow users to be in control of many of these decisions. It allows them to do what they want with the software. Not only is the code available, but with any significant open source project, there is typically a large community of developers and users willing to help with this.

Interoperability

As open source projects generally have no need to use proprietary file formats, they are generally more compliant with official standards. This can make them more interoperable with other business software. Standard file formats and network protocols enable your company to integrate open source solutions into a variety of applications. This is much more possible than with proprietary software, which can often encumber businesses and cause their software environments/infrastructure to be restricted by interoperability constraints.

Cost

Proprietary solutions typically force end-users and business owners to incur expensive licensing fees, often per site or even per machine. With vendor lock-in in effect, this can result in a high initial outlay as well as potentially prohibiting growth of the company’s information technology resources. Open source solutions are typically free to use. They also allow you to metaphorically ‘try-before-you-buy’. A company can try out a possible solution with no worry of directly incurred costs. If the company is able and willing they are also able to make modifications to the open source software they use, in order to meet business requirements, rather than be at the mercy of their vendor to implement a required feature.

Conclusion

Of course, all this being said, your business should not necessarily use open source software for everything. However, with all the benefits open source solutions and its community can offer, it would be neglectful to not seriously consider use open source solutions in at your company.

This post was originally written for the Rapid Web blog.

The Fundamentals of Git – Presentation

I recently gave a presentation at Rapid Web regarding Git. It covers the background of Git, how it works internally, and some examples of daily use. The presentation also covers commonly used Git terminology and provides a frequently used command reference.

‘The Fundamentals of Git’ presentation is embedded below. Comments and constructive feedback are definitely welcome. This presentation is licensed under the Creative Commons Attribution-ShareAlike License.

The Fundamentals of Git Presentation – Description

Git is a distributed version control system, created by Linus Torvalds, and used worldwide by many software developers for a large number of well known software projects.

In this presentation, I explain the fundamentals of the Git software and some of its internal workings and related terminology. The target audience is individuals who have used Git before in a limited capacity and want expand their knowledge of the software to improve their daily use of it. The presentation could also be useful for those with knowledge of Git and a desire to improve their understanding of some of the more technically elements.

The Fundamentals of Git presentation is shared on slideshare.net.

Will wearable computers impact website use?

Google Glass with prescription frames
Google Glass may coming one of the first move leaders in the wearable devices field

When mobile phones and tablets first arrived, the website design and development community at large did not immediately foresee an impact on in their field. However, by the start of the 2014, the landscape changed as people were spending more time using mobile apps than using their desktop web browsers.

Web developers adapted, increasing their creating of mobile specific sites. Later on, we saw the creation of ‘responsive’ websites that adapt gracefully to the size of the device they are viewed on. Now web designer are starting to look at a mobile-first approach, in which small screen sizes are targeted for design, with the idea that the website will dynamically adjust to fit larger display.

Website design can be tricky for smaller screen devices, such as mobiles phones, but with the up-and-coming wearable technologies such as Google Glass and smart watches, the screen real estate available is not feasible for current web design. We can see some evidence that the manufacturers of these device know this. For example, Google Glass does not come with a fully fledged web browser, nor do many of the smart watches currently available.

Not only is the screen size an issue for wearable tech., but the way users interact with these devices could also be a problem. With Google Glass, the only forms of input are via voice control and a series of touch sensitive controls on one side of the frame. With most smart watches, primary interactions are done either via buttons of the side of watch or via a tiny touch screen. These screens are usually only large enough to support basic taps and gestures.

This suggests websites are not a suitable form of media for most wearable devices, due to their low amount of screen screen and limited interactivity. It is also likely that wearable devices will continue to move towards an app only model. In this case, we will likely see more developers focusing on apps for these devices, as their market share continues to grow. Due to their nature, it is quite possible the increase in apps for wearable devices will reduce the need for people to visit websites as frequently as has occurred in the mobile devices market.

How to generate test data for a web application

I’ve coded my fair share of websites that require user authentications in some form or another. Often, you’ll need to test registration forms, user details, billing/delivery address, foreign characters and all kinds of fluff related to user accounts.

Most of the time, this will be ‘user test’, ‘test1’, ‘test2’, ‘aaa’, ‘foo’, ‘123’. Sound familiar?

Sometimes you need believable information, either for testing purposes (fuzzy unit tests anyone?) or to show as a placeholder for real data on a website design. I’ve found the Faker PHP library is perfect for generating this kind of data.

Faker can generate a wide variety of testing data for your web application. This includes:

  • names
  • addresses
  • telephone numbers
  • companies
  • email addresses
  • websites
  • lorem ipsum
  • images
  • catch phrases
  • credit/debit card details
  • date times
  • user agents
  • colours

Its very easy to use as well. At its simplest, just include the library, instantiate its main class, and access its sensibly named attributes. It returns a string result as you’d expect.

require_once '/path/to/Faker/src/autoload.php';
$faker = Faker\Factory::create();

echo $faker->name;
echo $faker->address;
echo $faker->text; // lorem ipsum text

// Generate multiple different names
for ($i=0; $i < 10; $i++)
{
    echo $faker->name, "\n";
}

I’ve found this very useful. Take a look at the Faker GitHub pages.

How DNS (the Domain Name System) Works

The Domain Name System (DNS) is analogous  to a very advanced phone book. It allows computers to convert the easy-to-remember domain names (e.g. google.com) into the less than memorable IP addresses (e.g. 173.194.41.64) that computers use to communicate with each other.

When I was at university, one of my classes reviewed many networking principles. One of these was DNS. I distinctly remember being shown a video explaining the basics of a DNS request. Although I can not find the exact video our was shown, the following makes an excellent substitute.

This video explains the basics of a DNS request – the kind of request your computer (or your Internet service provider) sends out to lookup a domain name and retrieve the related IP address(es).

The inventor of Bitcoin does not matter

Newsweek recently released an article claiming to have identified the inventor of Bitcoin (known by the alias ‘Satoshi Nakamoto’). Via Internet wide debates, media chases and further interviews, it is almost certain that the person Newsweek outed as the inventor of Bitcoin,  is not who they claim.

Dorian Satoshi Nakamoto
Dorian Satoshi Nakamoto was almost certainly reported incorrectly to be the inventor of Bitcoin by Newsweek

Without a doubt, the mystery around Satoshi Nakamoto’s real identity is part of the intrigue and story of Bitcoin itself. Satoshi’s real identity is a curiousity that no doubt someone will always try to find out. The entire cryptocurrency community could say they are thankfully to Satoshi for his developments in this space, but in the same breath, the community can also say his identity does not matter.

Due to its peer to peer nature, Bitcoin and other similar cryptocurrencies can go on and function fully, without Satoshi being involved at all. In fact, ignoring any new features or bug fixes, Bitcoin does not require constant supervision by developers.  It would just keep going, handling payment and transactions without a problem.

This is in stark contrast to the traditional banking and finance systems, which require constant manual supervision, approvals and management.

Some people have suggested economic reasons for Satoshi’s identity remaining concealed. Many people believe Satoshi holds a large stash of bitcoins from the initial blocks that were mined. If these bitcoins were to ever move, or be sold off, it would be conceivable that this would dramatically change the value of Bitcoin, simple due to the huge quantities involved.

Most people believe Satoshi destroyed his private keys and therefore is not about to spend these bitcoins. This has never been proven, and theoretically can not be, without their owner admitting to it in a signed message.

Personally, I do not believe the movement of these bitcoins would have a long term impact on Bitcoin. The core functionality of the Bitcoin protocol would continue to work, and due to its anti-fragile nature it would likely continue to function for the foreseeable future.Without a significant cryptographic weakness or a massive leap in technology, such as quantum computing, Bitcoin and other cryptocurrencies will keep running, with or without the real Satoshi Nakamoto.

Why accept Bitcoins on your website?

I recently wrote an article about why you should accept Bitcoin on your website, specifically focusing on the benefits of accepting Bitcoin payments within e-commerce business.

This was published on my employer’s website as an informational blog post and is reproduced below for additional exposure.

You might have heard of Bitcoin in the news. It’s had a great deal of worldwide media attention in recent weeks. But what exactly is Bitcoin and how can it help your business and e-commerce website?

Bitcoin is both a new digital currency and a payment system. It is a secure and very inexpensive method to handle payments online or in person.

Bitcoin offers many advantages to businesses thinking about accepting them on their e-commerce website, such as:

  • Very low transaction fees – Bitcoin transactions are processed in a very quick, efficient and decentralised manner. This means you can send and importantly receive payments over the Bitcoin network for little to no fees, a welcome relief for those familiar with the expensive transaction fees involved in accepting credit/debit card payments.

  • Fraud and chargeback protection – Many businesses have had to deal with fraudsters performing chargebacks on their credit card or PayPal transactions just after their product has been dispatched, causing loss of money and increased man hours required to deal with this kind of chargeback fraud. Payments made with Bitcoin are mathematically irreversible – chargebacks are impossible, which means merchants accepting Bitcoin payments do not have to deal with chargeback fraud at all.

  • Accept payment from anywhere – Banks typically do not do business with some countries, and some countries do not have a typical banking infrastructure. If you’re accepting only credit/debit card payments, you’re limiting your audience. Bitcoin transactions can be made internationally, with the same speed and low fees as domestic transactions. Bitcoin makes no distinction.

  • PCI compliance is unnecessary – Accepting card payments directly on an e-commerce website comes with a whole lot of costly work involved in ensuring and monitoring PCI compliance so your payments are secure and you are allowed to continue accepting such payments. Payments made over the Bitcoin network are secure by their nature and your e-commerce website does not need to deal directly with people’s personal payment details, therefore the burden of compliance is truly not required.

  • Marketing opportunities – Merchants accepting Bitcoin collectively could be considered a type of emerging market. Relative to traditional payment methods, there are not many merchants accepting Bitcoin yet. This means accepting Bitcoins on your e-commerce website can be a great marketing opportunity, and promoting your acceptance can result in a boost to website traffic and conversions.