Online midlets

Sunday 27.01.2013

Lately I've been working on viewing the mobile games I've made on these pages. Games created for mobile Java, or MIDlets, are not easily runnable nowadays.

J2ME was originally formed through JSR 68 in 2002. The standard has later been abandoned, and nowadays one have to create applications for each target platform.

In order to run MIDlets one has to use an emulator. The most popular one is MicroEmulator. The emulation in this emulator is however not perfect. You do for example need to change your application somewhat for it to be runnable by the emulator.

After modifying the games so that they were runnable by the emulator I ran into problems regarding the audio. For some reason their implementation of the audio libraries only allow you to playback a unique sound once. There were also some problems regarding MIDI playback that stops after a few seconds. In addition there were some problems related to how loading of sounds are implemented, which results in crashes on load. Looking through their code I was not able to figure our how their implementation should be fixed.

What I ended up doing, was to use the reference implementation provided by Sun/Oracle. This implementation shows how to implement their interfaces. These implementations have some methods that reference native calls to the OS. I implemented all these native methods using the J2SE sound API. The end result was a fully working MIDP 2.0 sound API implementation.

Armed with this fully working implementation I patched the emulator. This resulted in an emulator that perfectly emulates the audio calls from the original games. This was the last piece of the puzzle, and I can therefore present these games on these pages.

My games originally needed only sampled and MIDI playback. The original API also defines functionality for playing tones. For the sake of completion, and for the fun of it, I also implemented this API. The biggest challenge here was to convert notes into their respective frequencies. By using a list of frequencies for each note, I managed to get a working formula. Using the reference implementation I didn't have to implement all the special operations, as this was already converted into a simple note for number of milliseconds datastructure. The use of blocks were for example converted into one long sequential sequence. The end result has some noticeable defects when the song turns into low frequent period, which almost sounds like an UFO buzzing away. There are also some clicks between notes sometimes. These errors are mostly related to rounding errors, and might be something I fix at a later date.

Pages updated

Monday 07.01.2013

These pages has received a facelift. The design of these pages has remained the same since late 2009, and I din't like how the look anymore. I therefore decided to take some time and update the design of these pages. I've also taken the time to update the design using modern techniques. The page design is for example completely responsive, which means that the same page will be able to serve content to all devices from the high-end desktop user to a mobile phone. This was realized using the Amazium framework.

During this process I've also updated the pages to use the latest version of the CakePHP framework. This framework has changed a lot since I've used it last, and I therefore had to change a lot of the backend code.

Take a look at the screenshots below to see how the page design has changed since the last design. The last image shows how the new pages look on a mobile device.