How priyanshu792/idle-viewport-game works
Purpose and runtime
This is a Godot idle/viewport combat game. Godot project metadata and the configured startup scene are in project.godot; gameplay is assembled from .tscn scenes and GDScript, with resource-based unit, weapon, and upgrade definitions. No server or web runtime is evident.
Entry and scene composition
The application begins through Godot’s project entry configuration, then transitions between menu, gameplay, settings, and UI scene roots. The main gameplay composition appears centered on scene/main.tscn, driven by script/main.gd; menu flow uses scene/main_menu.tscn and script/main_menu.gd. The player, enemy, spawner, and shared UI are separately instanced scenes: scene/player.tscn, scene/enemy.tscn, scene/spawner.tscn.
Global coordination
Autoload-style global managers provide cross-scene control boundaries: event dispatch in globals/game_events.gd, level/progression coordination in globals/level_manager.gd, and window/UI visibility management in globals/windows_manager.gd. Gameplay systems should communicate through these globals or scene signals rather than tightly coupling projectile, UI, and level nodes.
Combat loop
The player and enemy actors drive the core loop: spawning enemies, targeting/firing weapons, applying damage, resolving health, and producing rewards/effects. Key implementations are script/player.gd, script/enemy.gd, script/spawner.gd, with reusable combat primitives in script/damage.gd, script/damage_calculator.gd, and script/health.gd. Enemies can drop collectible currency via scene/dropped_orb.tscn and script/dropped_orb.gd.
Weapon and projectile families
Weapons are implemented as independently instanced projectile scenes, allowing unlocks and upgrades to alter distinct behaviors. Families include base projectile (projectiles/projectile1/projectile.tscn), laser (projectiles/Laser/laser_projectile.tscn), multi-hit, orbital, spread-fire, and nuclear blast variants. Their scripts encapsulate movement/hit behavior, while visual effects use Godot shaders such as assets/shaders/laser_projectile.gdshader.
Data-driven stats and progression
Baseline actor and weapon values are Godot resources: resources/Base_Player_stats.tres, resources/Base_Enemy_stats.tres, and resources/Base_Weapon_stats.tres, backed by stat/resource scripts including resources/weapons_stat.gd. Individual upgrades are serialized .tres definitions under resources/upgrades/, including unlock, damage, speed, interval, radius, and target-count changes. This separates balancing data from runtime combat code.
Upgrade-tree and UI boundary
Upgrade selection is a dedicated scene subsystem: upgrades/upgrade_tree.tscn, upgrades/upgrade_tree.gd, and upgrades/upgrade_tree_node.gd. It consumes upgrade resource definitions and presents them through gameplay UI logic in script/upgrade_ui.gd and scene/ui.tscn / script/ui.gd. Settings are similarly isolated in scene/settings.tscn and script/settings.gd.
Tooling and external integrations
A custom editor CSV importer exists in addons/csv_importer/csv_importer.gd, with source spreadsheet/CSV content under csv_s/; it likely supports authoring/import of tabular upgrade or game data. The repository also vendors the Godot Git editor plugin under addons/godot-git-plugin/. These are editor integrations, not gameplay services.
Main entry points: project.godot Project Entry · main.tscn Gameplay Root · enemy.tscn Enemy · player.tscn Player
Components 19
Godot Runtime
- Project Entry · Configures startup scene and autoloads.
project.godot - Main Menu
scene/main_menu.tscn - Gameplay Root · Composes the active combat session.
scene/main.tscn - Settings
scene/settings.tscn - Game Events
globals/game_events.gd - Level Manager
globals/level_manager.gd - Windows Manager
globals/windows_manager.gd
Combat Systems
- Player
scene/player.tscn - Enemy Spawner
scene/spawner.tscn - Enemy
scene/enemy.tscn - Damage & Health · Calculates damage and resolves health changes.
script/damage_calculator.gd - Weapon Projectiles · Independent weapon behaviors for firing, movement, and hits.
projectiles/projectile1/projectile.tscn - Dropped Orb
scene/dropped_orb.tscn
Game Data & UI
- Base Stats · Baseline player, enemy, and weapon values.
resources/Base_Player_stats.tres - Upgrade Definitions · Defines unlock and stat-modifier choices.
- Upgrade Tree
upgrades/upgrade_tree.tscn - Gameplay UI
scene/ui.tscn
Editor Tooling
- CSV Importer · Imports tabular authoring data.
addons/csv_importer/csv_importer.gd - Godot Git Plugin
Connections 24
- Project Entry → Main Menu: starts
- Main Menu → Gameplay Root: begins game
- Project Entry → Game Events: autoloads
- Project Entry → Level Manager: autoloads
- Project Entry → Windows Manager: autoloads
- Main Menu → Settings: opens
- Gameplay Root → Player: instances
- Gameplay Root → Enemy Spawner: instances
- Gameplay Root → Gameplay UI: instances
- Enemy Spawner → Enemy: spawns
- Player → Weapon Projectiles: fires
- Weapon Projectiles → Damage & Health: applies damage
- Enemy → Damage & Health: uses health
- Enemy → Dropped Orb: drops on defeat
- Base Stats → Player: configures
- Base Stats → Enemy: configures
- Base Stats → Weapon Projectiles: configures
- Upgrade Definitions → Upgrade Tree: populates
- Upgrade Tree → Gameplay UI: presents through
- Upgrade Definitions → Player: modifies unlocks and stats
- Level Manager → Upgrade Tree: coordinates progression
- Game Events → Gameplay UI: notifies
- Windows Manager → Gameplay UI: controls visibility
- CSV Importer → Upgrade Definitions: imports authoring data