Go to file
2024-03-04 20:04:51 -05:00
bin Embed video, get releases working 2024-03-04 19:52:30 -05:00
cutest-1.5 update cutest 2024-02-28 13:10:57 -05:00
old start on rabbit positioning 2024-02-20 12:51:59 -05:00
system ready for push to public git? 2024-03-04 17:38:03 -05:00
.gitignore Embed video, get releases working 2024-03-04 19:52:30 -05:00
arena.c finish spritesheet handling, hook up to makefile 2024-02-24 10:38:46 -05:00
arena.h collision detection works and is fast. for now. 2024-02-25 12:52:42 -05:00
bmpload.c shuffle code around 2024-02-20 08:00:13 -05:00
bmpload.h character can move around 2024-02-15 21:18:15 -05:00
chicken.bmp init 2024-02-14 20:15:55 -05:00
combat_test.c wow lots going on 2024-03-01 20:40:51 -05:00
combat.c ready for push to public git? 2024-03-04 17:38:03 -05:00
combat.h ready for push to public git? 2024-03-04 17:38:03 -05:00
const_test.c ready for push to public git? 2024-03-04 17:38:03 -05:00
const.c ready for push to public git? 2024-03-04 17:38:03 -05:00
const.h ready for push to public git? 2024-03-04 17:38:03 -05:00
font8x8_basic.h time to start tuning the game 2024-02-26 07:52:59 -05:00
game.c ready for push to public git? 2024-03-04 17:38:03 -05:00
game.h ready for push to public git? 2024-03-04 17:38:03 -05:00
game.lnk character can move around 2024-02-15 21:18:15 -05:00
makefile start on constraining mouse pointer correctly 2024-03-02 17:05:30 -05:00
movement_test.c ready for push to public git? 2024-03-04 17:38:03 -05:00
movement.c ready for push to public git? 2024-03-04 17:38:03 -05:00
movement.h ready for push to public git? 2024-03-04 17:38:03 -05:00
powerup_test.c ready for push to public git? 2024-03-04 17:38:03 -05:00
powerup.c ready for push to public git? 2024-03-04 17:38:03 -05:00
powerup.h wow lots going on 2024-03-01 20:40:51 -05:00
README.md final readme tweak 2024-03-04 20:04:51 -05:00
run shuffle code around 2024-02-20 08:00:13 -05:00
screenshot.png add screenshot 2024-03-04 19:58:56 -05:00
setup.sh commit stuff 2024-02-20 06:48:12 -05:00
spawn_test.c ready for push to public git? 2024-03-04 17:38:03 -05:00
spawn.c more tests, tuning difficulty 2024-03-01 07:55:01 -05:00
spawn.h add unit tests? 2024-02-28 12:50:57 -05:00
sprites.asm ready for push to public git? 2024-03-04 17:38:03 -05:00
sprites.h ready for push to public git? 2024-03-04 17:38:03 -05:00
spritesheet.xcf way more stuff 2024-02-27 08:16:16 -05:00
spritesheet.yml ready for push to public git? 2024-03-04 17:38:03 -05:00
sprtsht.bmp wow lots going on 2024-03-01 20:40:51 -05:00
test add unit tests? 2024-02-28 12:50:57 -05:00
test.c start on constraining mouse pointer correctly 2024-03-02 17:05:30 -05:00
timer.c more prep stuff 2024-02-15 08:34:50 -05:00
types.h init 2024-02-14 20:15:55 -05:00
unchained.c more prep stuff 2024-02-15 08:34:50 -05:00

DOS VGA Arena Shooter Game

A Smash TV/Robotron-like game to help me learn a whole bunch of things about game programming, DOS & PC programming, x86 assembler & C, and VGA graphics!

screenshot

Video of the game in action here!

Play!

The latest build of the game is under Releases. Send any feedback you wish -- it's appreciated! -- but I really don't know when I'll get back to working on this.

Use WASD to move, left mouse to fire, aim using your mouse. Shooting enemies restores health and gives you coins. If you earn enough coins, you can upgrade:

  • P will increase damage per shot
  • O permanently upgrades your max health and restores all your health
  • I will increase the amount of health you can get from shooting enemies

There are two weapon pickups:

  • Yellow is a shotgun, firing a spread of three shots
  • Red doubles up your shots, potentially making it through more enemies

Much of it is not working:

  • The game just starts.
  • The game doesn't end when you run out of health. Hit [Escape] to end the game.
  • The difficulty needs serious tuning.
  • It does not look good.
  • If you play for too long the game will likely crash.

Try it out!

Setup

Builds are done on a host Linux system with Open Watcom 2.0 installed to a local directory. On my machine, that's ~/Applications/open-watcom-v2. Tests and game are run in DOSBox-X.

Clone and build Open Watcom 2 for DOS cross-compilation

You'll need to build Open Watcom 2 from source to get DOS compilation on Linux. Follow the directions on their GitHub wiki.

You may need DOSBox installed for the Open Watcom 2 build.

Modify setup.sh to use your local Open Watcom install

Changing the path of export WATCOM should be enough

Install Ruby and the RMagick gem

The spritesheet builder uses Ruby and RMagick to produce the x86 assembler spritesheets from spritesheet.bmp.

Install DOSBox-X

I used the Flatpak version and created a wrapper script in my PATH:

#!/bin/sh

flatpak run com.dosbox_x.DOSBox-X "$@"

Try building the game & tests

bin/game builds and runs game.exe and bin/test builds and runs the unit tests.

Make a release

bin/release makes release.zip which contains the game and the DOS/4GW wrapper.

What's in here?

System access code

Everything in the system folder is about directly accessing the PC hardware:

  • keyboard.c accepts keyboard input using a keyboard interrupt.
  • mouse_io.c accepts mouse input.
  • pc_stuff.c does various PC things with interrupts.
  • vga.c accesses the VGA card and has drawing routines built for 32-bit protected mode code and using the 320x200x256 chained VGA mode (mode 10h).

Unit tests

I'm using the CuTest library to write basic unit tests for the game. I wanted to try out C unit testing and see what libraries could work on retro machines, and CuTest fit the bill. The tests run directly in DOS.

Compiled sprites

I automated the pipeline to building compiled sprites from a bitmap file. Originally, I was doing memory copies from that bitmap file, and no matter how much I optimized them, they were slow slow slow. Having Ruby build the sprites as a series of mov instructions sped up the game immensely.

Inline assembler

There's some non-trivial inline assembler in system/vga.c for drawing font glyphs. https://github.com/dhepper/font8x8 is the source of the font. I probably could have gotten the performance fast enough in pure C, but I really wanted to try some inline assembler.

Bitmap loading code

Before switching to compiled sprites, I wrote code to load BMP files to a memory location of your choosing, as well as to extract the palette for feeding to the VGA card.

Open Watcom wmake Makefiles

The Makefiles are not sophisticated, but it took me quite a while to research Open Watcom's slightly different syntax for Makefiles. The GNU make docs didn't help too much.

License

MIT License on the code. If you use any code verbatim, or do anything else with this, let me know!

CuTest has its own license.

Any art that's not the spritesheet is (C) John Bintz, all rights reserved. That should only be the chicken.bmp file that's used as an example for bitmap loading code.