Stig Runar Vangen homepage


Tunnel render method

I've updated the Tunnel Effect to allow selection of render method. Previously the render method was selected automatically based on if the browser supports typed arrays / buffers. By adding this feature, one might compare the performance difference between these methods of rendering within the browser.

What I noticed from doing so, was that since I originally made this demo, back in February 2013, both Chrome and Firefox has improved their implementations for arrays. As of Chrome 31 and Firefox 26, their array implementation are almost identical in speed of the buffer implementation. IE 11 does not support buffers yet, and the demo gives an error message if you try to activate buffers there.
Warning (2): Illegal string offset 'lang' [APP/View/Helper/AppHelper.php, line 37]
Wednesday January 1. 2014

JavaScript Asteroids Emulator

Lately I've been working on a JavaScript-based Asteroids emulator. I've always wondered how a CPU works. Through this project I've gained a lot of insight into how the black box of a CPU really works. The end result of this project is this emulator, and it is now finally ready for the general public.

The CPUs of the past is a lot easier to look into than the current generation, mostly because of increased complexity. I therefore decided to look into the MOS 6502 CPU that was popular in the 70's and 80's. This was the CPU family that powered classics from the arcade as well as home computers like Atari 2600, Commodore 64 and Apple 2.

This emulator works best with Chrome. You may also use FireFox, but you will not get audio, as it does not support Web Audio API yet. This is expected to be available in a later version of the browser. Internet Explorer does not yet support typed arrays, but this is expected to be added alongside WebGL in version 11.

Because this game is still the property of Atari Inc., I cannot legally provide the ROMs required to run this game from this site. If you are in the possession of said ROMs, you may upload these files to your local browser for use with this emulator. These files will remain on your computer only, and will be read from your browser should you choose to visit this page again. This emulator is compatible with the same game ROMs as the latest version of MAME, as of writing version 0.149.

Full source is available for this emulator if you try to view its sources. I've tried to make the source as readable as possible, and hope that you'll learn something from reading these.

Go to Asteroids emulator
Warning (2): Illegal string offset 'lang' [APP/View/Helper/AppHelper.php, line 37]
Sunday July 14. 2013

InstallCert and Java 7

When integration two servers using SSL, one needs to either use properly signed SSL-certificates, or add the custom signed certificate to the callee JVM. There are several articles describing a small application that can do this for you. This application was written before Java 7, and will give a few unneeded exceptions when run. This article describes how to solve this:
Thursday June 20. 2013

Restlet and Spring integration

I've been working on integration the Restlet libraries into our Spring based systems, and this article describes how this integration can be done:
Friday June 14. 2013

Hibernate strong versus weak relationship

After some frustration around Hibernate ORM not saving connected entities, I decided to write a short article describing the problem, and how to solve it:
Thursday March 28. 2013

JavaScript water

After implementing the tunnel effect I wanted to try an another oldschool demo effect as well. This time I tried to implement a water effect which I found at Water effect.

Go to Water Effect.
Warning (2): Illegal string offset 'lang' [APP/View/Helper/AppHelper.php, line 37]
Monday February 18. 2013

Tunnel update

After publishing the tunnel effect, I got some feedback from Jonas Lund on Google+. He suggested using fixed point math for all calculations, which resulted in a speed increase at around ten times what I initially had. This increase in speed almost makes it unneeded to have several levels of quality for present computers. His suggestions also included a few other tricks I was not aware of, which definitely will improve the next project I work on. You gotta love the internet.
Sunday February 17. 2013

JavaScript tunnel

I found an article describing how an old demo effect was implemented at Tunnel effect, and I wanted to try to implement this effect using HTML5 JavaScript.

JavaScript is not well suited for these type of effects, so I implemented several quality levels. The render quality can be changed in the top right corner. It is also possible to improve performance by resizing the browser window to a smaller size.

Go to Tunnel.
Warning (2): Illegal string offset 'lang' [APP/View/Helper/AppHelper.php, line 37]
Thursday February 14. 2013

Added Commodore 64 Games

I've added some games that I made on my Commodore 64. I found these games on some old cassette tapes I found in a box. I decided to try to import them to my computer and digitally preserve them that way. In order to transfer the games I bought a USB cassette player. Each side of these cassette tapes hold 30 minutes of noise, and I had to run through these tapes in 1:1 speed using different methods for recording the sound. After trying several tools for converting autdio files into Commodore 64 application files, I got best results using WAV-PRG. This application takes the recorded audiofile, and outputs several PRG files, which can then be opened in an emulator. I've added the games I was able to extract as a downloadable archive. For playing these games, I recommend using The VICE Emulator.

To compare a cassette tape with the storage technologies of today, the transfer rate of the Commodore 64 cassette was roughly 300 bits/s. This gives an overwhelming 100kB per 30 minute cassette. The storage capacity could be improved to 1000kB using turbo tape software or other fast loaders.

In addition to this, I added counts behind category and tech names, so that one can easily see how many titles are contained behind each link.
Saturday February 2. 2013

Online midlets

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.
Sunday January 27. 2013