I started this week by finishing up the audio system. For now, the sound data class only stores the filename of the audio asset, loading it from the file every time a new sound channel is created (these could refer to anything from the main menu’s music to the sound of one of the keyboard keys in the intro). This, of course, is very inefficient, but it’s the only way I could figure out to get it working without issues.
In general audio is now working correctly, but there are still some minor features missing implementation. Initially I thought the engine relied entirely on OpenAL for 3D audio but there is also code in the engine to do that and it was easy to enable. For now, to me at least, audio sounds the same as the original, though I’m generally bad at picking up differences in sounds.
Next, I worked on fixing some memory issued that resulted from uninitialized variables and some leaks. There isn’t really anything interesting to say about this, the tools (valgrind and address sanitizers) did most of the work here.
After that I started working on physics again. The main problem is that on some surfaces picking up objects is impossible. This leads to an unplayable game as, for example, the hatch in the second level, that needs to be opened to progress, is almost impossible to interact with. This was caused by the physics library ray-casting system that didn’t return correct distances for objects. This worked correctly in a previous version (2.31) of the library though, so fixing it was a matter of running both versions and seeing where they diverged.
On a side note, sev tried to contact the library author, to see if he still had the original sources for the version 1.53 of the library, which was used in the original game. Unfortunately, he doesn’t have them anymore, which is a shame since everything works correctly in that version.
After having completed the previous task, I tried playing the game. I had to fix some audio features that were disabled, but overall, it went smoothly. Now the biggest issue is with shaders. Playing the game without them is not the optimal experience.
The next thing I did then was to get back to shaders. I fixed the most visible problem from the last time I worked on it which was related to normal mapping. The issue was caused by an incorrect transform matrix that was used on the light direction vector. This was the result of a difference between GLSL and the CG shader language. In the first a matrix can be constructed by passing the vectors that represent the columns, while in the latter, the vectors represent rows.
Now thought there are still some problems with spotlights and fog shaders. I’ll work on these next week, and hopefully implement the shaders for the lower-level settings.
Thanks for reading.