Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/engine-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
required: false
default: '["Debug", "Release"]'
type: string
platforms:
description: "JSON array of target platforms, named as the generator's -A argument."
required: false
default: '["Win32", "x64"]'
type: string
official:
description: "Configure an official build, which reports the version it declares without a commit."
required: false
Expand All @@ -29,7 +34,7 @@ permissions:

jobs:
build:
name: ${{ matrix.configuration }}
name: ${{ matrix.platform }} ${{ matrix.configuration }}
# The runner image has to carry the Visual Studio 2022 toolchain that docs/BUILDING.md
# names as the supported one. windows-2025 and windows-latest resolve to an image built
# around Visual Studio 2026 and have no 2022 instance for the generator to find, so they
Expand All @@ -39,6 +44,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(inputs.platforms) }}
configuration: ${{ fromJSON(inputs.configurations) }}
steps:
- name: Check out OpenTS
Expand All @@ -59,7 +65,7 @@ jobs:

- name: Configure
run: >
cmake -S . -B build -G "Visual Studio 17 2022" -A Win32
cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.platform }}
-DOPENTS_OFFICIAL_BUILD=${{ inputs.official && 'ON' || 'OFF' }}

- name: Build
Expand Down Expand Up @@ -102,7 +108,7 @@ jobs:
- name: Upload runtime files
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ inputs.artifact-prefix }}-${{ matrix.configuration }}-${{ steps.commit.outputs.short }}
name: ${{ inputs.artifact-prefix }}-${{ matrix.platform }}-${{ matrix.configuration }}-${{ steps.commit.outputs.short }}
path: artifact
if-no-files-found: error
retention-days: ${{ inputs.artifact-retention-days }}
27 changes: 16 additions & 11 deletions .github/workflows/engine-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,29 @@ jobs:
env:
TAG: ${{ github.event.release.tag_name }}
steps:
- name: Download the build artifact
- name: Download the build artifacts
# Each platform keeps its own directory here. Merging them would put two
# different Game.exe files in one place.
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: opents-release-Release-*
merge-multiple: true
pattern: opents-release-*-Release-*
path: artifact

- name: Package the release zip
working-directory: artifact
run: >
zip -r "../OpenTS-${TAG}.zip"
Game.exe Game.pdb Language.dll
LICENSE.md THIRD_PARTY_NOTICES.md OpenTS_THIRD_PARTY_LICENSES
- name: Package a release zip for each platform
run: |
for dir in artifact/opents-release-*-Release-*; do
# Artifacts are named <prefix>-<platform>-<configuration>-<commit>, and the
# prefix itself contains a hyphen, so count the fields from the end.
platform="$(basename "${dir}" | awk -F- '{print $(NF-2)}')"
( cd "${dir}" && zip -r "${GITHUB_WORKSPACE}/OpenTS-${TAG}-${platform}.zip" \
Game.exe Game.pdb Language.dll \
LICENSE.md THIRD_PARTY_NOTICES.md OpenTS_THIRD_PARTY_LICENSES )
done

- name: Attach the zip to the release
- name: Attach the zips to the release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "$TAG" "OpenTS-${TAG}.zip" --clobber --repo "$GITHUB_REPOSITORY"
run: gh release upload "$TAG" OpenTS-"$TAG"-*.zip --clobber --repo "$GITHUB_REPOSITORY"

notes:
name: Append generated release notes
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ The archived TibSun reconstruction and original executable are historical
evidence. Binary matching is not the acceptance criterion for active OpenTS
development.

Visual Studio 2022 Win32 Debug and Release are the supported build target.
A build result is not runtime evidence.
Visual Studio 2022 Win32 and x64, each in Debug and Release, are the
supported build targets. A build result is not runtime evidence.

## Writing prose

Expand Down
12 changes: 3 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set(OPENTS_VERSION_PRERELEASE "")
option(OPENTS_OFFICIAL_BUILD "Build as an official release of the declared version" OFF)

option(OPENTS_EXPERIMENTAL_CLANG_CL "Build with clang-cl using the MSVC ABI" OFF)
option(OPENTS_EXPERIMENTAL_X64 "Configure an unsupported 64-bit Windows build" OFF)
option(OPENTS_EXPERIMENTAL_NATIVE "Configure a native build for the host platform" OFF)

# Lets a target's FOLDER place it in a Visual Studio solution folder. The bgfx submodule sets
Expand All @@ -31,14 +30,9 @@ elseif(MSVC)
if(MSVC_VERSION LESS 1930)
message(FATAL_ERROR "OpenTS requires MSVC 19.30 or newer.")
endif()
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 4)
# A save records pointer identities at a fixed width, but the members and raw
# structures around them still travel at the build's own widths, and the packed
# version stamp that saves and network packets carry is the same either way.
message(WARNING
"OpenTS: this build has ${CMAKE_SIZEOF_VOID_P}-byte pointers. Saved games it "
"writes are not interchangeable with a supported 32-bit build's, and nothing in "
"the version stamp distinguishes them.")
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message(FATAL_ERROR
"OpenTS targets Win32 and x64. Reconfigure with -A Win32 or -A x64.")
endif()
elseif(OPENTS_EXPERIMENTAL_NATIVE)
if(IOS)
Expand Down
13 changes: 7 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Contributing to OpenTS

OpenTS welcomes focused bug reports, proposals, documentation changes, and
pull requests. Visual Studio 2022 Win32 Debug and Release are the supported
development targets. A successful build is not runtime evidence.
pull requests. Visual Studio 2022 Win32 and x64, each in Debug and Release,
are the supported development targets. A successful build is not runtime
evidence.

