Repository navigation
Building from Source
This page covers compiling Shattered Stars yourself, running its tests, making the release
packages and building the Archipelago .apworld. The commands are for Linux; the Windows
release is cross-compiled from Linux. A macOS build (Apple Silicon, Xcode's clang) is a
release candidate: the same cmake commands work there, with CMake and Ninja from Homebrew or
pip3 install --user cmake ninja, and port/tools/build_macos.sh makes its zip; headless runs
there use SDL_VIDEO_DRIVER=dummy, since SDL's offscreen driver can't open a window on macOS.
git clone https://github.com/IronJade/Shattered-Stars.git
cd Shattered-StarsThe repository contains no game data. To run the game or the disc tests you need your own disc images, as for playing (Installing and Setup).
| Need | Notes |
|---|---|
| CMake 3.24 or newer | |
| A C++20 compiler | GCC or Clang |
| Ninja | Optional, but the examples use it |
| SDL3 development files | Recommended: sudo dnf install SDL3-devel (Fedora) or sudo apt install libsdl3-dev (Debian / Ubuntu). Without them the build downloads SDL 3.4.18 (pinned by SHA-256) and builds it, but that copy only has sound if your system has the PipeWire, PulseAudio or ALSA development headers |
| OpenSSL development files | Optional. Without them the Archipelago client can only use ws:// servers, not wss://
|
| zlib development files | Optional. Lets the Archipelago client use compression |
| Python 3 | For the tools in tools/ (patch writer, smoke test, packaging helpers) |
CMake also downloads, pinned by SHA-256 or version:
- Dear ImGui, for the setup program;
- apclientpp with wswrap, websocketpp, asio and nlohmann/json, for the Archipelago network client.
| Option | Default | Effect |
|---|---|---|
SS_BUILD_SETUP |
ON |
Build the setup program (fetches Dear ImGui) |
SS_BUILD_AP_NET |
ON |
Build the Archipelago network client (fetches apclientpp and its dependencies) |
For example, -DSS_BUILD_SETUP=OFF leaves the setup program out.
cmake -S port -B port/build -G Ninja
cmake --build port/buildThis produces, in port/build/:
| Program | What it is |
|---|---|
shattered-stars |
The game |
shattered-stars-setup |
The setup program |
ss_tests |
Unit and disc tests of the hardware layers |
ss_game_tests |
Tests of the game code |
Run the game with port/build/shattered-stars, or set it up first with
port/build/shattered-stars-setup. Disc paths given on the command line are remembered:
port/build/shattered-stars --disc1 ".../Star Ocean - The Second Story (Disc 1).cue" \
--disc2 ".../Star Ocean - The Second Story (Disc 2).cue"The project version (0.03.00 today) is set once, in port/CMakeLists.txt's project(...)
line. The programs print it with --version.
| Test | Command | Needs |
|---|---|---|
ss_tests |
SS_DISC1=".../Disc 1.cue" port/build/ss_tests |
SS_DISC1 for the disc tests. Without it, only the unit tests run |
ss_game_tests |
SS_DISC1=".../Disc 1.cue" port/build/ss_game_tests |
SS_DISC1 for the disc tests |
| Smoke test | SS_DISC1=".../Disc 1.cue" port/tools/smoke_field_events.sh port/build/shattered-stars |
SS_DISC1; Disc 2 is found next to it. Python 3 |
-
ss_testscovers the disc reader, the archive and decompression, the GPU, GTE, MDEC, sound and memory cards. Its disc tests compare against reference values taken from the original. -
ss_game_testscovers the game code: the event-script interpreter, field characters, menus, battles, Archipelago and more. - The smoke test plays real stretches of the game headless: it starts on chosen maps, plays scripted input, and checks doors, chests, shops, talking, mods, the debug console and Archipelago seeds.
The tests never open a window or play sound, and the smoke test uses a throwaway memory card. None of them write to your own settings.
-
Headless runs:
--headlessruns the game without a window; it uses only memory cards named for the run (--memcard1) and never writesconfig.ini. UseSDL_AUDIO_DRIVER=dummyto keep a run silent. With an Archipelago seed, a headless run uses the seed's own memory card only withSS_AP_SEED_CARD=1, andSS_AP_ANY_SAVE=1lets it load an ordinary save. -
AddressSanitizer: configure a separate build directory with
-fsanitize=addressto catch memory errors. -
Reference regression suite:
port/tools/ref_regress.pyreplays recorded comparisons with the original game. It needs recordings made with PCSX-Redux, which are not part of the repository; see port/tools/refs/README.md.
port/tools/build_linux.sh --container
# -> dist/ShatteredStars-<version>-linux-x86_64.tar.gzThis builds inside a Debian 12 container with podman (port/tools/linux-build/Containerfile,
pinned by digest), so the result runs on any distribution with glibc 2.36 or newer. SDL 3 and
Dear ImGui are built from source there and linked in, along with the C++ runtime, so players
need only glibc and OpenGL 3.3. The repository is mounted read-only.
Without --container, the script builds on your own machine (it needs SDL3 development files
and the static C++ library, libstdc++-static on Fedora). That package then needs your
machine's glibc version or newer.
The Windows release is cross-compiled from Linux with MinGW-w64. On Fedora:
sudo dnf install mingw64-gcc-c++ mingw64-SDL3 mingw64-openssl-static mingw64-zlib-static
port/tools/build_windows.sh
# -> dist/ShatteredStars-<version>-win64.zipOpenSSL (for wss:// Archipelago servers) and zlib are linked in, as are the C and C++
runtimes, so the zip holds everything the game needs. Without root, unpack the OpenSSL and zlib
packages' RPMs yourself and set MINGW_SSL_SYSROOT to the unpacked
usr/x86_64-w64-mingw32/sys-root/mingw folder.
The Windows build renders the same frames as the Linux build, byte for byte, and its test suites pass under Wine.
Both scripts read the version from port/CMakeLists.txt, and both packages include
LICENSE, the third-party licences, the README and an empty discs folder.
port/tools/setup_screenshots.sh [PROGRAM] [OUT_DIR] renders every page and state of the setup
program offscreen as PNG files, with scratch settings, without opening a window.
The Archipelago world's source is in apworld/so2. To package it:
AP_INSTALL=path/to/Archipelago AP_VENV=path/to/venv apworld/tools/build_apworld.sh [OUT_DIR]
# -> dist/so2.apworld and dist/"Star Ocean The Second Story.yaml"-
AP_INSTALLis an Archipelago source checkout (0.6.8 or newer), andAP_VENVa Python virtual environment with its requirements installed. - The script uses Archipelago's own Build APWorlds launcher component, which adds the manifest fields a packaged world needs. Don't zip the folder by hand: a hand-made zip loads with a manifest error.
- It also writes the world's options template YAML with Archipelago's own template generator.
- If the world isn't already installed in that checkout, the script links it in for the build and removes the link afterwards.
The world's own tests run with Archipelago's test runner, from the Archipelago checkout, with
the world linked in as worlds/so2:
python -m pytest worlds/so2/testThe PopTracker pack is generated from the world's own tables and the map
layout (docs/trackers/tracker_maps.json). It needs the scratch Archipelago that
apworld/tools/ap_test_server.sh sets up (scratchpad/ap, the world linked in, Pillow and lupa in its
venv):
trackers/tools/build_poptracker.sh all
# -> dist/poptracker/so2_shattered_stars_<version>.zip, its .sha256 and versions.json,
# then PopTracker's pack checker and the pack's testsIts images are drawn by the generator, original stand-ins at the layout's sizes; the real maps
come from each player's own disc (shattered-stars --render-tracker-maps). The details, the
tests and a headless run in the real PopTracker are in
docs/trackers/poptracker.md.
- How the Port Was Made: the method and the verification.
- Contributing: coding conventions, and how to propose a change.
Shattered Stars is released under the MIT licence.
Version 0.03.00. Contains no game data: you need your own Star Ocean: The Second Story discs (North American, European, French or German release).
Not affiliated with or endorsed by Square Enix, tri-Ace or Sony Interactive Entertainment. Star Ocean is a trademark of Square Enix.