Skip to content
fogofwarlabsPublic

About

Real-time strategy engine in Java: deterministic simulation, mod runtime, launcher and peer-to-peer online play.

Topics

Resources

Contributing

Stars

9 stars

Watchers

1 watching

Forks

Latest commit

 

History

98 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SC4J logo
SC4J

A real-time strategy engine in Java, with a mod runtime, a launcher and peer-to-peer online play.

Maven Central License: Apache-2.0

English | 한국어


SC4J (Simulation Core for Java) is an engine for real-time strategy games. A game is a mod: one jar that the runtime loads and the launcher lists. Every SC4J is a peer of Beacon.Link, the network for rooms, chat and presence; there is no central server.

This repository holds the engine, the runtime, the launcher, Beacon.Link and the demo mod mods/demo/ (id demo, "SC4J Demo: Dawnhold and Cindermaw"). The SC:R mod and SC:R Crossover have their own repositories: sc4j-scr, sc4j-scr-crossover.

Features

  • Deterministic lockstep simulation with a state hash per game loop; default systems for path finding, movement, collision, visibility, economy, harvest, combat, projectiles, production, orders, triggers and computer players, each replaceable by a mod.
  • Standard data pack (JSON, PNG, WAV) and one-file JSON maps.
  • Client: scenes, input, OpenGL renderer, square and isometric projections, a default in-game screen with HUD, audio and video.
  • Replays and saved games, bound to the mod identity that wrote them.
  • LAN rooms and games; Beacon.Link rooms, chat, whispers, friends and presence.
  • Launcher: lists mods, asks for their settings, starts the runtime, runs the computer's Beacon.Link node, installs mods from GitHub releases and updates itself.
  • Mod runtime: one mod per session in its own class loader.
  • Engine API listed per module and checked by the build (API policy).

Modules

Path Contents
sc4j-base exceptions, logging, binary, file, JSON and text helpers
sc4j-mod-manifest mod manifest sc4j-mod.json, settings, versions, install layout
sc4j-engine-core fixed-point math, map grid, terrain, players, state hash, content types, mod identity
sc4j-engine-sim game, units, default systems, orders, commands, data pack, maps, replays, saves
sc4j-engine-net datagram links, lockstep transport, LAN discovery, network lobby, Beacon.Link and community interfaces, channel chat
sc4j-engine-client host, scenes, input, renderer, projections, HUD, console, audio, video
sc4j-engine the mod API and client application that mods compile against
sc4j-runtime runs one mod jar, in a window or headless
sc4j-launcher the launcher (JavaFX)
sc4j-catalog what is published: GitHub releases, the check for a newer release, the mod catalog; used by the launcher, shipped by the runtime for mods
sc4j-beaconlink-protocol, -peer, -node, sc4j-beaconlink Beacon.Link wire protocol, peer library, headless node, client
mods/ the demo mod
tools/ api-check (API listings), windows-manifest (UTF-8 code page of the Windows programs)
docs/ guides; docs/branding/: logos and the demo's launcher art
licenses/ third-party licence texts

Build and run

JDK 25 is required; the Gradle wrapper fetches Gradle. Commands run in PowerShell from the repository root (./gradlew on Linux).

Command Result
.\gradlew.bat build compiles, runs the unit tests and checks
.\gradlew.bat devInstall development install build/dev-install/ (launcher, runtime, mods/demo.jar)
.\gradlew.bat runDevLauncher opens the launcher of the development install
.\gradlew.bat runDevInstall -Psc4j.mod=<id> runs mods/<id>.jar of the development install (default demo)
.\gradlew.bat distribution user package build/distributions/SC4J-<version>.zip
.\gradlew.bat :sc4j-beaconlink-node:installDist headless Beacon.Link node in sc4j-beaconlink-node/build/install/

The launcher lists every jar in build/dev-install/mods/. A mod of another repository installs there with its installMod -Psc4j.install=<this repository>\build\dev-install; devInstall keeps it.

The user package holds the launcher, the runtime, the demo and a Java runtime and starts with SC4J.exe on Windows (or SC4J.bat) and SC4J on Linux; userdata/ is created at the first start.

The launcher updates itself from the GitHub releases of SC4J and installs a mod from the latest release of a GitHub repository (owner/name, typed or chosen from the catalog of fogofwarlabs/sc4j-mods). An update also replaces the mod jars the package ships (listed in launcher/package-mods.txt); userdata/ and the other jars of mods/ stay, and a shipped jar the player deleted is not added again.

Documentation

Guide Topic
Mod author guide making a mod
Mod template a mod that builds, runs and installs, to start from
Engine API policy API scope, versions, internal elements
Beacon.Link protocol wire protocol and files
Beacon.Link operator guide running a public peer
Branding logos, banners, PNG export
Contributing setup, tests, code style, commits

Licence

Apache License 2.0. NOTICE lists the third-party material of the repository and its distributions; the licence texts are in licenses/.

Material Licence Details
Demo pictures: renders of KayKit models and Poly Haven textures CC0 1.0 mods/demo/THIRD-PARTY.md
Libraries of the distributions (LWJGL, JavaCPP, FFmpeg, OpenJFX and others) their own licences NOTICE, licenses/

About

Real-time strategy engine in Java: deterministic simulation, mod runtime, launcher and peer-to-peer online play.

Topics

Resources

Contributing

Stars

9 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages