# swfans/syndwarsfx architecture

> Architecture diagram of the GitHub repository swfans/syndwarsfx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/swfans/syndwarsfx
- Repository: https://github.com/swfans/syndwarsfx

## Overview

SyndWarsFX is a modern-platform port of the Syndicate Wars game. The principal user workflow is to launch the game, enter its front end, select a campaign or mission, play with the game’s simulation and rendered/audio output, and save or restore progress. The tree also shows separate game-data, networking, and Smacker-video subsystems. The README documents SDL-based platform support and OpenAL/Vorbis audio; sampled source confirms startup, save-screen, and selected platform/media implementations, but not all subsystem call paths.

Main entry points: [`src/game.c`](https://github.com/swfans/syndwarsfx/blob/master/src/game.c) (Game Simulation), [`src/femain.c`](https://github.com/swfans/syndwarsfx/blob/master/src/femain.c) (Front End), [`src/main.c`](https://github.com/swfans/syndwarsfx/blob/master/src/main.c) (Application Startup), [`src/campaign.c`](https://github.com/swfans/syndwarsfx/blob/master/src/campaign.c) (Campaign Flow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game and Front End"]
  node_entry["Application Startup<br/>[main.c]"]
  node_frontend["Front End<br/>[femain.c]"]
  node_campaign["Campaign Flow<br/>[campaign.c]"]
  node_simulation["Game Simulation<br/>[game.c]"]
  node_world["World and Actors<br/>[thing.c]"]
  node_player_state["Player State<br/>[player.c]"]
  node_storage_screen["Save Screen<br/>[festorage.c]"]
end

subgraph group_presentation["Rendering and Media"]
  node_renderer["Software Renderer<br/>[engindrwlstm.c]"]
  node_sound["Sound and Music<br/>[bfaudio.c]"]
  node_smacker["Smacker Video<br/>[bfsmack.c]"]
end

subgraph group_platform["Platform Services"]
  node_video_backend["SDL Video Backend<br/>[sscreen.c]"]
  node_input_backend["Input Backends<br/>[smouse.cpp]"]
  node_mouse_state["Mouse State<br/>[mshandler.cpp]"]
end

subgraph group_support["Game Support"]
  node_save_data["Save and Restore<br/>[game_save.c]"]
  node_game_data["Game Data<br/>[game_data.c]"]
  node_wad_files["WAD Files<br/>[wadfile.c]"]
  node_network["Networking<br/>[network.c]"]
end

node_player(("Player"))
node_original_data["Original Game Data"]

node_player -->|"launches"| node_entry
node_entry -->|"initializes via game_initialise"| node_simulation
node_player -->|"uses menus"| node_frontend
node_frontend -->|"selects campaign"| node_campaign
node_campaign -->|"starts missions"| node_simulation
node_simulation -->|"updates world"| node_world
node_simulation -->|"updates player"| node_player_state
node_player -->|"manages saves"| node_storage_screen
node_storage_screen -->|"writes save"| node_save_data
node_original_data -->|"supplies assets"| node_game_data
node_game_data -->|"uses WAD access"| node_wad_files
node_simulation -->|"renders scene"| node_renderer
node_renderer -->|"presents frames"| node_video_backend
node_player -->|"provides input"| node_input_backend
node_input_backend -->|"updates pointer state"| node_mouse_state
node_simulation -->|"plays audio"| node_sound
node_frontend -.->|"plays cutscenes"| node_smacker
node_simulation -.->|"supports network play"| node_network

click node_entry "https://github.com/swfans/syndwarsfx/blob/master/src/main.c"
click node_frontend "https://github.com/swfans/syndwarsfx/blob/master/src/femain.c"
click node_campaign "https://github.com/swfans/syndwarsfx/blob/master/src/campaign.c"
click node_simulation "https://github.com/swfans/syndwarsfx/blob/master/src/game.c"
click node_world "https://github.com/swfans/syndwarsfx/blob/master/src/thing.c"
click node_player_state "https://github.com/swfans/syndwarsfx/blob/master/src/player.c"
click node_storage_screen "https://github.com/swfans/syndwarsfx/blob/master/src/festorage.c"
click node_save_data "https://github.com/swfans/syndwarsfx/blob/master/src/game_save.c"
click node_game_data "https://github.com/swfans/syndwarsfx/blob/master/src/game_data.c"
click node_wad_files "https://github.com/swfans/syndwarsfx/blob/master/src/wadfile.c"
click node_network "https://github.com/swfans/syndwarsfx/blob/master/src/network.c"
click node_renderer "https://github.com/swfans/syndwarsfx/blob/master/swrendersoft/src/engindrwlstm.c"
click node_video_backend "https://github.com/swfans/syndwarsfx/blob/master/bflibrary/src/x86-win-sdl2/sscreen.c"
click node_input_backend "https://github.com/swfans/syndwarsfx/blob/master/bflibrary/src/x86-win-sdl2/smouse.cpp"
click node_mouse_state "https://github.com/swfans/syndwarsfx/blob/master/bflibrary/src/general/mshandler.cpp"
click node_sound "https://github.com/swfans/syndwarsfx/blob/master/bfsoundlib/src/bfaudio.c"
click node_smacker "https://github.com/swfans/syndwarsfx/blob/master/bfsmacklib/src/bfsmack.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_frontend,node_campaign,node_simulation,node_world,node_player_state,node_storage_screen toneBlue
class node_renderer,node_sound,node_smacker toneAmber
class node_video_backend,node_input_backend,node_mouse_state toneMint
class node_save_data,node_game_data,node_wad_files,node_network toneRose
class node_player,node_original_data toneIndigo
```

## Components

### Game and Front End

- [Application Startup](https://github.com/swfans/syndwarsfx/blob/master/src/main.c): `src/main.c`
- [Front End](https://github.com/swfans/syndwarsfx/blob/master/src/femain.c): `src/femain.c`
- [Campaign Flow](https://github.com/swfans/syndwarsfx/blob/master/src/campaign.c): `src/campaign.c`
- [Game Simulation](https://github.com/swfans/syndwarsfx/blob/master/src/game.c): `src/game.c`
- [World and Actors](https://github.com/swfans/syndwarsfx/blob/master/src/thing.c): `src/thing.c`
- [Player State](https://github.com/swfans/syndwarsfx/blob/master/src/player.c): `src/player.c`
- [Save Screen](https://github.com/swfans/syndwarsfx/blob/master/src/festorage.c): `src/festorage.c`

### Rendering and Media

- [Software Renderer](https://github.com/swfans/syndwarsfx/blob/master/swrendersoft/src/engindrwlstm.c): `swrendersoft/src/engindrwlstm.c`
- [Sound and Music](https://github.com/swfans/syndwarsfx/blob/master/bfsoundlib/src/bfaudio.c): `bfsoundlib/src/bfaudio.c`
- [Smacker Video](https://github.com/swfans/syndwarsfx/blob/master/bfsmacklib/src/bfsmack.c): `bfsmacklib/src/bfsmack.c`

### Platform Services

- [SDL Video Backend](https://github.com/swfans/syndwarsfx/blob/master/bflibrary/src/x86-win-sdl2/sscreen.c): `bflibrary/src/x86-win-sdl2/sscreen.c`
- [Input Backends](https://github.com/swfans/syndwarsfx/blob/master/bflibrary/src/x86-win-sdl2/smouse.cpp): `bflibrary/src/x86-win-sdl2/smouse.cpp`
- [Mouse State](https://github.com/swfans/syndwarsfx/blob/master/bflibrary/src/general/mshandler.cpp): `bflibrary/src/general/mshandler.cpp`

### Game Support

- [Save and Restore](https://github.com/swfans/syndwarsfx/blob/master/src/game_save.c): `src/game_save.c`
- [Game Data](https://github.com/swfans/syndwarsfx/blob/master/src/game_data.c): `src/game_data.c`
- [WAD Files](https://github.com/swfans/syndwarsfx/blob/master/src/wadfile.c): `src/wadfile.c`
- [Networking](https://github.com/swfans/syndwarsfx/blob/master/src/network.c): `src/network.c`

### Other components

- **Player**
- **Original Game Data**

## Connections

- Player → Application Startup: launches
- Application Startup → Game Simulation: initializes via game_initialise
- Player → Front End: uses menus
- Front End → Campaign Flow: selects campaign
- Campaign Flow → Game Simulation: starts missions
- Game Simulation → World and Actors: updates world
- Game Simulation → Player State: updates player
- Player → Save Screen: manages saves
- Save Screen → Save and Restore: writes save
- Original Game Data → Game Data: supplies assets
- Game Data → WAD Files: uses WAD access
- Game Simulation → Software Renderer: renders scene
- Software Renderer → SDL Video Backend: presents frames
- Player → Input Backends: provides input
- Input Backends → Mouse State: updates pointer state
- Game Simulation → Sound and Music: plays audio
- Front End → Smacker Video: plays cutscenes
- Game Simulation → Networking: supports network play
