Jump to content

LUMINSim Documentation: Difference between revisions

From Aurora Robotics
No edit summary
No edit summary
Line 3: Line 3:


Going forward, I hope to add:
Going forward, I hope to add:
* A list of the non-default classes/nodes this project declares.
* A list of the non-default classes/nodes this project declares.
* In-depth descriptions of the inner workings of each major system, including:
* In-depth descriptions of the inner workings of each major system, including:
Line 15: Line 14:


== Getting Started ==
== Getting Started ==
To learn how to get started with development yourself, [https://github.com/AuroraRoboticsLab/GodotRobot/blob/main/README.md visit the repository's README] and follow the steps there to get the project set up.  
To learn how to get started with development yourself, [https://github.com/AuroraRoboticsLab/GodotRobot/blob/main/README.md visit the repository's README] and follow the steps there to get the project set up.


== Repository Structure ==
== Repository Structure ==
* '''<code>src/</code>''' – C++ GDExtension code for terrain and registration. Likely to be deprecated. See [[LUMINSim Documentation#Terrain System (C++)|Terrain System (C++)]].
* '''<code>src/</code>''' – C++ GDExtension code for terrain and registration. Likely to be deprecated. See [[LUMINSim Documentation#Terrain System (C++)|Terrain System (C++)]].
* '''<code>demo/</code>''' – Godot project containing levels, assets, and GDScript systems.
* '''<code>demo/</code>''' – Godot project containing levels, assets, and GDScript systems.
** '''<code>export_presets.cfg</code>''' – Information for Godot on how to export the project into platform-native forms. Created automatically by the Godot export menu.
** '''<code>export_presets.cfg</code>''' – Information for Godot on how to export the project into platform-native forms. Created automatically by the Godot export menu.
** '''<code>game_manager.gd</code>''' – Handles the majority of the multiplayer logic, especially the sending of data between the clients and the server. See [[LUMINSim Documentation#Networking and Multiplayer|Networking and Multiplayer]].
** '''<code>game_manager.gd</code>''' – Handles the majority of the multiplayer logic, especially the sending of data between the clients and the server. See [[LUMINSim Documentation#Networking and Multiplayer|Networking and Multiplayer]].
** '''<code>project.godot</code>''' – The main project file. Contains general project configurations and properties. This is the primary reference point for the Godot Engine when developing this project.
** '''<code>project.godot</code>''' – The main project file. Contains general project configurations and properties. This is the primary reference point for the Godot Engine when developing this project.
** '''<code>demo/astra</code>''' – Files pertaining to the drivable [[LAMP v1|Astra]] robot. See [[LUMINSim Documentation#Astra Robot|Astra Robot]].
** '''<code>demo/astra</code>''' – Files pertaining to the drivable [[LUMINSim Documentation#Astra Robot|Astra]] robot.
** '''<code>demo/astronaut</code>''' – Files pertaining to the in-game, procedurally-animated astronaut character. See [[LUMINSim Documentation#Astronaut Character|Astronaut Character]].
** '''<code>demo/astronaut</code>''' – Files pertaining to the in-game, procedurally-animated astronaut character. See [[LUMINSim Documentation#Astronaut Character|Astronaut Character]].
** '''<code>demo/bin</code>''' – Files pertaining to the compiled GDExtension binaries. Likely to be deprecated. See [[LUMINSim Documentation#Terrain System (C++)|Terrain System (C++)]].
** '''<code>demo/bin</code>''' – Files pertaining to the compiled GDExtension binaries. Likely to be deprecated. See [[LUMINSim Documentation#Terrain System (C++)|Terrain System (C++)]].
** '''<code>demo/components</code>''' – Contains components or component-like scenes and related files. See Components.
** '''<code>demo/components</code>''' – Contains components or component-like scenes and related files. See [[LUMINSim Documentation#Classes|Classes]].
** '''<code>demo/environment</code>''' – Files for the skybox (i.e., the stars in the sky).  
** '''<code>demo/environment</code>''' – Files for the skybox (i.e., the stars in the sky).
** '''<code>demo/excahauler</code>''' – Files pertaining to the drivable [[Excahauler]] robot. See [[LUMINSim Documentation#Excahauler Robot|Excahauler Robot]].
** '''<code>demo/excahauler</code>''' – Files pertaining to the drivable [[LUMINSim Documentation#Excahauler Robot|Excahauler]] robot.
** '''<code>demo/graphics</code>''' – Contains many images for icons and textures, especially for the user interface. See [[LUMINSim Documentation#User Interface|User Interface]].
** '''<code>demo/graphics</code>''' – Contains many images for icons and textures, especially for the user interface. See [[LUMINSim Documentation#User Interface|User Interface]].
** '''<code>demo/landers</code>''' – Contains directories for different lunar landers. Landers are currently just static models.
** '''<code>demo/landers</code>''' – Contains directories for different lunar landers. Landers are currently just static models.
** '''<code>demo/excahauler</code>''' – Files pertaining to the drivable [[Excahauler]] robot. See [[LUMINSim Documentation#Excahauler Robot|Excahauler Robot]].
** '''<code>demo/levels</code>''' – Contains the main playable (i.e., non-UI) scenes and related files. See [[LUMINSim Documentation#Levels|Levels]].
** '''<code>demo/levels</code>''' – Contains the main playable (i.e., non-UI) scenes and related files. See [[LUMINSim Documentation#Levels|Levels]].
** '''<code>demo/objects</code>''' – Contains non-static (i.e., movable RigidBody3D) objects. See [[LUMINSim Documentation#Objects|Objects]].
** '''<code>demo/objects</code>''' – Contains non-static (i.e., movable RigidBody3D) objects. See [[LUMINSim Documentation#Objects|Objects]].
** '''<code>demo/static_objects</code>''' – Contains static (i.e., unmovable StaticBody3D) objects and their related code. See [[LUMINSim Documentation#Static Objects|Static Objects]].
** '''<code>demo/static_objects</code>''' – Contains static (i.e., unmovable StaticBody3D) objects and their related code. See [[LUMINSim Documentation#Static Objects|Static Objects]].
** '''<code>demo/terrain</code>''' – Scenes and files pertaining to the ''dynamic'' (i.e., mineable) terrain. See [[LUMINSim Documentation#Terrain System (C++)|Terrain System (C++)]].
** '''<code>demo/terrain</code>''' – Scenes and files pertaining to the dynamic (i.e., mineable) terrain. See [[LUMINSim Documentation#Terrain System (C++)|Terrain System (C++)]].
** '''<code>demo/terrain_fixed</code>''' – Scenes and files pertaining to the ''static'' (i.e., unchanging) terrain. See [[LUMINSim Documentation#Terrain System (C++)|Terrain System (C++)]].
** '''<code>demo/terrain_fixed</code>''' – Scenes and files pertaining to the static (i.e., unchanging) terrain. See [[LUMINSim Documentation#Terrain System (C++)|Terrain System (C++)]].
** '''<code>demo/util</code>''' – Scenes and files pertaining to UI as well as other useful scripts. See [[LUMINSim Documentation#User Interface|User Interface]] and [[LUMINSim Documentation#Additional Utilities|Additional Utilities]].
** '''<code>demo/util</code>''' – Scenes and files pertaining to UI as well as other useful scripts. See [[LUMINSim Documentation#User Interface|User Interface]] and [[LUMINSim Documentation#Additional Utilities|Additional Utilities]].
In-depth repository structure documentation (brief descriptions on a per-scene basis) may be created here by anyone.
In-depth repository structure documentation (brief descriptions on a per-scene basis) may be created here by anyone.
== Classes ==
The following scripts register custom nodes with `class_name`:
* <code>ToolCouplerComponent.gd</code> → '''ToolCoupler''' – manages attaching tools to a robot via physics joints.
* <code>connector_component.gd</code> → '''Connector''' – area detector used by tool couplers and charge stations.
* <code>autonomy_component.gd</code> → '''AutonomyComponent''' – simple navigation helper for NPC robots.
* <code>charge_component.gd</code> → '''ChargeComponent''' – tracks battery state and handles charging/discharging.
* <code>better_hinge_joint_3d.gd</code> → '''BetterHingeJoint3D''' – wrapper over <code>Generic6DOFJoint3D</code> for motorized joints.
* <code>tool_attachment.gd</code> → '''ToolAttachment''' – base class for all detachable tools.
* <code>forks.gd</code> → '''Forks''' – tool attachment for moving objects.
* <code>bucket_attachment.gd</code> → '''Bucket''' – digs into terrain to collect dirtballs.
* <code>saw_blade_attachment.gd</code> → '''SawBlade''' – spinning blade for cutting objects.
* <code>dem_loader.gd</code> → '''DemLoader''' – loads fixed DEM heightmaps and extends <code>TerrainStatic256</code>.
These classes are referenced throughout the systems described below.


== Terrain System (C++) ==
== Terrain System (C++) ==
C++ based GDExtensions are likely to be replaced with a more developer-friendly system, likely one that downloads terrain from a separate server that handles all terrain logic.
C++ based GDExtensions currently provide the terrain implementation and may be replaced in the future with a more developer-friendly system.


=== Static Terrain ===
=== Static Terrain ===
<code>TerrainStatic256</code> loads heightmaps, creates render and collision geometry.
<code>TerrainStatic256</code> loads heightmaps and generates render and collision meshes.


=== Dynamic Terrain ===
=== Dynamic Terrain ===
<code>TerrainSim</code> simulates excavation, landslides, and merging dirtballs back into the heightmap.
<code>TerrainSim</code> extends <code>TerrainStatic256</code> to simulate excavation, landslides, and merging dirtballs back into the heightmap.


== Terrain Tools ==
=== Terrain Tools ===
Scripts such as <code>dirt_spawner.gd</code> and <code>dirtball.gd</code> spawn and merge mobile particles with the dynamic terrain.
Scripts such as <code>dirt_spawner.gd</code> and <code>dirtball.gd</code> spawn and merge mobile particles with the dynamic terrain.
== Power System ==
Movable vehicles include a '''ChargeComponent''' that stores amp-hours and battery percentage. Robots consume charge while driving or actuating, and static objects like charge stations or solar panels provide power when connected.
== Tools and Attachments ==
All interchangeable implements derive from '''ToolAttachment'''. Robot arms have '''ToolCoupler''' nodes that detect nearby '''Connector''' areas and create physics joints to attach or detach tools. Available tools include the Bucket, Forks, and SawBlade. <code>tool_spawner.gd</code> respawns tools removed from its bays.


== Robot Systems ==
== Robot Systems ==
=== Astra Robot ===
=== Astra Robot ===
The primary scene file is <code>astra_3d.tscn</code>. <code>astra_3d.gd</code> handles driving and energy usage, as well as tool attachment. Works with <code>astra_arm_3d.gd</code> and <code>astra_hopper_3d.gd</code> for arm/hopper actuation. See [[LUMINSim Documentation#Arm and Hopper|Arm and Hopper]].
The main rover scene is <code>astra_3d.tscn</code>. <code>astra_3d.gd</code> handles driving, energy usage, and tool attachment. It works with <code>astra_arm_3d.gd</code> and <code>astra_hopper_3d.gd</code> for the arm and hopper.


=== Arm and Hopper ===
=== Arm and Hopper ===
Separate nodes controlled by <code>astra_arm_3d.gd</code> and <code>astra_hopper_3d.gd</code> for the arm and hopper implement joint movement.  
Separate nodes controlled by <code>astra_arm_3d.gd</code> and <code>astra_hopper_3d.gd</code> implement joint movement.


=== Astronaut Character ===
=== Astronaut Character ===
<code>astronaut_character_3d.gd</code> provides walking and camera control for a procedurally (i.e., code-driven) animated astronaut player avatar.
<code>astronaut_character_3d.gd</code> provides walking and camera control for a procedurally animated astronaut.


=== Excavation Tools ===
=== Excavation Tools ===
Attachments such as the bucket, forks, and saw blade extend the node class <code>ToolAttachment</code> for various tasks.
Attachments such as the bucket, forks, and saw blade extend '''ToolAttachment''' for various tasks.


=== Excahauler Robot ===
=== Excahauler Robot ===
WIP.
Work in progress.


== Objects ==
== Objects ==
Line 78: Line 93:


== Networking and Multiplayer ==
== Networking and Multiplayer ==
<code>GameManager.gd</code> manages synchronized player/object data and signals for network updates.
<code>game_manager.gd</code> manages synchronized player/object data and signals for network updates. <code>multiplayer_menu.gd</code> lets players host or join games, start sessions, and handle disconnects.
 
<code>multiplayer_menu.gd</code> lets players host or join games, start sessions, and handle disconnects.


== User Interface ==
== User Interface ==
WIP.
The <code>ui.gd</code>, <code>joystick.gd</code>, and <code>keybinds_menu.gd</code> scripts provide HUD elements, customizable input bindings, and optional on-screen controls for mobile users.


== Cameras and Controls ==
== Cameras and Controls ==
<code>movable_camera_3d.gd</code> and <code>freecam.gd</code> implement user-controlled cameras, both first- and third‑person.
<code>movable_camera_3d.gd</code> and <code>freecam.gd</code> implement user-controlled cameras, both first- and third-person.
 
The user interface (<code>ui.gd</code>, <code>joystick.gd</code>, <code>keybinds_menu.gd</code>) provides HUD elements, customizable input bindings, and optional on-screen controls for mobile users.


== Levels ==
== Levels ==
Scenes in <code>demo/levels/</code> (e.g., <code>main3D.tscn</code> with script <code>main3D.gd</code>) instantiate players, objects, and the terrain simulator, driving the overall game loop.
Scenes in <code>demo/levels/</code> (e.g., <code>main3D.tscn</code> with script <code>main3D.gd</code>) instantiate players, objects, and the terrain simulator, driving the overall game loop.
== Independent Scenes ==
Several standalone scenes provide gameplay utilities:
* <code>brick_maker.gd</code> – creates bricks when filled with loose dirt.
* <code>tool_spawner.gd</code> – keeps bays stocked by respawning attachments.
* <code>dirt_spawner.gd</code> – continuously emits dirtballs for terrain testing.


== Additional Utilities ==
== Additional Utilities ==
Miscellaneous scripts such as <code>fps_counter.gd</code> and <code>multiplayer_menu.gd</code> assist with debugging and multiplayer session management.
Miscellaneous helpers include <code>fps_counter.gd</code> for performance output and <code>freecam.tscn</code> which can be spawned via the command console for debugging or spectator play.
 
== Future Work ==
The repository is under active development. Planned areas of documentation include deeper explanations of the power system, tool workflow, and multiplayer networking. Contributions are welcome.

Revision as of 16:59, 7 July 2025

LUMINSim Documentation

This is an ongoing page as I (Andrew Mattson) document LUMINSim's current systems. This page is a major work in progress; feel free to add to it!

Going forward, I hope to add:

  • A list of the non-default classes/nodes this project declares.
  • In-depth descriptions of the inner workings of each major system, including:
    • Power
    • Tools and tool swapping
    • Terrain
    • Multiplayer
    • Each user-controlled scene (robots and astronaut)
    • The UI (multiplayer menu, settings menu, keybind menu)
    • Each (largely) independent scene and corresponding system(s) (brick maker, dirt spawner, tool spawner, etc.)

Getting Started

To learn how to get started with development yourself, visit the repository's README and follow the steps there to get the project set up.

Repository Structure

  • src/ – C++ GDExtension code for terrain and registration. Likely to be deprecated. See Terrain System (C++).
  • demo/ – Godot project containing levels, assets, and GDScript systems.
    • export_presets.cfg – Information for Godot on how to export the project into platform-native forms. Created automatically by the Godot export menu.
    • game_manager.gd – Handles the majority of the multiplayer logic, especially the sending of data between the clients and the server. See Networking and Multiplayer.
    • project.godot – The main project file. Contains general project configurations and properties. This is the primary reference point for the Godot Engine when developing this project.
    • demo/astra – Files pertaining to the drivable Astra robot.
    • demo/astronaut – Files pertaining to the in-game, procedurally-animated astronaut character. See Astronaut Character.
    • demo/bin – Files pertaining to the compiled GDExtension binaries. Likely to be deprecated. See Terrain System (C++).
    • demo/components – Contains components or component-like scenes and related files. See Classes.
    • demo/environment – Files for the skybox (i.e., the stars in the sky).
    • demo/excahauler – Files pertaining to the drivable Excahauler robot.
    • demo/graphics – Contains many images for icons and textures, especially for the user interface. See User Interface.
    • demo/landers – Contains directories for different lunar landers. Landers are currently just static models.
    • demo/levels – Contains the main playable (i.e., non-UI) scenes and related files. See Levels.
    • demo/objects – Contains non-static (i.e., movable RigidBody3D) objects. See Objects.
    • demo/static_objects – Contains static (i.e., unmovable StaticBody3D) objects and their related code. See Static Objects.
    • demo/terrain – Scenes and files pertaining to the dynamic (i.e., mineable) terrain. See Terrain System (C++).
    • demo/terrain_fixed – Scenes and files pertaining to the static (i.e., unchanging) terrain. See Terrain System (C++).
    • demo/util – Scenes and files pertaining to UI as well as other useful scripts. See User Interface and Additional Utilities.

In-depth repository structure documentation (brief descriptions on a per-scene basis) may be created here by anyone.

Classes

The following scripts register custom nodes with `class_name`:

  • ToolCouplerComponent.gdToolCoupler – manages attaching tools to a robot via physics joints.
  • connector_component.gdConnector – area detector used by tool couplers and charge stations.
  • autonomy_component.gdAutonomyComponent – simple navigation helper for NPC robots.
  • charge_component.gdChargeComponent – tracks battery state and handles charging/discharging.
  • better_hinge_joint_3d.gdBetterHingeJoint3D – wrapper over Generic6DOFJoint3D for motorized joints.
  • tool_attachment.gdToolAttachment – base class for all detachable tools.
  • forks.gdForks – tool attachment for moving objects.
  • bucket_attachment.gdBucket – digs into terrain to collect dirtballs.
  • saw_blade_attachment.gdSawBlade – spinning blade for cutting objects.
  • dem_loader.gdDemLoader – loads fixed DEM heightmaps and extends TerrainStatic256.

These classes are referenced throughout the systems described below.

Terrain System (C++)

C++ based GDExtensions currently provide the terrain implementation and may be replaced in the future with a more developer-friendly system.

Static Terrain

TerrainStatic256 loads heightmaps and generates render and collision meshes.

Dynamic Terrain

TerrainSim extends TerrainStatic256 to simulate excavation, landslides, and merging dirtballs back into the heightmap.

Terrain Tools

Scripts such as dirt_spawner.gd and dirtball.gd spawn and merge mobile particles with the dynamic terrain.

Power System

Movable vehicles include a ChargeComponent that stores amp-hours and battery percentage. Robots consume charge while driving or actuating, and static objects like charge stations or solar panels provide power when connected.

Tools and Attachments

All interchangeable implements derive from ToolAttachment. Robot arms have ToolCoupler nodes that detect nearby Connector areas and create physics joints to attach or detach tools. Available tools include the Bucket, Forks, and SawBlade. tool_spawner.gd respawns tools removed from its bays.

Robot Systems

Astra Robot

The main rover scene is astra_3d.tscn. astra_3d.gd handles driving, energy usage, and tool attachment. It works with astra_arm_3d.gd and astra_hopper_3d.gd for the arm and hopper.

Arm and Hopper

Separate nodes controlled by astra_arm_3d.gd and astra_hopper_3d.gd implement joint movement.

Astronaut Character

astronaut_character_3d.gd provides walking and camera control for a procedurally animated astronaut.

Excavation Tools

Attachments such as the bucket, forks, and saw blade extend ToolAttachment for various tasks.

Excahauler Robot

Work in progress.

Objects

WIP.

Static Objects

Charge stations, solar panels, tool spawners, and other environment pieces provide energy or spawn tools.

Networking and Multiplayer

game_manager.gd manages synchronized player/object data and signals for network updates. multiplayer_menu.gd lets players host or join games, start sessions, and handle disconnects.

User Interface

The ui.gd, joystick.gd, and keybinds_menu.gd scripts provide HUD elements, customizable input bindings, and optional on-screen controls for mobile users.

Cameras and Controls

movable_camera_3d.gd and freecam.gd implement user-controlled cameras, both first- and third-person.

Levels

Scenes in demo/levels/ (e.g., main3D.tscn with script main3D.gd) instantiate players, objects, and the terrain simulator, driving the overall game loop.

Independent Scenes

Several standalone scenes provide gameplay utilities:

  • brick_maker.gd – creates bricks when filled with loose dirt.
  • tool_spawner.gd – keeps bays stocked by respawning attachments.
  • dirt_spawner.gd – continuously emits dirtballs for terrain testing.

Additional Utilities

Miscellaneous helpers include fps_counter.gd for performance output and freecam.tscn which can be spawned via the command console for debugging or spectator play.

Future Work

The repository is under active development. Planned areas of documentation include deeper explanations of the power system, tool workflow, and multiplayer networking. Contributions are welcome.