Sunday, April 21, 2013

I'm busy, so I'd like development tools that 'Just Work'. Failing that, I'll settle for ones that 'Make sense'.


This weekend, I finally finished converting our game libraries to Linux - before now, they only ran on windows and in iOS. We've been converting to Android as well over the past month. There's something a little magical about seeing code all of a sudden working on a new platform - perhaps because it goes from 'not working' to 'oh look, a nearly finished project' much faster than normal development. Also, out of curiosity, I installed Clang and built using that, too. Amazingly, this compiled the whole project perfectly (save for a few tiny initialiser problems in a handful of files out of hundreds), gave really useful warning messages, compiled pretty quickly and and ran silky smooth. I love things that work better than you'd expect them to; it's like finding a tenner you weren't aware of. Also, I'm really excited by the possibilities of Clang and LLVM. The shared p-code thing allows for a lot of possibilities for domain-specific front end languages and compiler hacking.

Android, on the other hand, has been challenging - working with the NDK (Native Development Kit - it's what lets you write C++ on Android) is a lot less fun than developing pure Java code for android.  In fact, there should be a clue in the home page where they explicitly warn that this isn't for most people.  One set of people that it is for, although they don't mention this, is developers with large, well developed and tested engines written in C++.
  There's not a lot of 'it just works' in NDK-Land and I suspect that this is intentional. Google, Microsoft and Apple would rather we all use (respectively) Java, C# and Objective-C exclusively to each platform, ensuring an amount of lock-in. Of course, that's not what most developers want. Who wants to recreate 
the same work in three languages and then maintain three sets of code? Sounds like a recipe for a maintenance nightmare to me. Whilst using eclipse for Java was pretty good, smooth and even helpful (despite a few oddities and the ongoing struggle to migrate a workspace smoothly), C++ development (at least, in my android related experience and at the present moment in time) is less straightforward.
   I've found Eclipse to be very fragile for C++ development - I've had several show stopping GUI freezes on IDE startup and numerous cases where things mysteriously stopped working or gave entirely misleading and irrelevant error messages (be warned - you'll want to install plugins whilst running eclipse in administrator mode).
  Also, I'm never quite sure if Eclipse has really built all my data before sending it to the phone, although that was a problem with android development in Java too. That kind of spongy, floaty behaviour makes systematic debugging a non-deterministic chore. There's a lot that seems to go on under the hood in eclipse, lots of data squirrelled away in myriad different files. All of this makes predicting its behaviour rather difficult and I'm coding on edge, waiting for the next Heisenbug.
  

 
Fortunately, the command line tools are pretty good. You can export ANT command line java builds from your eclipse project - I recommend doing this even if you carry on building and debugging in Eclipse. Having a one-stop batch file that builds and deploys is no bad thing. Even if Eclipse has one its seizures, having the command line tools in place means that shouldn't stop you developing or shipping.   
   Debugging is still a challenge. As in: C++ android debugging doesn't seem to work. We had it working briefly (and slowly) but after restarting Eclipse, no dice. Following a tip from the NDK mailing list/google group, I've ordered a Tegra based tablet and will try out Nvidia's DevKit  which people have been saying good things about. For now, debugging is standard output and forced crashes.
Early, non-textured, shot of the game,
now running on Windows, Linux, iOS, Android and MacOS
I used to be more frustrated with Visual Studio and really, really wanted Eclipse to answer all the shortcomings with Microsoft's offering. However, since upgrading to a faster 64bit machine, Visual Studio has been on its best behaviour.  
  On Linux, I'm rather happy with CodeLite (which, unfortunately, usually Googles as COD elite) - it's simple, open source and tends to 'Just Work'.  Codeblocks is also fine.
  

  All in all, despite the inevitable speed-bumps that almost always come with development, I'm very pleased that we have our engine running on three new platforms and hopefully many more to come. My raspberry pi looks like it could do with a snazzy space game...
  That said, I'm looking forward to getting back to graphics and gameplay coding and also to revealing more details about our new game! 


No comments:

Post a Comment