Skip to content

A WIP 3D retro game engine inspired by GoldSrc and Quake

License

Notifications You must be signed in to change notification settings

PlatinumSrc/PlatinumSrc

Repository files navigation

PlatinumSrc

A WIP retro 3D game engine inspired by GoldSrc and Quake
Progress can be found here



Demo video

Using H-74, and test_model.p3m in games/test/

demo.mp4

Platform Support

Supported
  • Linux
  • Windows 2000+
  • Windows 98
  • MacOS
  • HaikuOS
  • Emscripten
Untested
  • FreeBSD
  • NetBSD
  • OpenBSD
In progress
  • Xbox (NXDK)
    • Needs an XGU renderer
  • Dreamcast
    • Needs a PowerVR renderer
  • 3DS
    • Needs a Citro3D renderer
  • GameCube
    • Needs an OpenGX renderer
  • Wii
    • Needs an OpenGX renderer
  • PS2
    • Needs a GSKit renderer
Wanted
  • Android
    • Need to finish the touch UI
    • Need to figure out how to build directly from the Makefile
  • UWP/GameSDK
    • Needs a D3D 9 renderer
  • Xbox (XDK)
    • Needs a D3D 7/8 renderer
  • PSP
  • PS Vita

How to run

The engine
  1. Download a game (the engine will not run without a game)
  2. Drop the game into a directory called games and use the -game option, or ensure the defaultgame variable in internal/config.cfg is set to the game's directory name
  3. Put any mods into a directory called mods and use the -mods option, or ensure they are listed in the mods variable in one of the configs
    • You can use config.cfg in internal/ or in the game's user data directory
    • Mods are listed as comma-separated values without spaces between values
  4. Run the executable

Building from source

When building on Unix-like platforms for that same platform
  • Install GNU Make
  • Install GCC with GNU Binutils, or Clang with LLVM
    • Pass TOOLCHAIN=llvm- CC=clang to the Makefile to use Clang
    • On 32-bit HaikuOS, pass CC=gcc-x86 to the Makefile to use the correct GCC executable
  • Install SDL 2.x or 1.2.x
  • If building the dedicated server, pass MODULE=server to the Makefile, or if building the editor, pass MODULE=editor
When building for Windows
  • If cross-compiling on a Unix-like platform
    • Install GNU Make
    • Install MinGW
    • Install MinGW SDL 2.x or 1.2.x
    • Pass CROSS=win32 to the Makefile
  • If MSYS2 is supported
    • Install MSYS2 and use the MINGW64 backend
    • Install GNU Make
    • Install GCC with GNU Binutils, or Clang with LLVM
      • Pass TOOLCHAIN=llvm- CC=clang to the Makefile to use Clang
    • Install MinGW SDL 2.x or 1.2.x
  • If MSYS2 is not supported
    • Install Git bash
    • Install Make for Windows and add it to the PATH
    • Download MinGW and add it to the PATH
    • Donwload and extract MinGW SDL 2.x or 1.2.x into MinGW
    • Pass inc.null=NUL to the Makefile
  • If building the dedicated server, pass MODULE=server to the Makefile, or if building the editor, pass MODULE=editor
When building for older Windows
  • Download MinGW 7.1.0 win32 sjlj and add it to the PATH
    • It might work with other versions but they need to not require ___mb_cur_max_func from msvcrt.dll or AddVectoredExceptionHandler from kernel32.dll
  • If cross-compiling on a Unix-like platform
    • Install Wine
    • Pass CROSS=win32 TOOLCHAIN='wine ' to the Makefile
  • If bulding for Windows 2000
  • If building for Windows 98
  • Pass inc.null=NUL to the Makefile
  • If building the dedicated server, pass MODULE=server to the Makefile, or if building the editor, pass MODULE=editor
When building for web browsers using Emscripten
  • Install GNU Make
  • Install Emscripten
  • Pass CROSS=emscr to the Makefile
When building for the Xbox using the NXDK
When building for the Dreamcast using KallistiOS
  • Set up KallistiOS
  • Set up img4dc
    1. Go into the KallistiOS directory
    2. Go into utils/
    3. Git clone https://github.com/Kazade/img4dc
    4. Enter img4dc/ and build it
  • Set up the cdi directory
    1. Create a directory called cdi
    2. Copy (or symlink) the internal directory into cdi/
    3. Copy (or symlink) the games and/or mods you want to include in the disc image
  • Pass CROSS=dc to the Makefile

