How angeloov/airplane-game-threejs works
1. Project type and boundary
- This is a client-side 3D scene project built with Three.js and bundled by Webpack.
- There is no backend or API layer in the repository; the whole application runs in the browser and renders to WebGL.
2. Application bootstrap
- src/entry.js is the main runtime entry point.
- It likely creates the renderer, camera, resize/mouse listeners, and the animation loop, then mounts the scene into the page.
- This is the highest-level orchestration layer and the best place to anchor the architecture diagram.
3. Scene composition
- src/objects/Scene.js is the central composition module.
- It assembles the world by instantiating and arranging the scene objects and lighting.
- In diagram terms, this is the “scene graph root” or composition boundary that owns the renderable entities.
4. Renderable object modules
- src/objects/ contains isolated 3D entity definitions:
- Earth.js
- Airplane.js
- Cloud.js
- Coin.js
- Asteroid.js
- Each module appears to encapsulate one logical object type, including geometry/model loading, transforms, and any motion behavior.
- This separation lets the scene compose reusable objects without putting their implementation details into the bootstrap.
5. Asset-driven rendering
- The visual content is driven by local 3D model assets under src/models/.
- The repo includes both FBX and GLB formats, plus a cloud model subfolder:
- Airplane.fbx
- Coin.fbx
- Earth.glb
- Plane.glb
- clouds/Cloud_1.fbx through Cloud_4.fbx
- These are imported as static resources and loaded asynchronously into Three.js at runtime.
6. Utility layer
- src/lib/utils.js is the shared helper layer.
- This is likely where cross-cutting math or scene helpers live, such as randomization, formatting, or object placement utilities.
- Keep this as a low-level dependency used by object modules rather than by the app entry point directly.
7. Styling and presentation
- src/styles.js handles page-level styling for the canvas/container and any overlay UI.
- Since the app is a 3D renderer rather than a traditional UI, styling is likely thin and focused on layout, fullscreen behavior, and preventing browser defaults from interfering with the canvas.
8. Static assets and fonts
- src/fonts/ is present for typography assets, suggesting there may be text/UI overlays or future HUD elements.
- The architecture is still centered on the canvas; fonts are auxiliary, not core rendering infrastructure.
9. Build and packaging pipeline
- webpack.config.js defines the bundling pipeline for JavaScript and asset imports.
- The build output in build/ shows the result of that pipeline: a compiled JS bundle, source map, HTML entry point, and emitted model files.
- This means the asset pipeline is important: models are not fetched from a remote service, they are bundled/copied into deployable static files.
10. Runtime data flow
- Browser loads build/index.html or the dev server page.
- Webpack bundle executes src/entry.js.
- entry.js creates the renderer/camera and instantiates Scene.
- Scene pulls in object modules, which in turn load local model assets and attach meshes to the Three.js scene.
- The animation loop updates transforms and re-renders each frame.
11. Deployment shape
- The repo produces a static web artifact in build/.
- Deployment is just serving those built files from any static host; no server-side rendering or application state service is involved.
12. Architecture summary
- Conceptually, this repo is organized as:
- Bootstrap: entry.js
- Composition: Scene.js
- Domain objects: individual files in objects/
- Shared helpers: lib/utils.js
- Assets: models/, fonts/
- Delivery: Webpack output in build/
- For a diagram, the primary dependencies are from bootstrap → scene composition → object modules → static model assets, with Webpack sitting underneath as the packaging/runtime delivery layer.
Main entry points: Scene.js Scene · models Models · entry.js Entry · build Build
Components 16
Runtime
Browser-executed Three.js application and its orchestration layer.
Objects
Scene composition and reusable renderable entities.
- Scene · Top-level scene assembly and renderable world composition.
src/objects/Scene.js - Earth · Earth entity with model loading and object behavior.
src/objects/Earth.js - Airplane · Airplane entity and its motion/model setup.
src/objects/Airplane.js - Cloud · Cloud entity built from local cloud model assets.
src/objects/Cloud.js - Coin · Coin entity and animation/model wiring.
src/objects/Coin.js - Asteroid · Asteroid entity used as an in-world obstacle or prop.
src/objects/Asteroid.js
Assets
Static models and auxiliary presentation assets consumed at runtime.
- Models · Source 3D model assets bundled into the client build.
src/models - Cloud Models · Cloud-specific FBX assets used by the cloud object.
src/models/clouds - Fonts · Typography assets for overlays or future HUD text.
src/fonts
Delivery
Webpack build artifacts and packaging output.
- Webpack · Bundling and asset pipeline configuration.
webpack.config.js - Build · Compiled deployable browser artifact set.
build - Index HTML · Static HTML entry point for the bundled app.
build/index.html - Main bundle · Compiled application bundle executed in the browser.
build/main.c558247a24de2bb6d358.js
Connections 18
- Entry → Scene: creates · Bootstrap instantiates the scene composition.
- Entry → Styles: loads · Entry applies page-level styling.
- Entry → Webpack: bundled by · Webpack packages the entry into the client build.
- Scene → Earth: includes · Scene composes the Earth entity.
- Scene → Airplane: includes · Scene composes the airplane entity.
- Scene → Cloud: includes · Scene composes cloud entities.
- Scene → Coin: includes · Scene composes the coin entity.
- Scene → Asteroid: includes · Scene composes the asteroid entity.
- Scene → Utils: uses · Scene and object placement rely on shared helpers.
- Earth → Models: loads · Earth object consumes bundled model assets.
- Airplane → Models: loads · Airplane object consumes bundled model assets.
- Coin → Models: loads · Coin object consumes bundled model assets.
- Cloud → Cloud Models: loads · Cloud object consumes cloud FBX assets.
- Asteroid → Models: loads · Asteroid object consumes bundled model assets.
- Webpack → Build: emits · Webpack produces the deployable build output.
- Build → Index HTML: contains · Static HTML entry is part of the output bundle set.
- Build → Main bundle: contains · Compiled JavaScript bundle is emitted into build.
- Fonts → Styles: supports · Font assets support any presentation-layer text rendering.