Skip to content

SaffronCR/msx-rpg

Repository files navigation

Star Rangers: A Dungeon Crawler for the MSX2

The objective of this project is to learn some programming for MSX2 computers while having some fun creating an old school dungeon crawler.

My primary references are games like The Eye of the Beholder, Shining in the Darkness, and Digital Devil Story: Megami Tensei.

image

It's being created in GRAPHIC 4, SCREEN 5 mode (resolution: 256 x 212 pixels, 16 colours per pixel). It allows 4 pages of VRAM.

How video memory is organized during dungeon gameplay:

  • The first page is the active page (the one being visible on the screen). I stopped using double buffer since I noticed it takes too much time and means having two pages dedicated exclusively to it. The VDP is fast enough to draw directly on the visible page so I can keep the second page for storing additional graphics. The first screen is also the page storing the hardware sprites (currently I'm not sure if I will end up using them in the game).

    image

  • The second page is mostly empty now. Currently I use it to prepare the dungeon view, since that requires drawing different pieces using the painter's algorithm and that would be visible to the player if done directly on the active page. I will probably store other graphics in this page eventually.

    image

  • The third page contains the bitmap font, dungeon background and sprites (player avatar, enemies, etc).

    image

  • The fourth page contains the dungeon walls.

    image

Things done:

  • Dungeon rendering and movement.
  • Dungeon random generation.
  • Bitmap font rendering with color support.
  • Music support.
  • Sound effects.
  • Start screen.
  • Menu navegation system.
  • Minimap (Debug mode).
  • Show current palette (Debug mode).
  • Character sheet.
  • Weapon and Armor sheet.
  • Pseudorandom number generator using a xoroshiro32++ algorithm.
  • Input wrapper.

To-Do List:

  • Character creation.
  • Character status screen.
  • Hub City.
  • Dungeon progression.
  • Enemies/Combat.
  • Treasure generation.
  • Gadgets/Streams.
  • Save/Load game.
  • Game Over screen.
  • Intro.

How To Compile

  • Download the repository with your git client of your choice.
  • The project is configured for Visual Studio Code, but any other editor will do.
  • Download and install SDCC 4.1.0 (http://sdcc.sourceforge.net/). Make sure it's added to your PATH.
  • You need to modify SDCC included libraries to make them compatible with Fusion-C. Open a terminal window and browse to the Z80 library folder (SDCC\lib\z80), then type these commands:

copy z80.lib z80.save

sdar -d z80.lib printf.rel

sdar -d z80.lib sprintf.rel

sdar -d z80.lib vprintf.rel

sdar -d z80.lib putchar.rel

sdar -d z80.lib getchar.rel

  • Download and install OpenMSX (https://openmsx.org/). Create a folder inside the project called "openmsx" and extract the emulator to it. You will also need to find and install the system roms in the "share/systemroms" folder.
  • Run generate_sound.bat to generate the sound files.
  • In Visual Studio Code you can select "Terminal/Run Build Task" to build and run the game.
  • The game should run.
  • Enjoy!

Coding Standards

The game is being developed as if the year was 1986, the main reference available at this point is the first edition of The C Programming Language book (ANSI C was not even finished until 1989). I mostly try to keep to the style depicted in the book, with some changes since I already was a C programmer in the 90s and developed my style over ANSI C, so when something doesn't feel right to me, I will "house rule" it, since there was no actual rules back then. Kind of awesome when you think about it, right? :-)

License

Star Rangers is being created by Cristina Ramos.

The game code is licensed under a BSD-3-Clause License.

The game art (graphics, fonts, music and sound) is licensed under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0).

Third party resources:

Fusion-C Library 1.2 - Author: Eric Boez & Fernando Garcia

http://www.repro-factory.com/ https://github.com/ericb59/Fusion-C-v1.2

Palette based on DB16 - DawnBringer's 16 Col Palette v1.0 - Author: DawnBringer

http://pixeljoint.com/forum/forum_posts.asp?TID=12795

First Person Dungeon Crawl Art Pack - Author: Clint Bellanger

https://opengameart.org/content/first-person-dungeon-crawl-art-pack

Cyberpunk Street Environment - Author: ansimuz

https://opengameart.org/content/cyberpunk-street-environment

Scifi creature tileset - Author: Stephen Challener (Redshrike[T3h Luggage])

https://opengameart.org/content/scifi-creature-tileset-mini-32x32-scifi-creature-icons

More RPG enemies - Author: Redshrike

https://opengameart.org/content/more-rpg-enemies

MSX-DOS binaries (MSXDOS.SYS and COMMAND.COM) - Owned by MSX Licensing Corporation

http://www.nishi.org/

Nextor binaries (NEXTOR.SYS and COMMAND2.COM) - Author: Konamiman (Néstor Soriano)

https://github.com/Konamiman/Nextor

1-Bit Pack - Author: Kenney

https://kenney.nl/assets/1-bit-pack