Posts tagged Programming

How I Made Reversi Magic For Android/iOS (And Games In General)


A few weeks ago, I took a bunch of my old computer systems (Atari’s, GameBoys and Sega Systems) to my kid’s school to show them off as part of his “History Of Video Games” project he had worked on. Several of the kids ask me, as a games programmer, how I make them, and even my own kids recently have started asking questions about how I make the small games that I do, so I thought I would write this up showing how I made my Reversi Magic game to hopefully educate them a little bit, and also anyone else who might be interested in learning the process.

Firstly, I should start by saying that the various methods used by different people tend to be very different; I take a more OldSkool approach to writing games than say, some of the modern game programmers. Also, being that I work mostly in my spare time, at home, at night, in-between a full time job & managing the kids, some things get done with more priority than others. Someone with more resources/time etc. can probbably get things done a lot quicker. That being said, i’m always open to feedback so feel free to comment on this if you have some 🙂 Don’t shoot me if I do something differently than everyone else 🙂

Coming Up With Ideas

Before I start laying in any amount of code, I usually try to come up with an idea of where I want the game to go. Depending on the game and whats going on, there might not even be an idea yet. Ideas tend to come from existing games, so you might have a couple of web games that seem good, but if one had this feature, or copied ideas from this, it might be even better. If I have a general idea of what I want to work on, i’ll take an empty project file of mine (which consists of the game basics such as the menu’s and basic graphics, enough to be able to press Play, and just start adding game code right away) and modify it to work with a very crude, but simple engine showing the gameplay for this idea. This will be tweaked until the game is able to do what I was thinking of, then its evaluated for how well it plays.

 Some of these tests might seem pretty good, even with very basic graphics (often coloured blocks or re-used images). Others, will be quite bad. It’s not a bad thing if the idea doesn’t yet work, it just needs more refining. After working on a very basic idea, its often good to have a friend play with it and have them give you some feedback. You are trying to find an idea thats engaging to you and your players, so if your friend is very quickly bored, or finds the idea too challenging or confusing, then you need to head in another direction.

In this picture, this game (called Avalanche!) was put together in about 2 days altogether, to show off some ideas I had about a columns-based game, and matching snowflakes together to make some cool snowy explosions etc. In the end, I never released the game, but it was fun to work on the prototype.

In the past, I have prototyped as many as 30+ different game ideas, some better than others, until something comes up. Often, you’ll know when a good idea comes up as you’ll find yourself playing it for ages, while not getting bored of it. Also, your friends might like playing it too. They are also handy to come back on later as well, i’ve worked on some I haven’t touched in years, bringing some new changes and various elements to the table that turn it into a better game.

The Design Process

Once you have thought of a solid idea to work on, it’s often a good idea to do a brief design draft of where the game should be heading, so that you don’t fall off the wagon too easily. If you’re going a route that’s not recommended or you get stuck what to do next, you still have your plan to fall back on for guidance. Again, depending on the type of game you are writing, you can also define a list of specific behaviour rules here, that must be followed at all times. For example, if it’s a puzzle game, you would lay out the logic here exactly, so that you know exactly how it’s supposed to play. If its doing something its not supposed to, you can later analyze this logic to start tracking bugs. This is more important for larger games, or puzzle games that have a lot of different AI/Logic combinations.

Normally I do paper notes for almost all of my games, I still have notebooks with designs in them from my days of writing programs on the ZX spectrum games! One day, i’ll put all that stuff online, but it won’t be today hehe 🙂

Below is my notebook pages that I did for my Reversi Magic game, that’s currently available on Android, iOS and Kindle Fire. The notes were done a year or so ago. The idea was very simple, and I have always been interested in playing Reversi on the computer, with this game not being my 1st on the computer. The goal was to make a simple, easy to pick up game that anyone could familiarize themselves with, without having to learn any new rules or be bombarded with over-the-top graphics. Not all games require notes, but it doesn’t hurt to play with pen/paper every so often to make some design sketches. These 2 pages are the design spec that I originally set forward to complete:


The 1st page just covers some simple layout rules and goals that I would like to have the program meet, and the 2nd page shows some interface layouts for various orientations, and a few other design elements such as an idea I had for dynamic grid frames.