## Before starting

Expand Down Expand Up @@ -134,10 +135,10 @@ or behavior that optimization may affect. Existing MSVC warnings remain;
identify new warnings instead of describing the build as warning-free.

Behavior changes need focused, reproducible evidence. Automated tests must not
require proprietary game assets or original executables. CI builds Win32 Debug
and Release and runs CTest for ready engine pull requests; draft pull requests
do not run these checks until marked ready. This is build evidence and does not
replace any runtime testing the change needs.
require proprietary game assets or original executables. CI builds Debug and
Release on both platforms and runs CTest for ready engine pull requests; draft
pull requests do not run these checks until marked ready. This is build
evidence and does not replace any runtime testing the change needs.
[Building OpenTS](docs/BUILDING.md#continuous-integration) documents the
workflow.

Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ endorsed by Electronic Arts.

## Downloads

- **Releases** are the recommended builds. Each zip on the
[releases page](https://github.com/OpenTS-Developers/OpenTS/releases)
contains `Game.exe`, `Language.dll`, and `Game.pdb`.
- **Releases** are the recommended builds. Every release on the
[releases page](https://github.com/OpenTS-Developers/OpenTS/releases) carries
a zip per platform, `OpenTS-<version>-Win32.zip` and
`OpenTS-<version>-x64.zip`, each containing `Game.exe`, `Language.dll`, and
`Game.pdb`. The 32-bit build runs on both 32-bit and 64-bit Windows and has
the longer runtime history; the 64-bit build runs on 64-bit Windows only.
- **Nightly builds** are development snapshots from the
[Engine nightly](https://github.com/OpenTS-Developers/OpenTS/actions/workflows/engine-nightly.yml)
workflow. Download the latest one without a GitHub account through
Expand All @@ -73,6 +76,12 @@ OpenTS supports Windows 10 version 1903 (build 18362) and newer. Earlier
Windows versions are untested and unsupported. Wine may work, but there is no
supported native Linux build.

Keep a saved game with the platform that wrote it, and play a network game with
peers on the same platform. The 32-bit and 64-bit builds write saves and
network packets at their own pointer widths, and neither checks which platform
produced what it is reading, so a mismatch surfaces as a failed load or a
desync.

OpenTS supplies the engine, not the game data: the installation above
provides the original assets. There is no installer, and no extra runtime
library or launch argument is required.
Expand Down Expand Up @@ -223,7 +232,7 @@ reasoning.

## Building

OpenTS builds as a 32-bit Windows target with Visual Studio 2022 and CMake.
OpenTS builds for 32-bit and 64-bit Windows with Visual Studio 2022 and CMake.
[Building OpenTS](docs/BUILDING.md) documents the exact requirements,
commands, and outputs.

Expand Down
8 changes: 0 additions & 8 deletions code/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# Limit the generated solution to supported configurations.
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)

# OpenTS supports 32-bit (x86) builds. A 64-bit build is an unsupported experiment.
if(WIN32 AND NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT OPENTS_EXPERIMENTAL_X64)
message(FATAL_ERROR
"OpenTS must be built as 32-bit x86. Reconfigure with -A Win32. "
"For the unsupported 64-bit experiment, configure with "
"-A x64 -DOPENTS_EXPERIMENTAL_X64=ON.")
endif()

#
# ---------------------------------------------------------
# Directories that build as their own project
Expand Down
2 changes: 2 additions & 0 deletions code/_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ unsigned char EventClass::EventLength[EventClass::LAST_EVENT] = {
0, // PAGEUSER
size_of(EventClass, Data.General), // REMOVEPLAYER
size_of(EventClass, Data.General), // LATENCYFUDGE
size_of(EventClass, Data.NetworkReport), // NETWORK_REPORT
};

char const * EventClass::EventNames[EventClass::LAST_EVENT] = {
Expand Down Expand Up @@ -96,4 +97,5 @@ char const * EventClass::EventNames[EventClass::LAST_EVENT] = {
"PAGEUSER",
"REMOVEPLAYER",
"LATENCYFUDGE",
"NETWORK_REPORT",
};
5 changes: 3 additions & 2 deletions code/abstype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "savestream.h"
#include "vector.h"

#include <cinttypes>
#include <cstdio>


Expand All @@ -47,8 +48,8 @@ AbstractTypeClass::AbstractTypeClass(char const * ininame) :
GivenName()
{
if (ininame == NULL) {
char pstr[24];
sprintf(pstr, "%p", (void *)this);
char pstr[2 * sizeof(void *) + 1];
sprintf(pstr, "%0*" PRIXPTR, (int)(2 * sizeof(void *)), (uintptr_t)this);
IniName = TStringID<24>(pstr);
} else {
IniName = TStringID<24>(ininame);
Expand Down
4 changes: 4 additions & 0 deletions code/combuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ struct SendQueueType {
unsigned int IsUndeliverable : 1; /// 1 = gave up on it (retries or timeout)
unsigned int FirstTime; // time this packet was first sent
unsigned int LastTime; // time this packet was last sent
// The adaptive retry works in milliseconds; FirstTime and LastTime above stay in ticks.
unsigned int FirstTimeMilliseconds = 0;
unsigned int LastTimeMilliseconds = 0;
unsigned int RetransmitTimeoutMilliseconds = 0; // the RTO in force at the first transmission
unsigned int SendCount; // # of times this packet has been sent
int BufLen; // size of the packet stored in this entry
char *Buffer; // the data packet
Expand Down
Loading