Open source Sonic The Hedgehog engine built for the original PlayStation
Find a file
2024-08-05 22:25:06 -03:00
assets Add PSP banners and other paraphernalia 2024-08-05 21:49:20 -03:00
include Perform all level allocation through an arena allocator 2024-08-05 22:25:06 -03:00
screenshots Update README.org 2024-08-05 02:34:52 -03:00
src Perform all level allocation through an arena allocator 2024-08-05 22:25:06 -03:00
tools Unconsider geometry kind name when generating collision 2024-08-01 18:25:45 -03:00
.dir-locals.el Add util library 2024-07-12 20:48:23 -03:00
.gitignore Add camera, adjust timer variables, add push anim, extend level 2024-08-05 00:19:50 -03:00
buildshell.sh Add debug text and first BGM 2024-07-16 20:56:21 -03:00
CMakeLists.txt Add collision height mask generation script. YAY!!! 2024-07-31 23:54:35 -03:00
CMakePresets.json Add Makefile and emulator support 2024-07-11 00:58:18 -03:00
iso.xml Add camera, adjust timer variables, add push anim, extend level 2024-08-05 00:19:50 -03:00
LICENSE.txt Initial commit 2024-07-10 23:41:01 -03:00
Makefile Add collision height mask generation script. YAY!!! 2024-07-31 23:54:35 -03:00
README.org Update README.org 2024-08-05 02:36:00 -03:00
system.cnf Add collision height mask generation script. YAY!!! 2024-07-31 23:54:35 -03:00

engine-psx

Open source platformer engine built for the Original PlayStation.

Uses PSn00bSDK.

/Archive/engine-psx/media/commit/304c64eda190cd9e70f692ebfa53432e8a1b9251/screenshots/engine-psx-080524.gif

Engine short video running on DuckStation, dated [2024-08-05].

About

This is a platformer game engine build for the PlayStation 1, heavily inspired by Sonic The Hedgehog. The focus here is on experimentation, attempting to build a sane 2D engine in pure C while taking advantage of what the PlayStation has to offer in terms of hardware.

This engine is opensource and can be built by anyone. Also, since it uses Psn00bSDK, it also contains no copyrighted material. Plus, any tools used in this project are modern, opensource or cheap to acquire.

Some assets use different formats than common formats. This is because I needed a better way to process these files, or the PlayStation recognizes different formats.

All code is tested under emulators PCSX-Redux and DuckStation, and are also tested on real hardware (a PlayStation model SCPH-5501).

Recommended tools

Here are some tools I've been using:

  • GIMP with G'Mic plugin (to reduce image colormaps to 256 colors with no dithering);
  • Aseprite (for handling sprite sheets and tilemaps), plus some useful script files (tweak export_tileset.lua so it only exports with a row_len of 32, since all tiles are 8x8);
  • mkpsxiso, to build the ISO files;
  • gcc-mipsel compiler toolchain;
  • timedit, to import images and convert them to .TIM format;
  • wav2vag, to convert .WAV sound effects to .VAG audio;
  • psxavenc, to convert music to a preliminary .XA format;
  • xainterleave, to interleave .XA files into a single, ready-for-production .XA file;
  • cdrdao, if you intend on burning your ISO on a CD-R;
  • CMake and GNU Make, for build scripts.

Some of these tools are already available when you properly install PSn00bSDK. Just follow this guide.

Running on real hardware

/Archive/engine-psx/media/commit/304c64eda190cd9e70f692ebfa53432e8a1b9251/screenshots/engine-psx-080524-realhardware.gif

Engine short video running on a PlayStation SCPH-5501, dated [2024-08-05].

In theory, to burn the disc, you would need a Sony license file which comes bundled with the Psy-Q SDK (which I AM NOT using). I WILL NOT provide these files for obvious legal reasons. But if you manage to obtain them, tweak iso.xml to add such a license file. I cannot guarantee that the ISO will work on real hardware if this file is omitted.

You most likely will need a PlayStation console that allows you to run homebrew software I did not do anything on my model, but again, I bought it from someone else, and I didn't open it up to check if it was still intact from day one.

You will also need a CD drive capable of burning CD images to physical disks, and you will also need good quality CD-R disks. Do not ignore this. If you're a fellow brazillian, I recommend Multilaser.

Remember also that this method was tested in an SCPH-5501 model.

Use a command such as this to burn your image into the disk by using cdrdao (do not use other software, unless you know what you're doing):

cd build/
cdrdao write --speed 1 --driver generic-mmc-raw --swap -n --eject "engine.cue"

If you're on Windows or you need more information on other methods, check out this awesome guide.

Running on your browser

NOTE: As of now, for some reason, EmulatorJS won't load the game. You can still play it on an offline emulator such as DuckStation or pcsx-redux.

If you're using a browser emulator such as EmulatorJS and you need your .ISO + .CUE to be a single file, you might want to use something to convert it to .CHD format. You can do this by using a tool called tochd:

tochd -d . -- ./build/engine.cue

Gallery

Screenshot Description
/Archive/engine-psx/media/commit/304c64eda190cd9e70f692ebfa53432e8a1b9251/screenshots/engine-psx-080524-realhardware.gif Alpha engine [2024-08-05]. Same as screenshot below, but on a physical PlayStation (SCPH-5501).
/Archive/engine-psx/media/commit/304c64eda190cd9e70f692ebfa53432e8a1b9251/screenshots/engine-psx-080524.gif Alpha engine [2024-08-05]. First implementation of collision, camera and level data.
/Archive/engine-psx/media/commit/304c64eda190cd9e70f692ebfa53432e8a1b9251/screenshots/engine-psx-072224.gif Alpha engine [2024-07-22]. Running on DuckStation.
/Archive/engine-psx/media/commit/304c64eda190cd9e70f692ebfa53432e8a1b9251/screenshots/engine-psx-realhardware-072124.gif Alpha engine [2024-07-21]. Running on a physical PlayStation (SCPH-5501).

License

Licensed under the Mozilla Public License 2.0.