Applying Code

 Once you have a clear idea of where you want to go, you can start laying in code. I’m often asked which part of the game do I start on first? Most people always assume that the graphics are first. The correct answer is actually the AI/Logic of the game (how I do it anyways) with a little bit of graphics work to get the basic shape of what you are working on. The graphics for this game were actually quite simple to do. I use a CAD program called CoCreate, so I used it to make the rotating disk image and capture each of the frames for it. The picture on the left is a small version, with an added drop shadow to make the edges stand out a bit more. The actual images are a lot bigger, so they look sharp & crisp even on the iPad Retina displays. The backdrop is also translucent, so the shapes can be blitted anywhere.

I spent a full month of non-stop coding of the AI engine for the game. The tough parts were testing it to make sure it plays 100% compliant moves, so in the end, there would be a long debug report of the game, how the computer did, as well as opportunities that it took/missed so I could review and tweak the AI later. The AI algorithm itself is based on a combination mix of NegaScout & Min/Max game theories. The Min/Max algo will evaluate scores recursively for the Best/Worst possible scoring points, and NegaScout does some pruning to several paths in that tree, to ensure the answer it comes out with can be found faster. Combine this with some traditional elements of gameplay, a method of looking at grid moves to determine how risky they are, and you have a very powerful AI routine. You can learn more about the Min/Max methods Here in this great tutorial (with samples and images).

The next hardest part of programming the AI was to teach the computer not to be too hard on beginner players. Its programatically easy to make the computer as hard as nails when it comes to playing the game, but how do you adjust those levels so that they are somewhat forgiving to a new player? Again, with a reverse NegaScout algo, and a few other traditional playing rules implemented, the computer will now assist the player to some extent when playing its moves, so as not to dominate. Of course, there are always some people who are just not very good at the game (or Reversi in general), and as I have seen on the feedback for my games, they think the game is the fault and tend to leave negative feedback because of that.

Your game should also show assists/help to your players, for when they get stuck and cannot decide where to play a move. They also may not realize they can play a move in certain areas. In Reversi Magic, I added options that show you where you can place a tile, they actually cycle in and out as small transparent disks of your colour. Tap the disk to place your move. There is also an option that shows you where the opponent last moved, so if you are not following the board too closely, you can still see where they last played and how it affects your strategy. Both of these assist options can be turned off in the game Options screen at any time, though they are enabled by default for first time users of the game. In my original design, I had wanted to show how many disks were going to be flipped for each move that was shown as available, but as experienced players will tell you, playing for the best possible score every time is not the best playing strategy at all, so I eventually removed it.

Cleaning Things Up

Now that the majority of your code is done, the last part of the process is to apply the spit & polish needed before you release it. For me, this is usually when I will finalize all of my graphics, and add all of the last bits of fine tuning to the game. Normally, i’ll sit in a room with my Nexus 7 and play the game, write down all the stuff that I see that is annoying, or needs fixed (out of place text, menus that move too slow, playing effects that should happen that don’t, ways to improve the ingame experience etc. etc.) and then after I have the list, i’ll set forth on making the changes. If you are not already doing so at this point, its often a good idea to send out your game to some private testers. Friends/family often make a good choice, but you want to pick some who are open to give you criticizing feedback (and some who will actually give feedback!) Listen to their complaints and what they think might make the experience better. You might not be able to implement it 100% exactly as everyone wants it, but you might be able to meet in the middle, especially if several testers are reporting on one specific area/feature of the game (which normally means you should focus some effort on it anyways).

From Prototype, To Finished Game

 When you think that the game is ready, it can be released to the world. Be sure that before you release it, it has been tested thoroughly by your team, as there is nothing worse than having a game that gets launched on a platform such as iOS and theres a massive bug in it that prevents users from playing properly. I’ve been there, and its not a good feeling, as Apple are not very fast when it comes around to updating. The general public tend to do more crazy things with the game (seeing as there is much wider exposure to strange incidents) so putting your app through the ringer beforehand, making sure certain phone events don’t crash it, is extremely important. If you plan to release on tablets as well, be absolutely sure to test a range of different tablet resolutions, both in the Landscape/Portrait aspect. You should also make sure your graphics look good, as if someone on say a retina iPad has to look at your scaled-up low resolution logos, it makes for quite an eyesore.

