# eezstreet/swateliteforce architecture

> Architecture diagram of the GitHub repository eezstreet/swateliteforce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eezstreet/swateliteforce
- Repository: https://github.com/eezstreet/swateliteforce

## Overview

##### Project Type and Purpose
- This is a large-scale Unreal Engine 2 mod (“SWAT: Elite Force”) that overhauls SWAT 4’s gameplay, AI, assets, UI and multiplayer.
- It bundles UnrealScript source, compiled script classes, game assets, configuration files, build scripts, editor extensions and launchers into a cohesive mod that plugs into the SWAT 4 engine.

##### File Structure Analysis
- Top level
– CompileSource.bat, GenerateMD5.bat, LaunchSEF.bat/LaunchSwatEd.bat, Dedicated Server.bat – build/run scripts and wrappers.
– README.md, LICENSE.md, CHANGELOG.md, Reversing Notes.txt – docs.
- Content/Classes
– Pre-compiled UnrealScript classes (.u) and art assets (meshes, textures).
- Extras
– Editor extensions, source zips, helper executables.
- Source
– /Game – mod logic organized in feature subsystems (AICommon, Gameplay, Scripting, SwatAICommon, SwatEquipment, SwatGame, SwatGui, etc.).
– /Unreal – engine core and editor source trees (Core, Engine, Editor, GUI, IpDrv, SwatEd, UWindow, IGEffectsSystem, etc.).
- System
– .ini configuration files, localization, master server and gameplay tuning.
- .gitattributes, .gitignore – VCS settings.

##### Key README Insights
- Build pipeline: UnrealScript compiler invoked via CompileSource.bat → outputs .u files into System/.
- Runtime launch: LaunchSEF.bat starts the game with modded scripts and content; LaunchSwatEd.bat starts the SWAT editor with mod extensions.
- Code style: tabs vs spaces, brace conventions, naming conventions – UnrealScript standards.
- Mod logic divided into Campaign, QMM, AI improvements, equipment subsystems, GUI improvements, networking & admin.

1. Unreal Engine Core
– Engine binary (Swat4X.exe) & subsystems (Renderer, Physics/Havok, Audio, Networking, Scripting VM).
2. Editor Module
– SwatEd.exe + editor classes/plugins in Extras/ and Source/Unreal/SwatEd
3. Mod Source Code
– /Source/Game: gameplay subsystems (AI, Equipment, GUI, Campaign, Scripting)
– /Source/Unreal: shared engine enhancements supporting mod (UnrealEd, Core tweaks)
4. Build Tools
– CompileSource.bat → UnrealScript compiler → .u output in System/
5. Content Assets
– Content/Classes: compiled .u script classes, art assets (meshes, textures)
6. Configuration
– System/*.ini: tuning, campaign definitions, traps, objectives, multiplayer settings
7. Launch Scripts & Utilities
– LaunchSEF.bat, Dedicated Server.bat, Extras/LaunchSEF.exe, GenerateMD5.bat
8. Networking & Admin
– WebAdmin HTTP service (port 6000), JSON endpoints, master server browser plugin, GameRanger integration

- Build tools → compile .uc (Source/Game + Source/Unreal) → produce .u (System/ + Content/Classes)
- Engine Core loads:
– Script VM loads .u classes
– Renderer/Physics/AUDIO load assets & effects
– System .ini applies configuration
- Launch Scripts invoke Engine with mod search paths (SEF/System, SEF/Content)
- Editor Module loads same engine core with editing plugins to modify Content/Classes & System configs
- Networking components communicate with external services:
– Master server (Swat4Stats, GameSpy legacy)
– WebAdmin HTTP interface (in-game / out-of-game monitoring)
– GameRanger (third-party lobby)

c. Architectural Patterns & Principles
- Plugin/Extension pattern: mod code and assets live side-by-side with engine code, loaded at runtime.
- Modular subsystems: AI, Gameplay, Equipment, GUI, Networking separated into logical packages under Source/Game.
- Separation of concerns:
– Build layer (compilation)
– Runtime engine layer
– Content/data layer (assets + configs)
– Tooling layer (editor, scripts)
- Use of external configuration (.ini, XML) for tuning and localization → supports flexibility and non-rebuild changes.

d. Key Technologies & Frameworks
- Unreal Engine 2 / UnrealScript (.uc, .u)
- Havok physics integration
- Windows batch scripting (.bat) and custom launcher executables
- HTTP/WebAdmin service for server-side administration
- GameRanger and master-server protocols for matchmaking

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build Layer
    BuildTools["Build Tools"]:::build
    ModSource["Source/Game"]:::source
    EngineSource["Source/Unreal"]:::source
    Compile["Compile .uc → .u"]:::build
    GenerateMD5["GenerateMD5.bat"]:::build

    %% Compiled Data Layer
    CompiledData["Content/Classes & System/.u"]:::compiled
    Config["System/*.ini"]:::config

    %% Runtime Engine Layer
    Launch["Launch Scripts & Utilities"]:::build
    EngineCore["Engine Core (Swat4X.exe)"]:::engine
    Editor["Editor Module (SwatEd.exe)"]:::engine

    %% Networking/Admin Layer
    Networking["Networking & Admin (WebAdmin)"]:::network
    External["External Services\n(GameRanger, Master Server)"]:::network

    %% Connections
    ModSource -->|sources| Compile
    EngineSource -->|sources| Compile
    Compile -->|outputs| CompiledData
    CompiledData -->|loaded by| EngineCore
    Config -->|applied by| EngineCore
    Config -->|modifiable by| Editor
    Launch -->|invokes| EngineCore
    EngineCore -->|extended by| Editor
    EngineCore -->|communicates| Networking
    Networking -->|interfaces| External

    %% Click Events
    click EngineSource "https://github.com/eezstreet/swateliteforce/tree/master/Source/Unreal"
    click Editor "https://github.com/eezstreet/swateliteforce/tree/master/Source/Unreal/SwatEd"
    click Editor "https://github.com/eezstreet/swateliteforce/blob/master/LaunchSwatEd.bat"
    click ModSource "https://github.com/eezstreet/swateliteforce/tree/master/Source/Game"
    click BuildTools "https://github.com/eezstreet/swateliteforce/blob/master/CompileSource.bat"
    click BuildTools "https://github.com/eezstreet/swateliteforce/blob/master/GenerateMD5.bat"
    click CompiledData "https://github.com/eezstreet/swateliteforce/tree/master/Content/Classes"
    click Config "https://github.com/eezstreet/swateliteforce/blob/master/System/*.ini"
    click Launch "https://github.com/eezstreet/swateliteforce/blob/master/LaunchSEF.bat"
    click Launch "https://github.com/eezstreet/swateliteforce/blob/master/Dedicated Server.bat"
    click Launch "https://github.com/eezstreet/swateliteforce/blob/master/Extras/LaunchSEF.exe"
    click Networking "https://github.com/eezstreet/swateliteforce/tree/master/Source/Game/SwatGame/Classes/WebAdmin"

    %% Styles
    classDef engine fill:#add8e6,stroke:#000;
    classDef source fill:#90ee90,stroke:#000;
    classDef build fill:#d3d3d3,stroke:#000;
    classDef compiled fill:#ffa500,stroke:#000;
    classDef config fill:#ffff00,stroke:#000;
    classDef network fill:#dda0dd,stroke:#000;
```
