True Fool – Mobile Game Made With Kotlin


#1

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 ;).


#2

Big congrats!


#3

Thanks a bunch!

Now, there are at least two Android Apps written in Kotlin: True Fool (mine) & Android Rivers (yours). I wonder if there are more? Might be a good idea to gather them in some kind of wiki as a showcase.


#4

I bet there are more especially those in house Android app that never gets published to Google Apps. I am right now in the process of training one of my Java programmer to adopt Kotlin.


#5

That fantastic! I I have a half written game in kotlin and libgdx and I had a similar experience.  The language is great, but the compile times are too long.  I usually see about 15 to 20 seconds however, not 30


#6

Yeah, I can't wait until incremental compilation and Gradle 2.0 are supported. Hopefully, this will improve the situation wrt compilation time in a couple of months.