Alternative Version









August 16, 2021

Kubic Quest


3D Game






A couple of months ago, I did a blog post about the FM-Tracker I made and used for this game called Kubic Quest.

Last weekend, I just revisited the code source of this game which was my end school project. With minor modification (same as FM-Tracker), I was able to run it with DosBox.

Some stats & info here:
- Did in early 2000 with Turbo Assembler (100% in assembly code)
- 3D graphics in software rasterizer (CPU side instead of GPU)
- Flat memory mode (look at the FM-Tracker if you want more detail)
- "High" Resolution 640x480 (Vesa mode)
- 8 camera views
- 3 Enemies
- 2 pick-up items
- No ZBuffer, mesh sorting
- Code source available on GitHub GitHub https://github.com/XorJS/KubicQuest

The story of this game?
If I recall correctly, the story was about an alien with a sword crashed somewhere and he needs to find his missing pieces (treasure) to be able to repair his spaceship, kill any opponents and go back home when he gets all the treasures...

Yes the story is pretty simple. I prefer the John Wick story: Don't touch my dog !


Tools






I used Deluxe Paint Animation to create UI "User Interface":
- Map (bottom-right)
- Game name text: (top-center)
- Health points (bottom-left)






For the 3D objects, I used 3D Studio to create mesh and geometry for the main character, enemies, world and items. I also used 3D Studio to animate the main character (walk, attack 1-2, die). The other animations (enemies, items) are managed inside the code.







Some items need both applications. Like the health points at the bottom-left, I created and animated inside 3D studio and finalized it with Deluxe Paint (created in 3D but used in 2D - Donkey Kong Country style). There are 2 versions of the health point, the full color and the wireframe. The first means you have the health point and the wireframe, you lose your health point.



For the music / sounds, I used my own tool (FM-Tracker). Above is the song I used as a winning and intro song.


Code






The code source is available on GitHub GitHub https://github.com/XorJS/KubicQuest

The code uses fixed point value (24:8) instead of floating point since it was expensive at that time. With 24:8 format, 256 means 1.0, 128 means 0.5, 512 means 2.0. 8 bits are used for fractional part to make computation "fast". More info here.

I implemented a similar cheat code like Wolfenstein 3D did. Inside Wolf3d, if you press M I L keys, it will give you all weapons, keys and full health. I did the same thing with my full name initial:
;=---- Cheat
Mov Al,Gs:[Key_Table[36]] ; Cheat !!! (JSR)
Or Al,Gs:[Key_Table[31]]
Or Al,Gs:[Key_Table[19]]
Test Al,Al
Jnz @No_Full_Life
Mov Byte Ptr Gs:[Life],0111b
@No_Full_Life:

I also used an old trick to save memory which is instead of creating 2 tables one for sinus and one for cosinus, I will use the same table and extend to be compatible with both (sinus/cosinus). There is also another option where we also could use an offset/mask instead of adding some data at the end.

Sinus_3D Dw 0, 6, 13, 19, 25, 31, 38, 44 ; Cosinus
Dw 50, 56, 62, 68, 74, 80, 86, 92 ; Sinus+64
Dw 98, 104, 109, 115, 121, 126, 132, 137
Dw 142, 147, 152, 157, 162, 167, 172, 177
Dw 181, 185, 190, 194, 198, 202, 206, 209
Dw 213, 216, 220, 223, 226, 229, 231, 234
Dw 237, 239, 241, 243, 245, 247, 248, 250
Dw 251, 252, 253, 254, 255, 255, 256, 256
Dw 256, 256, 256, 255, 255, 254, 253, 252
Dw 251, 250, 248, 247, 245, 243, 241, 239
Dw 237, 234, 231, 229, 226, 223, 220, 216
Dw 213, 209, 206, 202, 198, 194, 190, 185
Dw 181, 177, 172, 167, 162, 157, 152, 147
Dw 142, 137, 132, 126, 121, 115, 109, 104
Dw 98, 92, 86, 80, 74, 68, 62, 56
Dw 50, 44, 38, 31, 25, 19, 13, 6
Dw 0, -6, -13, -19, -25, -31, -38, -44
Dw -50, -56, -62, -68, -74, -80, -86, -92
Dw -98,-104,-109,-115,-121,-126,-132,-137
Dw -142,-147,-152,-157,-162,-167,-172,-177
Dw -181,-185,-190,-194,-198,-202,-206,-209
Dw -213,-216,-220,-223,-226,-229,-231,-234
Dw -237,-239,-241,-243,-245,-247,-248,-250
Dw -251,-252,-253,-254,-255,-255,-256,-256
Dw -256,-256,-256,-255,-255,-254,-253,-252
Dw -251,-250,-248,-247,-245,-243,-241,-239
Dw -237,-234,-231,-229,-226,-223,-220,-216
Dw -213,-209,-206,-202,-198,-194,-190,-185
Dw -181,-177,-172,-167,-162,-157,-152,-147
Dw -142,-137,-132,-126,-121,-115,-109,-104
Dw -98, -92, -86, -80, -74, -68, -62, -56
Dw -50, -44, -38, -31, -25, -19, -13, -6

Dw 0, 6, 13, 19, 25, 31, 38, 44 ; Cosinus
Dw 50, 56, 62, 68, 74, 80, 86, 92 ; Sinus+64
Dw 98, 104, 109, 115, 121, 126, 132, 137
Dw 142, 147, 152, 157, 162, 167, 172, 177
Dw 181, 185, 190, 194, 198, 202, 206, 209
Dw 213, 216, 220, 223, 226, 229, 231, 234
Dw 237, 239, 241, 243, 245, 247, 248, 250
Dw 251, 252, 253, 254, 255, 255, 256, 256






The game contains 3 enemy types and each of them has its own "AI".
- Bottom-Left: Seek and Destroy mode. If you are close to it, it will attack you (homing mode).
- Bottom-Middle: Dummy AI and acts like the ball in the pong game.
- Bottom-Right: Freedom walk with some random attack.


Voilà!



Above is a gameplay video I did last Sunday running under DosBox (sorry for the auto-speed/frame) on Windows 10.

A lot of issues I wanted to improve: use zbuffer, fix some clipping issues, add shadow or fake shadow since it's harder to see when the camera view is other than top view, reduce polygon count (too much polygons on main characters and enemies), better collisions system, ... but I had a project deadline !!!

I did this project 20 years ago and it was pretty nice to do.



Thanks for reading,

JS.