Wednesday, May 1, 2019

Platform Explorer Code Complete

In the old days of Game Creation with XNA, there was a popular Microosft XNA project called "Platformer". This starter kit contained code + content to demo basic game mechanics of a simple platform video game.

Therefore, the "Platformer" starter kit seemed a good candidate project to port to the Sega Master System. Enter Platform Explorer!

Inspired from previous posts on Sega Console Programming and devkitSMS Programming Setup, Platform Explorer is my fourth 8-bit video game written in C / Z80 assembler to target Sega Master System (SMS). Let's check it out!

Note: previous titles published for the Master System include 3D City, Candy Kid Demo + Simpsons Trivia.
Download source code here.

Sega Retro Gaming post documents how to play video games like Platform Explorer using a Fusion emulator.
devkitSMS Programming Setup post documents development environment required to build C / Z80 source.

Instructions
Simple: move joystick Left or Right to run and Button1 to jump. Avoid all enemies + guards and watch out for the pits! After feedback from the community, you can now choose game speed as Slow [motion] or Fast.

After the third iteration, the first 10x levels are Tutorial and the currently remaining 40x levels are available "New Game". There is capacity for 80-100 levels. Please let me know if you'd like to design some levels J

Tools
Here is a list of Tools and frameworks that were used in the development of this project:
 KEY  VALUE
 Programming  devkitSMS
 Compiler  sdcc 3.6
 Assembler  WLA-DX
 IDE  Visual Studio 2015
 Languages  C / Z80
 Graphics  BMP2Tile 0.43 / GIMP 2 / paint.net
 Music  Mod2PSG2 / vgm2psg
 Emulators  Emulicious / Fusion / Meka

ROM Hacking
You can hack this ROM! Download + dump PlatformExplorer into Hex Editor, e.g. HxD, and modify bytes:
 ADDRESS  VARIABLE  DESCRIPTION
 0x004F  DelaySpeed  Used during dev disables screen delays.
 0x0050  Invincible  Non-zero value enables auto invincible.
 0x0051  Difficulty  Set value to 1=Hard otherwise use Easy.
 0x0052  Game Speed  Set value to 1=Slow otherwise use Fast.
 0x0053  World No.  Set start world no to zero-based value.
 0x0054  Round No.  Set start round no to zero-based value.
 0x0055  Music Off  Set 0=music to play otherwise disabled.
 0x0056  Sound Off  Set 0=sound to play otherwise disabled.
 0x0057  Enemy move  Set value non-zero to disable movement.

Bonuses
  • Player will receive free man for every 20x gems collected during game.
  • Player will also receive bonus 5x gems on collecting all gems in level.

Cheats
  • Press Button2 five times on Start screen and you will be invincible each game this is actioned.
  • Press Button2 three times while holding down on Difficulty screen to navigate to select screen.
  • Press and hold Button2 during game play to reset player to original starting spot in each level.
  • Press and hold Button2 while holding down to secretly quit out game back to the Start screen.

Credits
Extra special thanks goes to sverx for the devkitSMS. Plus StevePro Studios would like to thank eruiz00 and haroldoop for sharing source code from SMS Homebrew projects. Many ideas here were used in this project!

Homebrew
The Homebrew community at SMS Power celebrates Sega 8-bit preservation and fanaticism each year with its annual competitions. Therefore, this is always an opportunity to participate by entering these games!

Platform Explorer presented the challenge of reverse engineering the original Platformer starter kit code written for a more modern CPU with floating point functionality and run on an 8-bit system with no FPU!

Thankfully, "Writing a platformer for the TIC-80 fantasy console" blog post was available and helped to build more optimized code by pre-calculating physics velocity + acceleration and caching in integer lookup tables.

Promotion
A simple video was made to promote this game. But a special mention must go out ARCADE MAN for all his work producing some amazing videos for the Coding and Hack entries in the SMS Power! 2019 Competition.

Summary
To summarize, the 2019 Coding Competition featured fewer entries than last year as opposed to the Hacks. The quality of the hacks in 2019 was really high and actually scored higher than coding competition entries!

The hacks are mainly based around the KiddEd editor. Explanations about how to use editor are found here: Create an IPS patch in editor. Download "Alex Kidd in Miracle World" ROM and use Lunar IPS to patch ROM.

This video tutorial demos how to patch ROMs with IPS patches. Maybe something to try for a future project!