Ultra Air Hockey (Sega ports, redux)

Leave a Comment
Work resumes (again) on the Sega ports of
Ultra Air Hockey

   As I may have mentioned earlier in older news posts, the BEX/Sega homebrew port of Ultra Air Hockey was cancelled around Winter 2014/2015. (BEX is a BASIC language for the Sega Genesis/CD/32x.) This was due to several issues that occurred while developing it, including
instability of the BEX compiler and other bottlenecks. As the homebrew ROM executable became bigger, internal errors of the compiler being unable to compute jump offsets of large "bsr.w" branch Motorola 68k instructions began creeping in. Although it seemed to be a false positive of an error (since the ROM still compiled), further in development, I feared the ROM would corrupt further as it became bigger and more complex; in fact, at one point, a subroutine of code dealing with paddle movement ceased working between two builds, despite the BASIC code of that subroutine being nearly identical and valid between both builds. Furthermore, I made the mistake of trying to build a (poorly written, custom) port of the SpriteLibrary I used for sprite management in the PC QB64 code, and using the buggy "include" command of BEX to include that code, which seemed to create problems. I attempted to port that library over, with the future intention of using it to port over other games written with that library from QB64 to BEX and the Sega Genesis. Coupled with future problems of having to rewrite sections of the game code (due to the QB64 code using some subroutine/functions with parameters passed by reference, a feature which BEX cannot do), manage sprites and collision manually, and most importantly, have to deal somehow with trigonometry to handle puck movement and rebound angles (because BEX cannot handle neither trig functions nor 16/32-bit fixed point arithmetic), major development issues were ahead. It was at this point that I decided to ditch the BEX build, and refactor the game using C and the SGDK library for GCC

   Why did I move development to the SGDK? Well, for several reasons. Firstly, the SGDK is opened source, C-based, more stable, and is updated more regularly than BEX (which hasn't had an update in years). With it being C-based, I could use a real programming language, and use main parts of the code in the future for any additional ports of the games to other retro platforms, and simply modify the baseline code for hardware-specific changes. Furthermore, it contains more complex and useful programming features out-of-the-box, including direct sprite support (including sprite collision), fix16 and fix32 fixed port arithemetic and trigometry functions, passing function parameters by value and by reference, etc. Furthermore, being C-based, it is easier to split the program into smaller testable modules of .c and .h files, instead of having a giant text file of all the main function and all of the subroutines and function.

   Although SGDK does have its benefits, it has a few drawbacks in comparison to BEX. BEX is cross-platform, allowing the user to write the code once, make a few minor tweaks, and allow that same code to run on the Sega CD and Sega 32x add-ons. At the time of this writing, SGDK does not officially support hardware-specific Sega CD and Sega 32x features, but there are a few ways to extend the baseline SGDK support to run and compile for Sega CD and 32x, but I believe it takes more effort. Also, the BEX port had the benefit of a very close code translation between the original QB64 code and BEX (being that both are BASIC languages), and is BASIC.

    Over the past week of summer, I have begun transcribing the old BEX Basic code to SGDK C, and have most of the menus and introduction created, shown below. These menus are mostly the same as shown in older videos, just written in C and with a few additional features, including fade outs of palettes and splitting the sound test into a separate music test and sound test options item. There are a few bugs to fix, but the functionality is basically the same as before, and as tested with my Everdrive MD, the code works on hardware too!

  Now to working again on the paddle handling :)!


Post a Comment

Please login with either OpenID or a Google Account, and then post your comment. Please be respectful and courteous. NO SPAM ALLOWED!

Copyright EagleSoft Ltd. Powered by Blogger.