In the above pictures, I have used my game Twinz! as an example of what the game may look like in prototype, to the final product. The left screenshot is from the prototype game I did in about 2005 or so. It was just a handful of images, a simple shaded image for the door shutters, and a small logo. The image on the right is taken from an iPhone running the released version of the game. As you can see, the screen’s real-estate has been cleaned up to make the size of the tiles more optimal, and get rid of the unused areas. This game runs great on tablets, and features high resolution tiles.

Whats Next?

After the launch, you can sit back and watch your total downloads go up for each market, and wait for your customer’s feedback. Most players are nice in that they will contact you directly about any bugs they might find, before they leave negative feedback, so if you do get not-so perfect app feedback, or bug reports, be sure to get right on top of them and prepare for an update in the future.

While I have yet to become mega rich or famous from one of my games, this is still a hobby that I love to do, and hope that one day at least one of my games will be successful enough that I can quit my job and focus on doing this full time 🙂

If you want to play any of the games mentioned above, or any other games of mine, please visit the app store for your preferred device and try them (there are free versions of all of my games): Amazon App Store (For All Kindle Fires), Apple App Store, Google Play

Should you find the info in this page useful for anything, show your support by buying a game! If you have questions, ask in the comments or send me a quick email. Thanks!


New Tool In Development – Litecoin Miner Status – Monitor Multiple Litecoin Miners At Multiple Pools!

Project Update
This project has now been officially released. You can visit the project page (and download the tool) Here or get to it throught Discography tab at the top of the page. Thanks!

LTC Miner Status ScreenshotI have been working on a new tool for the last couple of weeks to assist Litecoin miners in their quest of mining. As a Litecoin miner myself in this new coin, a few pools started to pop up here and there and there was not much of a way to track what was going on. Hence my tool came along!

A common thing with any coin mining process is hopping, or switching from one pool to another. With my tool, you can see what you are doing across multiple pools, including how much LTC you have mined and how much you have been paid.

The interface is split into 3 main portions. The top part is a “ticker” of sorts that pages through the supported mining pools, showing you the current overall stats of that individual pool such as it’s overall mining speed, and the number of individual miners currently working there (and their combined KH/s speed). The middle field view shows the miners you have listed in that specific pool (If any) and what your miners are currently doing there. The base view is an overall view of your current mining summary across all of the supported pools. The tool is quick, easy to use, and sits quietly in the background keeping itself updated.

The tool is currently going through the last few days worth of testing with some close friends and miners, and I hope to have it released in the next couple of weeks once all the fine tuning has been done to it. If you are interested in testing out the tool, feel free to get in touch with me at andy [at] with your information. You can also find me on IRC , in #elitist, #litecoin and #rfcpool

Support For Many Pools!

At the time of the release, or unless someone suggests otherwise, the following mining pools will be supported from the initial launch of the application:

  • Elitist Jerks
  • OzCoin 

Additional Mining Pools

If you own/run/reccomend another litecoin mining pool that you would like to see added to this program, let me know either by email or in the comments of this post and I will see what I can do to get it in. Your pool must support JSON statistics that can easily be accessed via the web. The tool supports all mmcfe-based pools, I just need to know your details.

The Program Is Beerware!

The program itself will be released as BeerWare, meaning if you like it and you find it extremely handy, you should donate some coin towards a beer or two for the developer! Pool owners who want their pools listed within the app are encouraged to donate a couple of extra beers as well, especially if your pool requires a lot of work to get added (custom JSON etc.) There will not be a charge to buy the program ever, and anyone who does try to sell it for money are trying to rip people off. It will always work the same if you choose to donate or not. Donation addresses to send coin to will be in the About section of the program in various different formats. All donations are truly appreciated 🙂

Donation Addresses

Some people are already asking for donation addresses to bribe with, they are as follows:

LiteCoin: LfrxgdK1PgJQPRkPVDqopQt3FaYVswmp74

More details will be released for the program as soon as they are available. Versions will also be made available for Mac & Linux in time. Feel free to comment or ask any questions in the comments section on this post. Initial testing only available to Windows users. Thanks! FishGuy876


