I’m in the App Store! Woohoo!

Paint Replay

So, my new years resolution at the beginning of 2012 was to release an app into the app-store. In the end I was one month late, however that’s good enough for me!
Paint Replay is now in the App Store – running on the iPad – just search for ‘Paint Replay’. Now let me just say, if you are looking for some awesome, all singing, all dancing paint application then this is not it – it’s just a simple paint app – but it is free and contains no ads.

PaintReplay_LaunchImage

TL;DR

  • MonoGame is awesome – Everyone should use it for all games from this point onwards!
  • MonoDevelop from Xamarin is awesome
  • A bit of history

    So, approximately 15 months ago I bought a Mac, downloaded a copy of MonoDevelop and decided I wanted to release a game into the App Store. MonoDevelop was perfect as it meant I could program in c# (which is what I do every work day anyway) and I had no intention of learning objective-c – life is too short!
    I then heard about MonoGame – a way of writing something (in c#) that could potentially run on ‘any’ platform – that sounded kind of cool so I thought I’d give it a go. The timing was perfect as I was just learning about Git – and the MonoGame source was hosted on GitHub.
    Anyway, to cut a long story short, I decided to write a simple proof of concept Paint application using MonoGame before diving into developing a game. I developed enough of the app in order to create a simple picture, and then posted a time-lapse video of the picture being created to YouTube…

    I was actually going to leave it at that and start looking at writing a game, however the good folks at Xamarin persuaded me to complete the Paint app.

    Now, here we are some months later and it is in the App Store – and so this blog post gives a small glimpse of how I achieved that and the sort of problems I encountered along the way…

    Why did it take so long?

    First thing to say is that (like everything) it took a lot longer than I first anticipated, however looking back on it this should not have surprised me. I wasn’t working on this 9-5 in the office – this was a ‘in my spare time’ hobby – An odd evening here and there – indeed in the summer I think I didn’t do anything for a couple of months as I was busy enjoying the lighter evenings with the family etc. It would have been interesting to have kept track of how much time I spent on the various aspects of the development – coding – graphics – etc – certainly something I will do for future projects.
    One of the problems with working on something part time in the evenings is that you kind of forget where you are from one day to the next – this invariably means it takes even more time. Also I feel that the quality of my code probably wasn’t the best – by the end of the day you are feeling more tired.

    Mission Creep!
    It is all too easy to add some great new feature to the development list. We’ve all suffered from this – however in this instance I only have myself to blame. With my next project I’ll certainly be establishing early on what should be in the first release and have clear estimates and goals. It’s what we do in ‘real life’ so why should it be different for pet projects!

    MonoGame

    So, let’s talk about MonoGame…

    Well, this is taken from the MonoGame.net web-site and pretty much sums it up…

    …MonoGame is an Open Source implementation of the Microsoft XNA 4.x Framework. Our goal is to allow XNA developers on Xbox 360, Windows & Windows Phone 7 to port their games to the iOS, Android, Mac OS X, Linux and Windows 8 Metro. OUYA, Windows Phone 8, PlayStation Mobile and Raspberry PI are currently in development…

    Imagine writing a game for one platform and then easily porting it to another. If you know nothing about MonoGame then I suggest you head over to their web-site now and take a look at some of the amazing games that have been ported from one platform to another – Massive titles “Draw a Stickman” and “Bastion” are available on at least 4 different platforms by sharing huge amounts of source code between the different platform versions.

    Now, I’ve only released my simple Paint Replay app on to the Apple store, but potentially a lot of the code could be re-used/ shared in order to publish it to other platforms.

    Anyway, I digress…

    So, I was developing my Paint app using MonoGame when I hit upon a problem. I was trying to call a method that threw a NotImplementedException. This was a big problem!
    However, it actually worked out quite well because it meant that I dived into the MonoGame source – implemented the missing method and submitted a pull request. It was accepted and then everything was fine!
    Of course I make it sound much simpler that it was!
    At the time my knowledge of Git was not as it is today – suffice to say that I well and truly screwed up my initial attempt at the pull request. Fortunately the MonoGame guys were extremely understanding and helpful and I eventually submitted it correctly. The great thing here is that this had the side effect of improving my understanding of Git.

    iOS updates

    If you’ve downloaded my app then you may have noticed that it requires at least iOS6. This isn’t because of some new feature in iOS6 that I’m making use of. The problem I found is that the iPad rotation logic seemed to change with iOS6, which meant that my app did not rotate properly. I was almost at the stage of limiting the app to just work in landscape mode, however I eventually managed to resolve the issue – but the problem was that I had no way of knowing whether my ‘fix’ would break the app when running under iOS5 or earlier versions. I therefore set the minimum version of the app to iOS6. I’m guessing that there must be some way in MonoDevelop / xcode etc to set the iOS version that you wish to test the app under however I wasn’t sure. [As it happens I believe I do now know how to do this – something for me to try… Stack Overflow]

    App Submission

    Once the app was complete it was time to submit it to Apple – this was the bit I was most apprehensive about. Would they come back to me with a big list of things that needed changing? Or worst still, just say ‘no’. As it happens this went extremely smoothly! 6 days after submitting my app I received an email stating that it was available for download!

    #OverTheMoon

    If I can do it then so can you!

    If you find yourself reading this blog and are thinking about developing a game then I would strongly recommend using MonoGame – it’s awesome and it’s run by a great bunch of people!
    The main MonoGame web-site is monogame.net – this has links to the discussion groups/ forums and also to the source code on Github (which is free to use).
    If you intend to develop for the iPad/ iPhone then you’ll need to do so on the Mac using MonoDevelop (with MonoTouch) from Xamarin. The free version of MonoDevelop / MonoTouch is fantastic – A fully functional rich IDE that lets you run your app in the iOS simulator. Eventually you’ll want to run your app on real hardware and of course publish it to the App Store at which point you’ll need to buy a license for MonoTouch and purchase an Apple Developer license (although I’d recommend that if you are looking to develop something for iOS that you actually get a license and test your app on real hardware way before you get to the point of deciding to publish it – The simulator is great but there is no substitute for testing on the real thing!). MonoTouch can be found here.

    So what next?

    So, next I intend to develop a game of some kind. Probably something small to start with, however it will definitely be using MonoGame! And I intend to use TDD from the outset.

    If anyone is interested in looking at the source code for Paint Replay then it is on GitHub.

    The web page all about Paint Replay is here.

    Bye bye for now…

    [EDIT: BTW – I’ve only ever tested this on an iPad 2. It should work on iPad mini, iPad 1 and an iPad retina. If anyone does have problems then leave a comment and let me know (or indeed let me know if it works fine – that would be great).]

    MonogameLogo1920x1920 xamarin
    Advertisements

    iPaint

    iPaint

    So, we are a couple of months into 2012 so I thought it was time to post an update on developing with MonoDevelop and specifically using the open source MonoGame project to develop for the iPad.

    Before I start writing ‘the next Angry Birds’ I decided to start with something much easier – a simple paint application – and so that is what this blog post is about!

    If you just want to see the results then jump straight to the bottom of this page where you can watch a time lapse video of the application being used on an iPad simulator. Otherwise continue below for details of the code and my early thoughts on MonoGame…

    iPaint screenshot

    iPaint – The Manneporte near Étretat

    MonoGame

    For full details of MonoGame head over to CodePlex, however basically the idea is that you should be able to develop something that can run on multiple platforms without having to make too many changes to the code.

    I am developing on the Mac, using MonoDevelop and targeting the iPad. To get started you need a copy of the MonoGame library, which can be forked/cloned from GitHub.

    Fire up MonoDevelop, start a new MonoTouch project and add references to the MonoGame project.

    Within a few minutes you should be able to get something very simple appearing on the iOS simulator…

    • Add a new class which derives from the MonoGame Game class.
    • Ensure a GraphicsDeviceManager is created.
    • Override the Draw method and insert your rendering code.

    …and bish bash bosh, there you go – you have something appearing on screen in no time at all.
    Ok, so if you don’t put any code in your Draw method then you just get a ‘nice’ magenta screen but what do you expect for approximately 10 lines of code!

    To implement something like the iPaint app you will need to do a bit more however I’ve found using MonoGame relatively simple and pain free. The only ‘unknown’ at the moment is I don’t know what the licensing situation is – i.e. If (in the highly unlikely event) I develop ‘the next Angry Birds’ and became a billionaire would I owe some ‘MonoGame people’ lots of money?

    Coming to an App Store near you – probably no time soon…

    So, are you going to see iPaint in the app store – errr, no – well, not released by me you won’t. I don’t intend to pay $99 a year for my Apple developers license until I’ve written something more worthwhile – and of course on top of that is the $400 MonoDevelop license which is required in order to run the software on a real iPad and not a simulator. Plus, considering you can buy the most excellent InspirePro for less than a dollar I don’t think that my iPaint app is really going to compete!

    So, what next?

    So, what next, I hear you say. Well, the intention is still to develop a game for the iPad and publish it to the App Store – Development will be starting on that shortly. The question is do I want to use MonoGame or just use standard MonoTouch. This is something that I will need to look into further. Certainly the advantage of MonoGame is that it works very well and has been very easy to use – Also, in theory, porting any game I write to another platform (e.g. WP7) should be easy(ish) – If I want to do that. Are there any disadvantages? The fact it is open source might concern some people – however my experience so far is that it has been very stable – and certainly it has an active community updating it all the time. So, assuming licensing is to my liking I like the idea of using MonoGame – and if I can support the MonoGame community with updates then even better.

    iPaint in Action

    So, that just about rounds things up for this post. Details of where you can get the MonoGame source and indeed the iPaint source are detailed below.

    Also here is a video (one hour condensed into one minute) showing the iPaint app running on the iOS simulator – and my attempt at reproducing Claude Monet’s ‘The Manneporte near Étretat’. Enjoy.

    Resources

    • Details of MonoGame are on CodePlex.
    • The MonoGame source code is available on GitHub.
    • A copy of the iPaint source code is also on GitHub.
    • MonoDevelop can be found here

    xamarin

    2012 – What will the year hold….

    It’s the beginning of a new year so I thought I’d write down my plans and thoughts for the upcoming 12 months – then review them this time next year to see what I’ve actually achieved!

    I read somewhere that as a developer you should expect to have to re-learn every 10 years or so.  Well, it was approximately 10 years ago that I started to learn c# and although I don’t see .net disappearing from my day to day development, I do anticipate having to learn some ‘new stuff’ this year – exciting times at work in fact!

    However, I’m going to concentrate on what I want to achieve using MonoDevelop (outside of work) this year…

    Over the years I’ve started to write many games – starting on the ZX Spectrum in 1985 – The Amiga in 89/90’ish – and the good ol’ Win PC in the years that followed.  However, either priorities change, or boredom creeps in, I get bogged down with the sprite design or whatever; and invariably I rarely finish the game.  But this year is going to be different!  Why?  Because I intend to write a game for the iPad and submit it to the Apple App Store – so the incentive is that maybe someone other than myself might play it.

    So early days at the moment, however I have MonoDevelop installed on the Mac, MonoGame cloned from GitHub and a load of ideas buzzing round my head.  Possibly have a friend interested in creating some graphics and sounds for me too, however he was rather drunk when he expressed his interest so he may not recall it 😉