Skip to content

Commit 584d26e

Browse files
Add the PC edition: pygame, and everything 32 KB had cost
Same game, same rules, without the memory straitjacket. Every cut the calculator build had to make is back, and then some. Restored - The drawn sector map. It went from a node graph to a route table to a three-line menu on the calculator because the parse tree would not fit; here it is a real graph with diagonals. - Twelve upgrades instead of eight, three difficulty tiers, six events with consequences, crystals you chase and can magnet in, explosions. - Bosses get three phases and enrage after forty seconds. New to this edition - Hand-drawn pixel art instead of three rectangles a ship. Sprites are text, left half plus centre column, mirrored at load: symmetry for free and half as much to draw. - Particles, screen shake, white-flash on hit, hit-stop on hull damage, engine trails, an optional CRT overlay on F1. - Eight-directional movement. The calculator was pinned to two keys per player by a diode-less keyboard matrix; a PC is not. Everything renders to a 480x270 surface scaled up by a whole number, so a pixel stays a hard square at any window size. Testing runs headless on the dummy SDL drivers, so real runs go through the real state machine in CI -- same key events, same combat, only the display is faked. It caught three things a screenshot would not have: - an enemy killed by two bullets in one frame scored and exploded twice - the boss descended below the player, where shots that only travel upward could never reach it, and separately could drift off-screen and hand over a win nobody earned - the fight ended on the frame the boss died, throwing away the salvage it had just dropped Measured: bot win rate 7/4/1 of 8 across the three tiers, 9-11 minutes of combat in a winning run, and 1.35 ms at p99 against a 16.7 ms frame budget. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKLqS4PgnCXrzKHDH8Cnzy
1 parent 9f6077c commit 584d26e

29 files changed

Lines changed: 2751 additions & 6 deletions

‎.github/workflows/ci.yml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,20 @@ jobs:
5656
run: |
5757
python3 tools/build.py
5858
python3 tools/memcheck.py
59+
60+
pc:
61+
# The pygame build runs headless with the dummy SDL drivers, so the whole
62+
# suite -- real runs through the real state machine -- works in CI.
63+
runs-on: ubuntu-latest
64+
env:
65+
SDL_VIDEODRIVER: dummy
66+
SDL_AUDIODRIVER: dummy
67+
steps:
68+
- uses: actions/checkout@v4
69+
- uses: actions/setup-python@v5
70+
with:
71+
python-version: "3.11"
72+
- name: Install pygame
73+
run: pip install -r pc/requirements.txt
74+
- name: PC test suite
75+
run: python3 pc/tests/run_all.py

‎README.md‎

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,35 @@
44
[![Licence: MIT](https://img.shields.io/badge/licence-MIT-blue.svg)](LICENSE)
55
[![Tas: 47/48 Ko](https://img.shields.io/badge/tas%20MicroPython-47%2F48%20Ko-brightgreen.svg)](docs/OPTIMIZATION.md)
66
[![Plateforme: NumWorks](https://img.shields.io/badge/plateforme-NumWorks-orange.svg)](https://www.numworks.com/)
7+
[![PC: pygame](https://img.shields.io/badge/PC-pygame-9c6ade.svg)](pc/README.md)
78

8-
Un rogue-lite spatial pour calculatrice **NumWorks**. Écrit en Python, tient dans
9-
les 32 Ko de mémoire de la machine, tourne à 25 images par seconde.
9+
Un rogue-lite spatial, en deux éditions :
10+
11+
- **[Calculatrice NumWorks](#édition-numworks)** — Python pur, tient dans les 32 Ko de
12+
tas de la machine, 25 images par seconde.
13+
- **[PC (pygame)](pc/README.md)** — le même jeu, sans la camisole mémoire :
14+
carte de secteur dessinée, 12 améliorations, 3 difficultés, événements,
15+
particules, filtre CRT.
16+
17+
![NOVA sur PC](docs/img/pc-03-fight.png)
18+
19+
*L'édition PC. La version calculatrice est plus bas.*
20+
21+
## Édition PC
22+
23+
```bash
24+
cd pc && pip install pygame && python3 nova.py
25+
```
26+
27+
| | |
28+
|---|---|
29+
| ![Carte de secteur](docs/img/pc-02-map.png) | ![Boss](docs/img/pc-04-boss.png) |
30+
| La carte de secteur à embranchements | Boss en phase 2 |
31+
32+
Déplacement 8 directions, tir automatique, coop 2 joueurs sur le même clavier.
33+
Tout est dans [pc/README.md](pc/README.md).
34+
35+
## Édition NumWorks
1036

1137
![Écran-titre](docs/img/01-title.png)
1238

@@ -24,7 +50,7 @@ affrontes un boss — cinq secteurs, puis **le Vide**, qui n'a pas de fin.
2450
*(Rendu de l'émulateur headless : les textes apparaissent en blocs parce que le
2551
stub ne dessine pas les glyphes. Sur la calculatrice, ce sont de vraies lettres.)*
2652

27-
## Installation
53+
### Installation
2854

2955
Le jeu est en **5 scripts**. Ce n'est pas un caprice : MicroPython compile un
3056
module d'un seul bloc et garde tout son arbre syntaxique en mémoire, donc c'est
@@ -45,7 +71,7 @@ du fichier correspondant dans `dist/` :
4571
Puis envoie-les sur la calculatrice et lance **`nova`** (les quatre autres se
4672
chargent tout seuls). Détails et dépannage : [docs/INSTALL.md](docs/INSTALL.md).
4773

48-
## Contrôles
74+
### Contrôles
4975

5076
| | Joueur 1 | Joueur 2 (coop) |
5177
|---|---|---|
@@ -63,7 +89,7 @@ atteignable ne peut créer de fantôme, et
6389

6490
`RETOUR` n'est jamais lue : Epsilon peut interrompre le script dessus.
6591

66-
## Le jeu
92+
### Le jeu
6793

6894
- **Trois routes par saut** : patrouille, patrouille d'élite, marchand ou
6995
atelier de réparation. Sept nœuds par secteur, puis le boss.
@@ -78,7 +104,7 @@ Mesuré sur des parties simulées : **7 minutes de combat pur** par partie, soit
78104
douze à quinze minutes une fois comptés les menus. Le design complet et ce que
79105
le matériel a imposé : [docs/GAME_DESIGN.md](docs/GAME_DESIGN.md).
80106

81-
## Performances
107+
### Performances
82108

83109
La NumWorks donne à Python **32 Ko de tas**, avec une API graphique sans sprite,
84110
sans blit et sans double tampon. NOVA n'efface jamais l'écran : chaque objet

‎docs/img/pc-01-title.png‎

6.01 KB
Loading

‎docs/img/pc-02-map.png‎

7.36 KB
Loading

‎docs/img/pc-03-fight-crt.png‎

14.4 KB
Loading

‎docs/img/pc-03-fight.png‎

4.98 KB
Loading

‎docs/img/pc-04-boss.png‎

5 KB
Loading

‎docs/img/pc-05-trader.png‎

4.68 KB
Loading

‎docs/img/pc-06-event.png‎

3.84 KB
Loading

‎docs/img/pc-sprites.png‎

4.26 KB
Loading

0 commit comments

Comments
 (0)