Skip to content

AbysmalBiscuit/reading-frame

Repository files navigation

Reading Frame

Reading Frame: decode mRNA by base-pairing

You play the ribosome. A real protein's mRNA threads through one codon at a time; you flick the matching aminoacyl-tRNA at the exposed codon, its anticodon snaps in, a residue is added, and the ribosome translocates. At the stop codon the finished chain folds into the protein's deposited structure, and the next, longer protein loads.

Play it at reading-frame.vercel.app (desktop and mobile).

Built in Godot 4.6, exported to WebAssembly, runs in a browser tab.

The mechanic is the biology

Decoding is the gameplay, and none of the rules are stylized. A structural biologist can check each one by hand:

  • Codons map to amino acids through the standard genetic code (all 64 codons).
  • An anticodon pairs antiparallel and complementary, so it is the reverse-complement of the codon. A mismatched tRNA is rejected, which is what translational fidelity means.
  • mRNA reads 5'->3'; the peptide grows N->C.
  • AUG starts; UAA, UAG, and UGA stop, where a release factor terminates.
  • The coding sequence and the final fold both come from the same deposited PDB file. Nothing about the sequence or the structure is invented; the only authored choices are which synonymous codon stands in for a residue and the flick-delivery motion.

After a fold, a Mol*-style inspector lets you orbit the structure, toggle secondary-structure elements, and read per-residue facts (mass, pKa, property class). Each value is computed from the sequence or coordinates and cross-checks against ExPASy ProtParam.

What you translate

A ladder ordered by chain length, from a 10-residue β-hairpin up to ubiquitin:

Chignolin -> Trp-zipper -> Trp-cage -> BBA5 -> Villin headpiece -> WW domain -> Crambin -> Engrailed homeodomain -> Protein G -> SH3 domain -> BPTI -> Protein A -> CspB -> CspA -> α3D -> Ubiquitin.

Plus two metamorphic proteins (one sequence, two folds): RfaH C-terminal domain (α-hairpin <-> β-barrel) and lymphotactin (chemokine <-> β-sandwich), where you pick which deposited conformation the chain collapses into.

How it looks

Each molecule gets the representation that shows what you need to read from it, the way structural-biology figures are made. The camera's focus is the codon-anticodon pairing interface.

  • Ribosome (E. coli 50S/30S, split by chain from the 4YBB 70S crystal): monochrome impostor-sphere surface blobs, used as a backdrop. Prebaked to data/baked/*.res so they don't freeze the first frame. See docs/specs/ecoli-ribosome.md for how the subunits are derived.
  • tRNA (the L-shape, from 1EHZ): a spacefill surface, a spectrum cartoon ribbon, or both, baked once and shared across every candidate.
  • mRNA, codon-anticodon, and peptide: impostor spheres (ball-and-stick or spacefill), colored by base or residue property.

Atoms are ray-cast spheres drawn in a fragment shader off a MultiMeshInstance3D (shaders/impostor_sphere.gdshader), so nothing needs a baked-mesh asset pipeline.

Tech

  • Godot 4.6.3-stable, GL Compatibility renderer (the custom shaders target this backend), Jolt physics.
  • Web export is single-threaded (Use Threads off), which avoids SharedArrayBuffer/COOP-COEP and hosts on any static server. The HTML shell is custom-branded (web/shell.html).
  • Deployed to Vercel with bun (scripts/deploy_web.sh, which cache-busts the .pck URL).
  • Day-to-day development runs through the Godot MCP plugin (addons/godot_mcp), an agent loop driving the open editor over HTTP.

Layout

main.tscn / main.gd        Composition root: bakes shared geometry, wires components
systems/                   Game logic and renderers
  genetic_code.gd            Standard genetic code + decoding rule (pure data)
  protein_library.gd         The catalogue of real proteins (the ladder + metamorphs)
  translation_director.gd    Drives the codon -> flick -> decode -> translocate -> fold loop
  trna_pool.gd / trna_picker.gd  Candidate tRNAs and the always-readable choice panel
  peptide_chain.gd           The nascent chain and the fold to deposited coordinates
  fold_inspector.gd          Post-fold Mol*-style structure inspection
  molecule_renderer.gd       Impostor-sphere meshing from PDB atoms
  protein_stats.gd           Sequence-derived mass / pKa / composition
  event_bus.gd               Autoload: lifecycle events map to molecular moments
scenes/                    Reusable scenes (ribosome, trna, panels, view switcher)
shaders/                   Impostor-sphere and molecular-surface shaders
data/                      PDB structures (downloaded, gitignored) + baked surfaces
test/                      gdUnit4 suites
docs/                      Specs, MCP and best-practices notes

The PDB files in data/ are gitignored; regenerate them by running systems/pdb_downloader.gd from the Godot script editor (File > Run), which fetches every structure the ladder and the ribosome backdrop need from RCSB.

Running it

Open the project in Godot 4.6 and run the main scene. The binary is on PATH as godot.exe (GUI) and godot_console.exe (headless, prints to stdout).

Tests use gdUnit4:

export GODOT_BIN=/abs/path/to/godot_console.exe   # absolute path required
addons/gdUnit4/runtest.sh -a res://test

Formatting uses gdscript-formatter.exe (--check to verify, --safe to apply).

See docs/ for the design specs, the MCP dev loop, and project conventions.

License & attribution

The game code is under the MIT License; see LICENSE.

  • Molecular structures come from the RCSB Protein Data Bank (rcsb.org) under the PDB's open-data terms. The ribosome backdrop is derived from the E. coli 70S crystal 4YBB (split into 30S and 50S subunits); the tRNA is 1EHZ. The protein ladder and the metamorphic proteins are the structures systems/pdb_downloader.gd fetches: 1BDD, 1CRN, 1CSP, 1E0L, 1ENH, 1FFK, 1FME, 1J5E, 1J9O, 1L2Y, 1LE1, 1MJC, 1PGB, 1SHG, 1UBQ, 1YRF, 2A3D, 2JP1, 2LCL, 2OUG, 5AWL, 5PTI. The PDB files are not redistributed here; they download at build time.
  • The standard genetic code is public reference data.
  • The vendored addons under addons/ (godot_mcp, gdUnit4) are third-party and keep their own licenses; see each addon's LICENSE file.

About

A bio-accurate ribosome translation game that folds real proteins in your browser

Topics

Resources

License

Stars

5 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors