space-browser / commits / 1392b2e
initial: adds docs and icon
@@ -0,0 +1,161 @@
1+# GAME DESIGN
2+
3+A space exploration game played in a web browser tab, each socket connection is an independant player.
4+The galaxy is one shared seed for all players, covered by a fog of war that is lifted as players explore. Galaxy exploration progress is shared by all players. As they explore players can name their discovered planets and POIs. The galaxy is densily populated near the middle, getting more sparse and challenging as players explore further. With exceptions for gameplay the galaxy should feel like outter space and at that scale.
5+There are several Places of Interest (POIs) types: Stars, Planets, Asteroid fields, Comms antennas, Shipyards, Ship wrecks, and Friendly NPC Fleets/Rogue AI Fleets of varied sizes and ship compositions.
6+Players progress by combat (PvP and PvE), scavenging wrecks, mining ore asteroids, crafting upgrades, and trading with each other.
7+Ships are a free graph of connected nodes (with distinct non-overlaping shapes) arranged freely by the player (the rule is that all nodes must be connected). NPCs use the same ship system with randomly generated compositions.
8+Ship Pieces come in 5 varieties, they all have base stats but each shape has a specific attribute, or function that distinguishes them, the player combines these in a free connected grap to make his ship. They are found from wrecks, crafted from ores, and traded with other players.
9+
10+## Look and feel
11+
12+### Look
13+
14+Inspired by the slow moving animation of a galaxy, rendered in a cel based raster with terminal characters for texture seen in https://xonecas.io/ (it's the background animation of the site).
15+The whole game should be rendered in this engine except the UI, which should be clean, minimal, and free of repetition and clutter. The UI should have a consistent styleguide with the engine's palette. No web-like interactions of hovers, grounded in game UI patterns and UX.
16+It's space, it's slow twinkling, movement, with a perpetual feeling, at a big scale.
17+
18+### Feel
19+
20+The ship controls like a real time strategy unit, left click for contextual action (move/attack), right click for context menu. Shift left click queues movements.
21+
22+No separate map, scroll goes from ship scale to galaxy scale, renderend in our engine, no layering.
23+
24+The galaxy needs to feel big, the players should feel tiny next to a planet, but we also can't make it take days to travel from place to place. A careful balance that will likely be balanced as we playtest. Some base numbers to derive the rest are that it should take ~1-5m between star systems in the galaxy. As the players move away from the center this will scale to be longer (player will also have faster ships, so it ends up in a somewhat linear progression).
25+
26+## Gameloop
27+
28+1. Player picks his callsign and starting piece, tier one, choice between triangle, square, or circle.
29+2. Player is spawned in the spawn systems. Orbiting a POI. Player plays the game.
30+3. Player dies when the initial piece reaches 0hp. Either by self-destruct, colision with a star, or from being attacked/combat. Or the player dies if their websocket connection drops/disconnects.
31+4. Player is presented with an overlay with the death message, reason for death, and statistics relevant to this run only:
32+ - total damage done
33+ - total damage received
34+ - total gathered ore
35+ - total gathered ship pieces
36+ - total comms towers linked
37+ - A list of named places
38+This death message overlay also includes a "Respawn" button, that sends the player to step 1. of the gameloop for a fresh go.
39+
40+Each iteration is it's own save game or save state, there is no meta progression.
41+
42+## Ships
43+
44+A ship is a graph of connected ship pieces: one root starting node plus added pieces. Each piece has a shape, a quality (1–3 stars) and health. A new piece must attach to one or more existing piece, and there is no size cap (a bigger ship is a bigger target, which is the only balancing force). If the graph is severed the clusted with the inital shape node remains the player, the rest becomes a wreck
45+
46+The ship is in the center of the UI, and in the players view always. The graph of pieces has some jiggle based on direction of the movement, subtle.
47+Ship pieces invert the color they are over, so they are always disticnt from their background.
48+
49+### Ship Pieces
50+
51+Five shapes. Base quality is 1 star; quality 2 is 1.5x and quality 3 is 2.25x both the piece's bonus and its health.
52+Every shape gives +5 to all stats and has 100 hp, then each specific shape adds their bonus ontop:
53+
54+- **Triangle** — attack: the shooting piece (+5 attack).
55+- **Square** — defense: reduces incoming damage (+5 defense).
56+- **Circle** — fuel: raises the fuel cap (+5 fuel).
57+- **Pentagon** — storage: adds cargo slots (+5 slots).
58+- **Star** — speed: raises max speed (+5 speed).
59+
60+## POIs
61+
62+Orbit, a player needs to be "in orbit" (at a reasonable distance) to interact with POIs
63+Nameable means that an unnamed POI can be named by a player. Once it has a name it is no longer editable. A player needs to be in orbit (a reasonable distance) from the POI to name it.
64+
65+- **Stars** — system anchor; Contact destroys a ship. Nameable.
66+- **Planets** — orbit stars; nameable.
67+- **Asteroid fields** — A POI with some ore pieces to pick up (there's no mining system). Nameable.
68+- **Comms antennas** — extend radio reach (players with the same antennas always see each others radio messages, no matter the distance). Nameable
69+- **Shipyards** — craft, upgrade, repair ship pieces. Upgrades cost 3 times the ship-piece level in ores. Repairs cost 1 ore per ship piece repair. Nameable
70+- **Ship wrecks** — scavenge ship pieces, a poi with a few pices randomly generated or a player wreck.
71+- **NPC fleets** — friendly or rogue AI, varied size and composition; Friendly ones hail the user via radio. Enemy fleets attack on sight (a reasonable engadging distance).
72+
73+## Trading
74+
75+- No currency, item exchanges only.
76+- Is done by ejecting from cargo, and the other player/npc picks it up. gentlemans agreements. No in game system forcing a fair trade.
77+
78+## Radio
79+
80+In game chat, in a local range + comms antennas. Antenas aren't special channels, there is one radio chat, antennas only expand the reach, meaning that players with the same antennas linked see each other messages independant of distance **in addition** to local radio.
81+Players link antennas by flying near them/discovering them.
82+
83+## Exploration
84+
85+Players can context click a planet/POI and select to orbit it, moving the ship to near orbit (use a resonable distance).
86+Once in orbit, this allows them to name the POI if they are the first, and for shipyards, to refuel.
87+
88+## Fuel
89+
90+Fuel is used up as the player travels and can be refilled at shipyards, no cost, just needs to orbit it.
91+Reaching 0 fuels leaves the player stranded, with self-destruct and radio'ing for help as options.
92+Other player can share their fuel by context clicking a friendly (out of combat) and selecting share fuel, sends 10 of your own fuel to the friedly by ejecting it.
93+
94+## Combat
95+
96+Ships auto fire their triangles, (the range of the shot needs to be configurable for us so we can balance based on gameplay, so start reasonably), and the ship moves to be in range to shoot when the player clicks to attack something, or starts attacking right away.
97+
98+In combat means shooting at or being shot at, once either of those happens the player is in combat until shooting stops for a certain delay.
99+
100+A player that is attacked will auto engadge his attacker.
101+
102+### Severed
103+
104+Depending on the players choice of arrangement of ship pieces, detroying a key piece might cause a separation of the graph. When this happens the cluster still connected to the initial piece stays alive, the severed cluster becomes a wreck.
105+
106+## Death
107+
108+A player dies when:
109+
110+- Their connection drops. For any reason, we can have a reconnect retry for 5s but then it's death.
111+- Their initial ship piece reaches 0 hit points.
112+- They colide with a star, meaning any ship piece overlapped with the star, scales are different but for fair gameplay the colision needs to be visual to the player.
113+- They self destruct intentionaly to start anew (stranded, no fuel scenarios).
114+
115+When a player dies, they will leave behind their wreck, and this becomes a Wreck POI with that players ship pieces. This doesn't despawn and are named after the players callsign that died, ex: "Maverick's wreck".
116+
117+## Technical details
118+
119+### Frontend/UI
120+
121+The client draws the whole world on one Three.js canvas (the cel/glyph raster, amber terminal palette) with a DOM HUD laid over it. The HUD is minimal and amber-monospace, permanently showing only the essentials.
122+
123+#### HUD
124+
125+PLayer, location and ship details on the top left corner.
126+Radio conversation input and log on the bottom left corner.
127+Modals/Overlays are a sidebar on the right, not over the action/player ship.
128+
129+- **Hit Points** - each ship piece, their quality and hp.
130+- **Fuel meter** — bar with a trailing ghost bar and the `FUEL n/cap` label; pulses when low.
131+- **Cargo slots** — one cell per item (`CARGO n/cap`): ore glyph, or a piece glyph with its stars; right-click ejects. (can pick up again after a small delay).
132+- **Radio** — rolling chat log tagged by channel and sender, with the radio input line.
133+- **Target readout** — in-combat/current planet/system name, and ATK/DEF/SPD.
134+- **Feedback** — cursor hover hint, transient toasts, in-world move/route/hover markers.
135+- **Overlays** — help (`?`), confirm and death modals, all custom-styled.
136+- **New user experience** - The user is presented with a screen to write his callsign (required, must not be duplicate with existing playing callsings), and their starting ship piece - step 1. of gameloop.
137+
138+The player doesn't need a special edit screen for attaching/detaching/reconfiguring their ship. It's done with mouse, context menus in the live view.
139+Right clicking on your ship pieces opens a context menu to detach the piece. The the user can reattach using context menus too and draging the piece to the correct place. Right clicking a loose ship piece gives options to attach, which initates the drag to connect to the graph, or add to cargo.
140+
141+Self destruct is an option by right clicking the initial ship piece, and needs a confirmation.
142+
143+#### ASCII raster renderer
144+
145+The visual ancestor is the background animation of https://xonecas.io/ (source public on the site). We take its *technique*, not its code: cell based, monospace chars as texture/shading in a sepia ramp with gold as the only accent.
146+
147+**This is the key aspect that makes the game unique in visuals, it is not a flat animation.** The reference is a screen-space picture: cells are anchored to the viewport, one analytic spiral field is sampled every frame, and the "camera" is fake (mouse parallax, tilt, spin). We do the inverse. The world is real and the glyph grid is only the final rasterisation step.
148+
149+2d top-down camera, use three.js for the scene then render the frames to raster.
150+
151+### Server
152+
153+- Authoritive server, server owns game state.
154+- Galaxy seed is 64bit, and generation is deterministic with the same seed.
155+- Like real galaxies, the center is denser with more variety and then it starts scattering heavily, our generation should aim to resemble this. Adding the game "lore" of a populated center, NPC/Enemy AI should be more common in the center. And less common as the player explores further.
156+
157+#### Stack
158+
159+- **Server:** Go 1.27, `gorilla/websocket`, pure-Go sqlite (`modernc.org/sqlite`, no cgo), single static binary, 30 Hz authoritative tick, separate position and dots broadcast loops. Deterministic galaxy from a 64-bit seed stored in sqlite.
160+- **Client:** TypeScript + Vite + three.js, no UI framework, DOM HUD over one canvas.
161+- **Shared config:** - Use a config file for all gamebalancing values that both frontend and backend consume, ensuring they are consistent with one another.
@@ -0,0 +1,4 @@
1+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
2+ <rect width="32" height="32" fill="#0a0806"/>
3+ <path d="M16 6l3 7 7 3-7 3-3 7-3-7-7-3 7-3z" fill="#ffcc55"/>
4+</svg>