Template·three·v1.0.0·ISC
Trump vs Biden
Trump vs Biden — a Three.js starter mirrored from OpusGameLabs/game-creator.
#template#three#trump#vs#biden
Preview
Edit on StackBlitzInstall
npx create-gamecn my-game --template trump-vs-bidenSource preview
Compatibility
| Engines | three >=0.160.0 |
| Frameworks | vanilla |
| Languages | javascript |
| Bundlers | vite |
| Platforms | web, mobile-web |
Files installed
- .gitignore
- design-brief.md(docs)
- index.html
- package.json
- progress.md(docs)
- public/assets/models/biden.glb(asset)
- public/assets/models/trump.glb(asset)
- src/core/Constants.js
- src/core/EventBus.js
- src/core/Game.js
- src/core/GameState.js
- src/gameplay/Opponent.js
- src/gameplay/Player.js
- src/gameplay/Projectile.js
- src/gameplay/ProjectileManager.js
- src/level/AssetLoader.js
- src/level/LevelBuilder.js
- src/main.js
- src/systems/EffectsSystem.js
- src/systems/InputSystem.js
- src/ui/Menu.js
- vite.config.js
- gamecn.json
Notes
Concept
3D arena battle: Trump vs Biden throwing projectiles at each other.
Core Mechanics
- Dodge: Move left/right to avoid Biden's projectiles. State: player.position.x. Magnitude: full arena width traversal in ~2.5s.
- Throw: Launch projectile at Biden. State: score (on hit). Cooldown: 0.5s. Magnitude: ~2 hits/second max.
- Health: Player takes damage when hit. State: gameState.health. Starts at 5, decreases by 1 per hit.
Win/Lose Conditions
- Win: Accumulate highest score (endless)
- Lose: Health reaches 0 (all 5 lives lost)
Entity Interactions
- Trump (player): Red/orange placeholder box. 12% screen width. Moves left/right, throws red projectiles.
- Distinguishing: Orange hair, red tie (to be added in asset step)
- Gestures: point (throw), clap (hit), dance (combo), twist (dodge)
- Biden (opponent): Blue placeholder box. 12% screen width. AI-controlled, moves sinusoidally, throws blue projectiles.
- Distinguishing: White hair, aviator sunglasses, blue suit (to be added in asset step)
- Gestures: idle only
- Red projectile: Glowing red sphere, 0.3 units. Travels from Trump toward Biden.
- Blue projectile: Glowing blue sphere, 0.3 units. Travels from Biden toward Trump.
- Arena: Dark platform 20x12 units with glowing edges.
Expression Map
Player: Trump
| Game Event | Animation | Why |
|---|---|---|
| Idle/default | idle (TrumpStillLook) | Resting state |
| Throw projectile | point (TrumpPoint) | Aiming gesture |
| Hit Biden | clap (TrumpClap1) | Celebration |
| Combo 3+ | dance (Trumpdance1) | Victory dance |
| Take damage | twist (TrumpTwist) | Recoil |
| Talking/taunting | talk (TrumpTalk1) | Between throws |
Opponent: Biden
| Game Event | Animation | Why |
|---|---|---|
| All states | idle (mixamo.com) | Only animation available |
Game Concept
- Name: trump-vs-biden
- Engine: Three.js (3D)
- Description: 3D arena battle — player controls Trump, throws projectiles at AI-controlled Biden. Dodge Biden's attacks, score on hits, game over when health depletes.
Step 1: Scaffold
- Entities: Player.js (Trump), Opponent.js (Biden), Projectile.js, ProjectileManager.js
- Events: GAME_START, GAME_OVER, GAME_RESTART, PLAYER_THROW, PLAYER_HIT, PLAYER_MOVE, OPPONENT_THROW, OPPONENT_HIT, HEALTH_CHANGED, SCORE_CHANGED, COMBO_CHANGED, SPECTACLE_ENTRANCE/ACTION/HIT/COMBO/STREAK/NEAR_MISS, AUDIO_INIT, MUSIC_MENU/GAMEPLAY/GAMEOVER/STOP
- Constants keys: GAME, SAFE_ZONE, ARENA, PLAYER, OPPONENT, PROJECTILE, CAMERA, COLORS, SCORING, TRUMP_CLIPS, BIDEN_CLIPS, ASSET_PATHS, MODEL_CONFIG
- Scoring system: +1 per Biden hit, combo bonus (+2) at 3+ consecutive hits within 3s timeout
- Fail condition: Health drops to 0 (starts at 5 hearts)
- Input scheme: A/D or Arrow keys for left/right dodge, Space to throw. Touch: left/right halves for movement, quick tap to throw.
Characters (3D)
- Trump (player): Tier 1 — pre-built in assets/3d-characters (idle/clap/dance/point/talk/twist)
- Biden (opponent): Tier 1 — pre-built in assets/3d-characters (idle only)
Decisions / Known Issues
- Both models are "gesture" type (no walk/run) — characters slide while playing idle animation
- Trump facing offset: Math.PI (faces -Z by default)
- Biden facing offset: Math.PI (configured in MODEL_CONFIG)
- Placeholder colored boxes used until Step 1.5 loads GLB models
- HUD hearts/score positioned in Play.fun safe zone area — will adjust during SDK integration
Step 2: Design (Visual Polish)
- New file:
src/systems/EffectsSystem.js— centralized visual effects system wired entirely through EventBus - New constants:
EFFECTSobject added toConstants.jswith 40+ tuning values for particles, camera shake, flash, trails, combo text, slow-mo, entrance animation, and arena glow
Effects implemented
- Opening moment: White camera flash on game start + characters rise from y=-2 with easeOutBounce over 0.8s + landing shake. Ambient dust/spark particles active from frame 1 (60 particles, additive blending, drifting upward).
- Hit effects: 18-particle burst at impact point colored by projectile team (red/blue), additive blending with gravity. Screen flash (red for player damage, red-tinted for opponent hit). Camera shake on both hit types (stronger on player damage).
- Throw effects: Muzzle flash (PointLight, intensity 2.0, fades over 200ms) + small 5-particle burst at throw origin.
- Projectile trails: Small transparent spheres spawned every 30ms along projectile path, fade out over 250ms with scale reduction.
- Combo text: HTML overlay "Nx COMBO!" text that scales from 0.3 to 1.3 and fades out. Font size grows with combo count (48px base + 6px per combo, max 80px). Gold color with glow text-shadow.
- Streak milestones: At combo 5/10/25, full-screen text slam ("ON FIRE!", "UNSTOPPABLE!", "DOMINATION!") with scale-in animation + 40-particle burst + strong camera shake.
- Damage feedback: Red flash overlay (alpha 0.4, 300ms), strong camera shake (0.18 intensity), HUD heart scale-up + shake animation.
- Arena glow pulse: Edge glow strips oscillate opacity sinusoidally (period 2s, range 0.3-0.7).
- Game over: Slow-motion (delta multiplied by 0.2 for 1 second, only affects gameplay entities), 35-particle explosion, red flash, camera zoom toward center (z offset -2 over 0.8s).
- Clean reset: All effects (camera position, slow-mo, particles, trails, muzzle flashes, zoom) properly cleaned up on restart.
Files modified
src/core/Constants.js— added EFFECTS objectsrc/core/Game.js— integrated EffectsSystem (construction, entrance trigger, animate loop with slow-mo + trail updates, reset on restart)src/systems/EffectsSystem.js— new file (full effects system)
Architecture notes
- EffectsSystem uses raw delta for its own animations (particles always smooth) but provides
getDeltaMultiplier()for gameplay slow-mo - All 3D particles use THREE.Points with BufferGeometry for GPU efficiency, additive blending, and proper disposal
- HTML overlays used for screen flash and text (more reliable than post-processing, no shader overhead)
- Particle bursts capped at 40 per burst for mobile performance
- All geometries and materials disposed when particles expire
Related
- 3D Asset TestTemplate
3D Asset Test — a Three.js starter mirrored from OpusGameLabs/game-creator.
- Castle SiegeTemplate
Castle Siege — a Three.js starter mirrored from OpusGameLabs/game-creator.
- Crowd DashTemplate
Crowd Dash — a Three.js starter mirrored from OpusGameLabs/game-creator.
- Flappy Bird 3DTemplate
Flappy Bird 3D — a Three.js starter mirrored from OpusGameLabs/game-creator.