# farmisen/ultima3 architecture

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

- Interactive diagram: https://gitdiagram.com/farmisen/ultima3
- Repository: https://github.com/farmisen/ultima3

## Overview

LairWare’s Ultima III is a single-player Macintosh RPG remake. The player interacts through the Mac interface; gameplay spans overworld exploration, dungeon traversal, combat and spells, party/roster management, and map generation after the game is solved. The source also includes rendering, localization, audio, and preferences support. The README documents alternate graphics and other historical capabilities, but sampled excerpts do not expose the full application startup or the wiring for several subsystems, so those connections are left unverified.

Main entry points: [`Sources/UltimaMacIF.c`](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaMacIF.c) (Mac Interface), [`Sources/UltimaDngn.c`](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaDngn.c) (Dungeon Logic), [`Sources/UltimaSpellCombat.c`](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaSpellCombat.c) (Combat and Spells), [`Sources/UltimaGraphics.c`](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaGraphics.c) (Graphics Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Mac Interface"]
  node_mac_ui["Mac Interface<br/>[UltimaMacIF.c]"]
  node_apple_events["Apple Events"]
  node_preferences["Preferences Dialog<br/>[PrefsDialog.m]"]
  node_prefs_controller["Preferences Controller"]
  node_carbon["Carbon Compatibility<br/>[CarbonShunts.c]"]
end

subgraph group_gameplay["Gameplay Systems"]
  node_main_loop["Game Orchestration<br/>[UltimaMain.c]"]
  node_overworld["Overworld Logic<br/>[UltimaMisc.c]"]
  node_dungeon["Dungeon Logic<br/>[UltimaDngn.c]"]
  node_combat["Combat and Spells"]
  node_autocombat["Auto Combat<br/>[UltimaAutocombat.c]"]
end

subgraph group_world["World and State"]
  node_party["Party Management<br/>[UltimaNew.c]"]
  node_mapgen["Map Generation<br/>[UltimaNewMap.c]"]
  node_game_state["Game State<br/>[UltimaIncludes.h]"]
end

subgraph group_presentation["Presentation and Settings"]
  node_graphics["Graphics Engine<br/>[UltimaGraphics.c]"]
  node_text["Game Text<br/>[UltimaText.c]"]
  node_sound["Sound Playback<br/>[UltimaSound.m]"]
  node_sound_assets["Sound Assets"]
  node_game_assets["Game Resources<br/>[Strings]"]
  node_graphics_assets["Graphics Assets"]
end

node_player(("Player"))

node_player -.->|"interacts"| node_mac_ui
node_mac_ui -.->|"dispatches"| node_main_loop
node_dungeon -->|"casts spells"| node_combat
node_combat -->|"uses routines"| node_autocombat
node_combat -->|"updates dungeon"| node_dungeon
node_overworld -->|"uses dungeon routines"| node_dungeon
node_mapgen -.->|"updates state"| node_game_state
node_party -.->|"updates state"| node_game_state
node_dungeon -->|"draws dungeon"| node_graphics
node_mac_ui -->|"uses graphics"| node_graphics
node_preferences -.->|"configures"| node_prefs_controller
node_apple_events -->|"opens preferences"| node_preferences
node_graphics -.->|"uses alternate graphics"| node_graphics_assets
node_sound -.->|"plays sounds"| node_sound_assets
node_mac_ui -->|"uses compatibility shims"| node_carbon
node_game_assets -.->|"supplies game text"| node_overworld

click node_mac_ui "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaMacIF.c"
click node_apple_events "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaAppleEvents.c"
click node_main_loop "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaMain.c"
click node_overworld "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaMisc.c"
click node_dungeon "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaDngn.c"
click node_combat "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaSpellCombat.c"
click node_autocombat "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaAutocombat.c"
click node_party "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaNew.c"
click node_mapgen "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaNewMap.c"
click node_game_state "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaIncludes.h"
click node_graphics "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaGraphics.c"
click node_text "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaText.c"
click node_sound "https://github.com/farmisen/ultima3/blob/main/Sources/UltimaSound.m"
click node_sound_assets "https://github.com/farmisen/ultima3/tree/main/Resources/Sounds"
click node_game_assets "https://github.com/farmisen/ultima3/tree/main/Resources/English.lproj/Strings"
click node_graphics_assets "https://github.com/farmisen/ultima3/tree/main/Resources/Graphics"
click node_preferences "https://github.com/farmisen/ultima3/blob/main/Sources/PrefsDialog.m"
click node_prefs_controller "https://github.com/farmisen/ultima3/blob/main/Sources/PrefsDialogController.h"
click node_carbon "https://github.com/farmisen/ultima3/blob/main/Sources/CarbonShunts.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_mac_ui,node_apple_events,node_preferences,node_prefs_controller,node_carbon toneBlue
class node_main_loop,node_overworld,node_dungeon,node_combat,node_autocombat toneAmber
class node_party,node_mapgen,node_game_state toneMint
class node_graphics,node_text,node_sound,node_sound_assets,node_game_assets,node_graphics_assets toneRose
class node_player toneIndigo
```

## Components

### Mac Interface

- [Mac Interface](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaMacIF.c): `Sources/UltimaMacIF.c`
- [Apple Events](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaAppleEvents.c): `Sources/UltimaAppleEvents.c`
- [Preferences Dialog](https://github.com/farmisen/ultima3/blob/main/Sources/PrefsDialog.m): `Sources/PrefsDialog.m`
- [Preferences Controller](https://github.com/farmisen/ultima3/blob/main/Sources/PrefsDialogController.h): `Sources/PrefsDialogController.h`
- [Carbon Compatibility](https://github.com/farmisen/ultima3/blob/main/Sources/CarbonShunts.c): `Sources/CarbonShunts.c`

### Gameplay Systems

- [Game Orchestration](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaMain.c): `Sources/UltimaMain.c`
- [Overworld Logic](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaMisc.c): `Sources/UltimaMisc.c`
- [Dungeon Logic](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaDngn.c): `Sources/UltimaDngn.c`
- [Combat and Spells](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaSpellCombat.c): `Sources/UltimaSpellCombat.c`
- [Auto Combat](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaAutocombat.c): `Sources/UltimaAutocombat.c`

### World and State

- [Party Management](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaNew.c): `Sources/UltimaNew.c`
- [Map Generation](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaNewMap.c): `Sources/UltimaNewMap.c`
- [Game State](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaIncludes.h): `Sources/UltimaIncludes.h`

### Presentation and Settings

- [Graphics Engine](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaGraphics.c): `Sources/UltimaGraphics.c`
- [Game Text](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaText.c): `Sources/UltimaText.c`
- [Sound Playback](https://github.com/farmisen/ultima3/blob/main/Sources/UltimaSound.m): `Sources/UltimaSound.m`
- [Sound Assets](https://github.com/farmisen/ultima3/tree/main/Resources/Sounds): `Resources/Sounds`
- [Game Resources](https://github.com/farmisen/ultima3/tree/main/Resources/English.lproj/Strings): `Resources/English.lproj/Strings`
- [Graphics Assets](https://github.com/farmisen/ultima3/tree/main/Resources/Graphics): `Resources/Graphics`

### Other components

- **Player**

## Connections

- Player → Mac Interface: interacts
- Mac Interface → Game Orchestration: dispatches
- Dungeon Logic → Combat and Spells: casts spells (evidence: `Sources/UltimaDngn.c`)
- Combat and Spells → Auto Combat: uses routines (evidence: `Sources/UltimaSpellCombat.c`)
- Combat and Spells → Dungeon Logic: updates dungeon (evidence: `Sources/UltimaSpellCombat.c`)
- Overworld Logic → Dungeon Logic: uses dungeon routines (evidence: `Sources/UltimaMisc.c`)
- Map Generation → Game State: updates state
- Party Management → Game State: updates state
- Dungeon Logic → Graphics Engine: draws dungeon (evidence: `Sources/UltimaDngn.c`)
- Mac Interface → Graphics Engine: uses graphics (evidence: `Sources/UltimaMacIF.c`)
- Preferences Dialog → Preferences Controller: configures
- Apple Events → Preferences Dialog: opens preferences (evidence: `Sources/UltimaAppleEvents.c`)
- Graphics Engine → Graphics Assets: uses alternate graphics (evidence: `README.md`)
- Sound Playback → Sound Assets: plays sounds
- Mac Interface → Carbon Compatibility: uses compatibility shims (evidence: `Sources/UltimaMacIF.c`)
- Game Resources → Overworld Logic: supplies game text