Dennis Ritchie, father of Unix and C, Has Passed Away


Dennis RitchieDennis Ritchie, creator of the C programming language and co-creator of the Unix operating system, has died aged at the age of 70.

Thank-you for giving us a superior language, and being a pioneer in the age of computing. Rest in peace!

/* for Dennis Ritchie */
#include <stdio.h> 

    printf("Goodbye World");

ZD Net Article:

Wiki entry on C: 


Finally Finished Working On My Amiga A1200


AMIIGGGAAHH!I Spent quite a bit of time this weekend working on my Amiga. It has been a few years since I used it for anything other than recording music (for and thought it was about time I got it working again. For quite a while now I have had the itch to get back into programming on the Amiga, and couldn’t think of a better time. Its also not that often lately that I have a few hours of downtime to actually devote to filling the entire kitchen with old computer stuff 🙂

Over the years as a programmer on the Amiga, I have accumulated a fair amount of Amigas, and also bought a few bits here and there. All my Amiga 1200’s are PAL, and every time I fly home to the UK I always bring one back with me if I can find one. On my trip last year, I was able to find an “Desktop Dynamite” pack for 50 quid, so I threw away a bunch of closes and packed my suitcase with wonderful Amiga goodness instead. The machine I had been using previously had a broken pin on the PCMCIA slot, which seems to be a common thing to break on all my Amiga machines over the years.

Amiga 1200 Catweasel HDThe most useful device I ever bought for my Amiga was my Catweasel A1200, it lets me hook up all kinds of drives to the system, and access them natively. In this modification, I will be replacing the built-in floppy with a PC drive. It will prevent me from booting via floppy disk, but the benefits of being able to read Amiga and PC disks while in Workbench are worth it. I also have a Scandy VGA ScanDoubler device thingy that clips over top of some of the chips in the Amiga and lets me connect it directly to a VGA monitor, though I tend to run into a few problems from time to time with it (it might be because my PAL Amiga doesn’t like it, I bought it in the US so it might be NTSC based) such as the screen flickering green or with a tint of blue. For this particular project, I have decided to leave it out of the system and I will put it back in another time. For now, I will settle for my 1084S and a nice Interlaced screen.

Amiga Hard Drive In The PCThe hardest part about working on the Amiga is getting the hard drive working. By default, the Amiga has a size limit of 4gb. I had bought 2 4Gb IBM HD’s online for $1 through Ebay just for this. Now we had to get them working on the Amiga! This is where UAE comes in. One of the nice new features of the newer UAE is the ability to connect Amiga hard drives natively and use them like a real hard drive, instead of the traditional HDF files. It does however still have some problems. It cannot yet (at the time of writing anyways) partition the drive correctly, so all the partition work must be done on the real Amiga. This was a bit of a ballache for me, as I have every Workbench disk except the Install disk (that contained HDToolbox) so I ended up connecting my A2000HD and using an old version from there, just to get the partitions going. From there, I could connect to the drive to the PC and mount it natively.

To begin with, I tried to copy a version of AmiKit to the drive. The copy process went very well, however I ran into a lot of problems getting it to work on the real Amiga. After a few hours of trying to get it to boot, and never reahing the desktop, I decided to take another approach and instead I went with a more simplified Workbench from ClassicWB ( which only required my OS 3.9 CD. The bare basic programs and tools were installed, which was enough to get me started at this point. I added some more games and demos for WHDLoad, and that’s all I really needed. I also took advantage of being online with UAE, and added the newest Catweasel drivers, and a few other tools.

My Amiga has a wireless Netgear card, and I need to use the prism2.device to get it to connect to the network. Once I get moved into my new place next week, I will get that all set up and working. I tried briefly with the Genesis TCP stack and just couldn’t get it to see the card. Nothing like browsing the web on a 16 colour Amiga Interlaced screen! Oh how modern day kids are spoiled!

Detailed Amiga Specs: Commodore Amiga 1200 (PAL, Personally Purchased From the UK), DKB 1240 & 32Mb RAM (030 & 6882 FPU), Catweasel A1200, 4Gb IBM HD, OS 3.9 w/Boing Bag 1 & 2, ClassicWB Image.

Some Pictures Of Beauty:


Android Development Finally Taking Shape!!


Over the last few weeks, I have been helping my friend Paul port some of his code over to Android. Currently he releases games for PC, Mac, and iPhone and so the move to Android is a good one. Most of my involvement was working on sound, and the C to Java handling code. Lots of stress when digging through the error logs, but it has coming along very nicely! We started the process aiming for an Android 1.6 target, to ensure we can support the most amount of users across all devices.

I have also been tinkering with some of my own Android projects, moreso converting some of the games I have written to work on the new platform. So far its working out well, I have the basis for my framework in and working, and I am hoping to have the first of my games ready in about 2 months. I’ll post more about them here as I get them ready for testing or release.

In the meantime, check out some of Paul’s great games at 🙂


Annoying Problems With std::vector on Linux Vs. Windows


So I spent most of this weekend working on getting my engine to compile correctly under GCC/Linux (Ubuntu 10.4) and ran into some serious headaches. It’s been a few years since I last built anything on Linux at all (last time was when I did some work for Epic Interactive and their linux ports) and took me a little bit to remember how makefiles worked etc. and bring my SDL code up to date.

After compiling the code, I was having a hell of a time trying to figure out why it would always cause a segmentation fault after the first few seconds of running. Here is what gdb had to say:

[Thread debugging using libthread_db enabled]
[New Thread 0xb3da2b70 (LWP 4813)]
[Thread 0xb3da2b70 (LWP 4813) exited]
[New Thread 0xb3da2b70 (LWP 4815)]
Program received signal SIGSEGV, Segmentation fault.
0x0807c27d in ?? ()
(gdb) backtrace

#0  0x0807c27d in ?? ()
#1  0x08083eee in ?? ()
#2  0x0807e59f in ?? ()
#3  0x08082231 in ?? ()
#4  0x08062d98 in ?? ()
#5  0x0804deaa in ?? ()
#6  0x0806659b in ?? ()
#7  0x00369bd6 in __libc_start_main () from /lib/tls/i686/cmov/
#8  0x08049891 in ?? ()

Unfortunately, that doesn’t really tell me much of anything 🙂 After a little bit of playing around with the manual pages in GDB, and some serious googling, I was able to get the app to compile with some debug symbols. This is the output:

[Thread debugging using libthread_db enabled]
[New Thread 0xb3da2b70 (LWP 3711)]
[Thread 0xb3da2b70 (LWP 3711) exited]
[New Thread 0xb3da2b70 (LWP 3713)]
/usr/include/c++/4.4/debug/vector:265:error: attempt to subscript container
with out-of-bounds index 0, but container only holds 0 elements.
Objects involved in the operation:
sequence "this" @ 0x0xb162bf4 {
type = NSt7__debug6vectorImSaImEEE;
Program received signal SIGABRT, Aborted.
0x0012d422 in __kernel_vsyscall ()
[Thread debugging using libthread_db enabled]
[New Thread 0xb3da2b70 (LWP 3711)]
[Thread 0xb3da2b70 (LWP 3711) exited]
[New Thread 0xb3da2b70 (LWP 3713)]
/usr/include/c++/4.4/debug/vector:265:error: attempt to subscript container
with out-of-bounds index 0, but container only holds 0 elements.

Objects involved in the operation:
sequence "this" @ 0x0xb162bf4 { type = NSt7__debug6vectorImSaImEEE; }
Program received signal SIGABRT, Aborted.0x0012d422 in __kernel_vsyscall ()

This error is generated whenever I try and set up Vectors in the code to handle some rather simple arrays. I even tested the code where I created a vector, and checked its size to see if it was 0 and was still able to create the same problem. This is how I did all the safety checks in my code; if Vector.size() > 0 { Safe To Do Some Stuff, If Size Was Legal For Array }.

So, for whatever reason, they behave very differently than in Windows. I really don’t have the time to figure out the specific reasons, though after a couple of hours of googling trying to get GDB to display as much information as it did, it turns out a lot of people have issues with vectors doing strange things on Linux.  As a result, I will be removing that code from the project to make sure it’ll compile and run on all 3 platforms (Windows, Mac and Linux) without any further issues! Lucky for me, it is an easy fix!

Go to Top
%d bloggers like this: