2nd September 2018 – Joseph
“This has caused us a number of problems, firstly most of the ways in which Java media playback works are either really old or under incompatible licenses.”
This post will be about something we’ve been working on for a while, trying to get Java to play back video files in a cross-platform way. This has caused us a number of problems, firstly most of the ways in which Java media playback works are either really old or under incompatible licenses. Secondly, most of the ones which should work don’t work correctly because they require compiling the source on windows, which is it’s own magic adventure.
The first library we looked at was a VLC wrapper for Java, while this worked really well, it is released under a license which is incompatible with the game (but would be a great library for any open source projects looking for video playback in Java).
The second library we looked at was the ‘official’ way to playback audio and video, JMF, this is an old project which seems largely abandoned. The supported formats are incredibly old and we had little success converting our cut scenes too.
We then tried the FOSS Alternative which worked great on my Linux machine in the office. The native libraries available didn’t seem to work correctly so we tried compiling them from scratch but the windows machines have spaces in the usernames (and consequently the user’s home directories), which upset the build scripts used by the libraries. We created a new user account on the machine, and berated the person responsible for creating the accounts. We still had problems with the compilation and so decided to abandon this approach.
Finally, we settled on using JavaFX, which while not officially part of Java (and also now seems abandoned) seems to work pretty well for handling video (for Windows users at least).
On a side note, Perry has managed to integrate the tech demo I did of OpenAL into the game and has managed to get audio working using it. The music can now fade in and out as a result and it’s sounding great! Here’s a little preview:
Let us know what you think? And until next time, keep up to date with everything Dwarves by signing up to the mailing list and following us on social media.