———

Full Makefile usage
  • Rules
    • build - Build an executable or ROM
    • run - Build an executable or ROM and run it
    • clean - Clean up intermediate files
    • distclean - Clean up intermediate and output files
    • externclean - Clean up external tools
  • Variables
    • Build options
      • MODULE - Which module to build (default is engine)
        • engine - Game engine
        • server - Standalone server
        • editor - Map editor
      • CROSS - Cross compile
        • win32 - Windows 2000+ or Windows 98 with KernelEx
        • emscr - Emscripten
        • nxdk - Xbox using NXDK
        • dc - Dreamcast using KallistiOS
      • O - Set the optimization level (default is 2 if DEBUG is unset or g if DEBUG is set)
      • M32 - Set to y to produce a 32-bit binary
      • NATIVE - Set to y to tune build for native system
      • DEBUG - Enable debug symbols and messages
        • 0 - Symbols only
        • 1 - Basic messages
        • 2 - Advanced messages
        • 3 - Detailed messages
      • ASAN - Set to y to enable the address sanitizer (requires DEBUG to be set)
      • NOSTRIP - Set to y to not strip symbols
      • NOLTO - Set to y to disable link-time optimization (ignored if DEBUG is set)
      • NOFASTMATH - Set to y to disable -ffast-math
      • NOSIMD - Set to y to not use SIMD
      • NOMT - Set to y to disable multithreading
    • Features and backends
      • USEDISCORDGAMESDK - Set to y to use the Discord Game SDK
      • USEGL - Set to y to include OpenGL support
      • USEGL11 - Set to y to include OpenGL 1.1 support
      • USEGL33 - Set to y to include OpenGL 3.3 support
      • USEGLES30 - Set to y to include OpenGL ES 3.0 support
      • USEGLAD - Set to y to use glad instead of the system's GL library directly
      • USEWEAKGL - Set to y to mark gl[A-Z]* symbols as weak
      • USEMINIMP3 - Set to y to include MiniMP3 for MP3 support
      • USESTDTHREAD - Set to y to use C11 threads
      • Windows
        • USEWINPTHREAD - Set to y to use winpthread instead of win32 threads
    • Toolchain options
      • CC - C compiler
      • LD - Linker (defaults to CC's value)
      • AR - Archiver
      • STRIP - Symbol remover
      • OBJCOPY - Executable editor
      • TOOLCHAIN - Text to prepend to tool names
      • CFLAGS - Extra C compiler flags
      • CPPFLAGS - Extra C preprocessor flags
      • LDFLAGS - Extra linker flags
      • LDLIBS - Extra linker libraries
      • RUNFLAGS - Flags to pass to the executable
      • EMULATOR - Command used to run the executable or ROM
      • EMUFLAGS - Flags to pass to the emulator
      • EMUPATHFLAG - Flag used to specify the executable or ROM path
      • Windows
        • WINDRES - Windows resource compiler
      • Emscripten
        • EMSCR_SHELL - Path to the shell file
      • NXDK
        • XBE_TITLE - XBE title and XISO name (default is PlatinumSrc)
        • XBE_TITLEID - XBE title ID (default is PQ-001)
        • XBE_VERSION - XBE version (default is taken from version.h)
        • XBE_XTIMAGE - Path to XPR image (default is icons/engine.xpr)
        • XISO - Path to write XISO to (default is $(OUTDIR)/$(XBE_TITLE).xiso.iso)
        • XISODIR - Path to make the XISO from (default is $(OUTDIR)/xiso)
      • Dreamcast
        • IP_TITLE - IP.BIN title and CDI name (default is PlatinumSrc)
        • IP_COMPANY - IP.BIN company name (default is PQCraft)
        • IP_MRIMAGE - Path to MR image (default is icons/engine.mr)
        • CDI - Path to write CDI to (default is $(OUTDIR)/$(IP_TITLE).cdi)
        • CDIDIR - Path to make the CDI from (default is $(OUTDIR)/cdi)

Examples:

make -j$(nproc)
make -j$(nproc) run
make DEBUG=1 ASAN=y -j$(nproc) run
make CROSS=nxdk DEBUG=0 -j$(nproc) run