Here is my UDGJ2 entry; ModPlayer and I want socks now It is not of course, but I wanted it to be somehow ready for the UDGJ. Maybe someone wants to use it for their Jam game.
As a dinosaur developer, I miss my C64 and Amiga days. When developing this simple extension I remembered those days a lot.
Mod Player (aka chiptune player) can load and play good old .XM and .MOD file formats.
There are some hitchups, but extension supports MacOS, Windows, Linux, Android, iOS and HTML5. Unfortunately, HTML5 bundle is little tricky. There is a little py script which simplify things for now. Please read the details on Github page.
Asset Portal: https://www.defold.com/community/projects/147260/
Simple Examples: https://github.com/selimanac/defold-modplayer-examples
Nanowar Example: https://github.com/selimanac/nanowar-modplayer (All credits goes to @benjames171 )
Most important issue for me is that I couldn’t find a way to retrieve build path when developing on Defold Editor. It returns something like …/Defold.app/… and it is not possible to read files from that location. As a workaround I added a
player.build_path function for manuel setting. But this is just for working on the editor only. If there is a better way of doing this please let me know.
I couldn’t test the musics on Linux because I couldn’t manage to configure the sound card on my VMs successfully. If someone can test it I’ll be glad.
Other notes and know issues:
- Loading and parsing is blocker. It will block the main thread (UI thread). Since the mod files are small it is better to load them when bootstraping or preloading. It may cause a pause on UI.
- Loading and parsing .XM files much more faster then .MOD files. Use XM if possible. (Tested with same tracker file as .mod and .xm)
- Not %100 compatible with every MOD or XM file.
- I couldn’t find a way to retrieve build path when developing on Defold Editor. You have to provide a full path to
player.build_path("<FULL_PATH>/res/common/assets/")function for working on Defold Editor only . It doesn’t required when bundling.
- Different platform bundles didn’t tested very well.
- MacOS: Long run.
- iOS: Long run.
- Windows: Short run. Tested on Wine
- Android: Short run.
- Linux: I couldn’t manage to have sound on my VMs. But app is successfully load the files and run on Debian and Ubuntu
- Hashtable is limited to 10 elements. I think it is more than enough. It is a bad practice to load or play more than two music files at the same time.
- Currently, it is not possible to Build HTML5 on the Defold Editor with mod music. You can build it for testing, but can’t load the the musics.