# advocaite/stargate-wars architecture

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

- Interactive diagram: https://gitdiagram.com/advocaite/stargate-wars
- Repository: https://github.com/advocaite/stargate-wars

## Overview

Stargate-Wars is an unfinished PHP/SQL browser strategy game. Players register or log in, then use the game interface to manage an empire, economy, military, research, and player interactions; game logic is concentrated in Game and User. Sampled sources confirm entry, account creation, the technology and armory actions, and AJAX page loading. Other gameplay areas are documented mainly by module names, so their exact runtime wiring is not inferred.

Main entry points: [`index.php`](https://github.com/advocaite/stargate-wars/blob/master/index.php) (Game interface), [`base/Game.class.php`](https://github.com/advocaite/stargate-wars/blob/master/base/Game.class.php) (Game rules), [`js/main.js`](https://github.com/advocaite/stargate-wars/blob/master/js/main.js) (AJAX navigation), [`base/User.class.php`](https://github.com/advocaite/stargate-wars/blob/master/base/User.class.php) (User accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and accounts"]
  node_web["Game interface<br/>[index.php]"]
  node_login["Login form<br/>[login.php]"]
  node_register["Registration form<br/>[register.php]"]
  node_client["AJAX navigation<br/>[main.js]"]
  node_pagecontent["Page content<br/>[updates.php]"]
end

subgraph group_engine["Game engine"]
  node_account["User accounts<br/>[User.class.php]"]
  node_game["Game rules<br/>[Game.class.php]"]
  node_database[("Game database<br/>[config.php]")]
end

subgraph group_play["Empire management"]
  node_technology["Technology<br/>[technology.php]"]
  node_armory["Armory<br/>[armory.php]"]
  node_training["Unit training<br/>[train.php]"]
  node_untraining["Unit untraining<br/>[untrain.php]"]
  node_planets["Planet management<br/>[base.php]"]
  node_bank["Bank<br/>[bank.php]"]
  node_market["Market<br/>[market.php]"]
  node_fleet["Fleet dock<br/>[fleetdock.php]"]
  node_combat["Spy and action<br/>[spy.php]"]
  node_progress["Progress<br/>[progress.php]"]
end

subgraph group_social["Player interaction"]
  node_messages["Messages<br/>[messages.php]"]
  node_sendmessage["Send message<br/>[sendmessage.php]"]
  node_alliances["Alliances<br/>[c_ally.php]"]
  node_recruit["Recruitment<br/>[recruit.php]"]
end

subgraph group_operations["Game operations"]
  node_turns["Turn updates<br/>[1milquery.php]"]
  node_rankings["Rankings<br/>[rank.php]"]
  node_logs["Action logs<br/>[actionLogs.php]"]
  node_stats["Game statistics<br/>[stats.php]"]
end

node_player(("Player"))

node_player -->|"opens"| node_web
node_web -->|"loads"| node_login
node_web -->|"loads"| node_register
node_login -->|"submits credentials"| node_web
node_web -->|"authenticates"| node_account
node_register -->|"submits registration"| node_web
node_web -->|"creates account"| node_account
node_account -->|"reads and writes"| node_database
node_web -->|"creates game"| node_game
node_game -->|"extends"| node_account
node_game -->|"reads and writes"| node_database
node_player -->|"requests pages"| node_client
node_client -->|"sends action"| node_technology
node_client -->|"sends action"| node_armory
node_client -->|"loads content"| node_pagecontent
node_technology -->|"buys and views"| node_game
node_armory -->|"manages weapons"| node_game
node_armory -->|"updates inventory"| node_database
node_turns -->|"updates turns"| node_game
node_player -->|"manages units"| node_training
node_player -->|"manages units"| node_untraining
node_player -->|"manages planets"| node_planets
node_player -->|"manages funds"| node_bank
node_player -->|"trades"| node_market
node_player -->|"manages fleet"| node_fleet
node_player -->|"performs operations"| node_combat
node_player -->|"views progress"| node_progress
node_player -->|"views rankings"| node_rankings
node_player -->|"reads messages"| node_messages
node_player -->|"sends messages"| node_sendmessage
node_player -->|"manages alliance"| node_alliances
node_player -->|"recruits players"| node_recruit
node_game -.->|"records actions"| node_logs
node_stats -.->|"reads statistics"| node_database

click node_web "https://github.com/advocaite/stargate-wars/blob/master/index.php"
click node_login "https://github.com/advocaite/stargate-wars/blob/master/indexpages/login.php"
click node_register "https://github.com/advocaite/stargate-wars/blob/master/indexpages/register.php"
click node_account "https://github.com/advocaite/stargate-wars/blob/master/base/User.class.php"
click node_game "https://github.com/advocaite/stargate-wars/blob/master/base/Game.class.php"
click node_database "https://github.com/advocaite/stargate-wars/blob/master/config.php"
click node_turns "https://github.com/advocaite/stargate-wars/blob/master/1milquery.php"
click node_technology "https://github.com/advocaite/stargate-wars/blob/master/modules/technology.php"
click node_armory "https://github.com/advocaite/stargate-wars/blob/master/modules/armory.php"
click node_training "https://github.com/advocaite/stargate-wars/blob/master/modules/train.php"
click node_untraining "https://github.com/advocaite/stargate-wars/blob/master/modules/untrain.php"
click node_planets "https://github.com/advocaite/stargate-wars/blob/master/modules/base.php"
click node_bank "https://github.com/advocaite/stargate-wars/blob/master/modules/bank.php"
click node_market "https://github.com/advocaite/stargate-wars/blob/master/modules/market.php"
click node_fleet "https://github.com/advocaite/stargate-wars/blob/master/modules/fleetdock.php"
click node_combat "https://github.com/advocaite/stargate-wars/blob/master/modules/spy.php"
click node_progress "https://github.com/advocaite/stargate-wars/blob/master/modules/progress.php"
click node_rankings "https://github.com/advocaite/stargate-wars/blob/master/modules/rank.php"
click node_messages "https://github.com/advocaite/stargate-wars/blob/master/modules/messages.php"
click node_sendmessage "https://github.com/advocaite/stargate-wars/blob/master/modules/sendmessage.php"
click node_alliances "https://github.com/advocaite/stargate-wars/blob/master/modules/c_ally.php"
click node_recruit "https://github.com/advocaite/stargate-wars/blob/master/modules/recruit.php"
click node_logs "https://github.com/advocaite/stargate-wars/blob/master/modules/actionLogs.php"
click node_stats "https://github.com/advocaite/stargate-wars/blob/master/stats.php"
click node_client "https://github.com/advocaite/stargate-wars/blob/master/js/main.js"
click node_pagecontent "https://github.com/advocaite/stargate-wars/blob/master/indexpages/updates.php"

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_web,node_login,node_register,node_client,node_pagecontent toneBlue
class node_account,node_game,node_database toneAmber
class node_technology,node_armory,node_training,node_untraining,node_planets,node_bank,node_market,node_fleet,node_combat,node_progress toneMint
class node_messages,node_sendmessage,node_alliances,node_recruit toneRose
class node_turns,node_rankings,node_logs,node_stats,node_player toneIndigo
```

## Components

### Entry and accounts

- [Game interface](https://github.com/advocaite/stargate-wars/blob/master/index.php): `index.php`
- [Login form](https://github.com/advocaite/stargate-wars/blob/master/indexpages/login.php): `indexpages/login.php`
- [Registration form](https://github.com/advocaite/stargate-wars/blob/master/indexpages/register.php): `indexpages/register.php`
- [AJAX navigation](https://github.com/advocaite/stargate-wars/blob/master/js/main.js): `js/main.js`
- [Page content](https://github.com/advocaite/stargate-wars/blob/master/indexpages/updates.php): `indexpages/updates.php`

### Game engine

- [User accounts](https://github.com/advocaite/stargate-wars/blob/master/base/User.class.php): `base/User.class.php`
- [Game rules](https://github.com/advocaite/stargate-wars/blob/master/base/Game.class.php): `base/Game.class.php`
- [Game database](https://github.com/advocaite/stargate-wars/blob/master/config.php): `config.php`

### Empire management

- [Technology](https://github.com/advocaite/stargate-wars/blob/master/modules/technology.php): `modules/technology.php`
- [Armory](https://github.com/advocaite/stargate-wars/blob/master/modules/armory.php): `modules/armory.php`
- [Unit training](https://github.com/advocaite/stargate-wars/blob/master/modules/train.php): `modules/train.php`
- [Unit untraining](https://github.com/advocaite/stargate-wars/blob/master/modules/untrain.php): `modules/untrain.php`
- [Planet management](https://github.com/advocaite/stargate-wars/blob/master/modules/base.php): `modules/base.php`
- [Bank](https://github.com/advocaite/stargate-wars/blob/master/modules/bank.php): `modules/bank.php`
- [Market](https://github.com/advocaite/stargate-wars/blob/master/modules/market.php): `modules/market.php`
- [Fleet dock](https://github.com/advocaite/stargate-wars/blob/master/modules/fleetdock.php): `modules/fleetdock.php`
- [Spy and action](https://github.com/advocaite/stargate-wars/blob/master/modules/spy.php): `modules/spy.php`
- [Progress](https://github.com/advocaite/stargate-wars/blob/master/modules/progress.php): `modules/progress.php`

### Player interaction

- [Messages](https://github.com/advocaite/stargate-wars/blob/master/modules/messages.php): `modules/messages.php`
- [Send message](https://github.com/advocaite/stargate-wars/blob/master/modules/sendmessage.php): `modules/sendmessage.php`
- [Alliances](https://github.com/advocaite/stargate-wars/blob/master/modules/c_ally.php): `modules/c_ally.php`
- [Recruitment](https://github.com/advocaite/stargate-wars/blob/master/modules/recruit.php): `modules/recruit.php`

### Game operations

- [Turn updates](https://github.com/advocaite/stargate-wars/blob/master/1milquery.php): `1milquery.php`
- [Rankings](https://github.com/advocaite/stargate-wars/blob/master/modules/rank.php): `modules/rank.php`
- [Action logs](https://github.com/advocaite/stargate-wars/blob/master/modules/actionLogs.php): `modules/actionLogs.php`
- [Game statistics](https://github.com/advocaite/stargate-wars/blob/master/stats.php): `stats.php`

### Other components

- **Player**

## Connections

- Player → Game interface: opens
- Game interface → Login form: loads
- Game interface → Registration form: loads
- Login form → Game interface: submits credentials
- Game interface → User accounts: authenticates
- Registration form → Game interface: submits registration
- Game interface → User accounts: creates account
- User accounts → Game database: reads and writes
- Game interface → Game rules: creates game
- Game rules → User accounts: extends
- Game rules → Game database: reads and writes
- Player → AJAX navigation: requests pages
- AJAX navigation → Technology: sends action
- AJAX navigation → Armory: sends action
- AJAX navigation → Page content: loads content
- Technology → Game rules: buys and views
- Armory → Game rules: manages weapons
- Armory → Game database: updates inventory
- Turn updates → Game rules: updates turns
- Player → Unit training: manages units
- Player → Unit untraining: manages units
- Player → Planet management: manages planets
- Player → Bank: manages funds
- Player → Market: trades
- Player → Fleet dock: manages fleet
- Player → Spy and action: performs operations
- Player → Progress: views progress
- Player → Rankings: views rankings
- Player → Messages: reads messages
- Player → Send message: sends messages
- Player → Alliances: manages alliance
- Player → Recruitment: recruits players
- Game rules → Action logs: records actions
- Game statistics → Game database: reads statistics
