I'm happy to announce True Fool for Android. True Fool is an implementation of the card game Durak with a focus on usability. It was written in Kotlin and libGDX. If you, too, want to write a game with Kotlin & libGDX I have some pointers for you.
As long as nobody corrects me I’ll pronounce True Fool the first published Android game written in Kotlin :).
Now, Kotlin is great even in its current unfinished state. For example, the way Kotlin allows to anonymous functions to be written as blocks greatly simplified the animation logic. Still, I’d like to address some pain points during development that will hopefully be improved in a future version.
After a code change the time between clicking the run button and seeing the application was at least 30 seconds – far too long. This is only partly the fault of Kotlin. LibGDX, IDEA and especially Gradle are to blame, too. I know that a libGDX project in Eclipse without Gradle or Kotlin would take not more than three seconds to start – a difference of an order of magnitude! Incremental compilation of Kotlin will surely help when it comes. And it would help as well if it were possible to create IDEA project files from a Gradle+Kotlin+libGDX project with the Gradle-Idea-Plugin, but I did not manage to make it work. This way, you could spare yourself from the apparently fixed extra seven seconds it takes gradle to check that nothing has changed.
- Especially for the logic resp. rules of Durak the following language features would have been useful: type aliases, extension bag syntax, sealed data classes, value types. For example, the game logic is implemented as a list of game configurations (a data class). In some parts of the application I needed to retain the previous game configuration to compare it with the current. Because a game configuration contains yet other data-classes and no deep-copy is automatically provided, I needed to play tricks with serialization to get a real deep copy. Making the data classes extend Serializable, however, somehow broke the automatic derivation of equals and toString methods of the data classes which I then had to provide by hand.
I might open source parts of the application at some point in the future. I've already started to write a rather formal specification of the logic of Durak which I'll plan to publish soon. The implementation is quite close to the specification. An iOS release is planned as well as a blog post describing the motivation and experiences during the development.
So, why not play a nice game of Durak with Igor & Ivan? They are also fans of Kotlin, or so they told me ;).