# amirasenni21/intelligent-shooting-game architecture

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

- Interactive diagram: https://gitdiagram.com/amirasenni21/intelligent-shooting-game
- Repository: https://github.com/amirasenni21/intelligent-shooting-game

## Overview

This is a Pygame shooting-game simulation with teams of autonomous players. The principal workflow is to run the match, sense obstacles and other players, use a neural network to choose actions, and simulate movement and shooting. The single source file also contains fitness and genetic-algorithm logic; the README says genetic evolution is not applied during execution. The graph separates these runtime stages and the experimental evolution branch. Source excerpts are partial, so some relationships are omitted where calls are not shown.

Main entry points: [`Main.py`](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py) (Player state), [`Images/Players`](https://github.com/amirasenni21/intelligent-shooting-game/tree/master/Images/Players) (Player sprites)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Match runtime"]
  node_loop["Match loop<br/>[Main.py]"]
  node_arena["Map and obstacles<br/>[Main.py]"]
  node_sprites["Player sprites"]
end

subgraph group_agents["Autonomous agents"]
  node_player["Player state<br/>[Main.py]"]
  node_sensors["Ray-cast sensing<br/>[Main.py]"]
  node_network["Neural network<br/>[Main.py]"]
  node_movement["Player movement<br/>[Main.py]"]
end

subgraph group_combat["Combat simulation"]
  node_shooting["Targeting and shooting<br/>[Main.py]"]
  node_bullet["Bullet simulation<br/>[Main.py]"]
end

subgraph group_evolution["Evolution experiments"]
  node_fitness["Fitness scoring<br/>[Main.py]"]
  node_selection["Parent selection<br/>[Main.py]"]
  node_crossover["Crossover and mutation<br/>[Main.py]"]
end

node_user(("Game operator"))

node_user -->|"starts match"| node_loop
node_loop -->|"uses map"| node_arena
node_loop -->|"updates players"| node_player
node_player -->|"loads images"| node_sprites
node_player -->|"casts rays"| node_sensors
node_loop -->|"requests actions"| node_network
node_network -->|"predicts actions"| node_player
node_player -->|"moves"| node_movement
node_player -->|"targets and fires"| node_shooting
node_shooting -->|"creates bullets"| node_bullet
node_loop -.->|"tracks outcomes"| node_fitness
node_fitness -->|"scores population"| node_selection
node_selection -->|"chooses parents"| node_crossover

click node_loop "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"
click node_arena "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"
click node_sprites "https://github.com/amirasenni21/intelligent-shooting-game/tree/master/Images/Players"
click node_player "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"
click node_sensors "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"
click node_network "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"
click node_movement "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"
click node_shooting "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"
click node_bullet "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"
click node_fitness "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"
click node_selection "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"
click node_crossover "https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py"

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_loop,node_arena,node_sprites toneBlue
class node_player,node_sensors,node_network,node_movement toneAmber
class node_shooting,node_bullet toneMint
class node_fitness,node_selection,node_crossover toneRose
class node_user toneIndigo
```

## Components

### Match runtime

- [Match loop](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`
- [Map and obstacles](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`
- [Player sprites](https://github.com/amirasenni21/intelligent-shooting-game/tree/master/Images/Players): `Images/Players`

### Autonomous agents

- [Player state](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`
- [Ray-cast sensing](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`
- [Neural network](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`
- [Player movement](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`

### Combat simulation

- [Targeting and shooting](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`
- [Bullet simulation](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`

### Evolution experiments

- [Fitness scoring](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`
- [Parent selection](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`
- [Crossover and mutation](https://github.com/amirasenni21/intelligent-shooting-game/blob/master/Main.py): `Main.py`

### Other components

- **Game operator**

## Connections

- Game operator → Match loop: starts match (evidence: `Main.py`)
- Match loop → Map and obstacles: uses map (evidence: `README.md`)
- Match loop → Player state: updates players (evidence: `Main.py`)
- Player state → Player sprites: loads images (evidence: `Main.py`)
- Player state → Ray-cast sensing: casts rays (evidence: `Main.py`)
- Match loop → Neural network: requests actions (evidence: `Main.py`)
- Neural network → Player state: predicts actions (evidence: `Main.py`)
- Player state → Player movement: moves (evidence: `Main.py`)
- Player state → Targeting and shooting: targets and fires (evidence: `Main.py`)
- Targeting and shooting → Bullet simulation: creates bullets (evidence: `Main.py`)
- Match loop → Fitness scoring: tracks outcomes (evidence: `Main.py`)
- Fitness scoring → Parent selection: scores population (evidence: `Main.py`)
- Parent selection → Crossover and mutation: chooses parents (evidence: `Main.py`)
