Skip to content

SimBoi/Gravity-Automata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gravity-Automata

Overview

Gravity-Automata simulates water flow and extraction in dynamic 2D and 3D environment grids. The project aims to accurately model water behavior under various gravity directions and visualize it using the marching cubes algorithm. It also features an AI agent optimized for the water extraction process, employing a modified Monte Carlo Tree Search (MCTS) algorithm. For an in-depth explanation of the project's development, refer to the project report.

Features

  • 2D and 3D Water Simulation: Simulate and visualize water flow and extraction in both 2D and 3D grids.
  • Dynamic Gravity Handling: Model water behavior under different gravity directions.
  • Water Compression Physics: Implements realistic water compression, where cells balance water volumes horizontally and excess water flows upwards to simulate natural water behavior.
  • Marching Cubes Visualization: Render realistic 3D representations of the water simulation.
  • Custom Model Import: Import and use your own 3D models (.obj format) to define simulation barriers.
  • Multithreading Support: Optimize simulation performance with parallel processing.
  • AI Optimization: Utilize a modified MCTS algorithm for optimizing water extraction processes.
  • User Interface: Interactive UI for model import, environment configuration, and simulation control.

Installation

  1. Download the Latest Executable

    • Visit the Releases page to download the latest version of the executable.
  2. Run the Simulator

    • Execute GravityAutomata.exe to start the simulation.

Usage

  1. Import OBJ Model: Upload your 3D model in .obj format.
  2. Configure Environment: Select the imported model to configure its position, rotation, and scale. Set the grid size, simulation steps per second, and other parameters.
  3. Control Simulation: Choose to manually rotate the grid or let the AI determine the optimal rotation. Press <space> to stop the AI at any time; the longer the AI runs, the better the solution is likely to be.

2D Demo

The 2D demo provides an easy way to explore the simulation and AI functionalities without needing custom models. It includes pre-configured grids for quick testing:

  1. Access the Demo: Navigate to the Releases page to download the demo version.
  2. Try Pre-Configured Grids: Experiment with different pre-configured grids to see how the simulation behaves and how the AI performs.

Building an Executable

To build an executable for Gravity-Automata in Unity, follow these steps:

  1. Open the Unity Project

    • Download the source code project files.
    • Launch Unity and open the Gravity-Automata project.
  2. Configure Build Settings

    • Go to File > Build Settings.
    • Select the target platform (e.g., Windows, macOS, Linux).
  3. Build the Executable

    • Click Build and select a target folder to save the executable.
    • Unity will compile and generate the necessary files.
  4. Run the Executable

    • Navigate to the build folder and run GravityAutomata.exe (or equivalent for your OS).

Notes

  • Ensure that the 3D model you import is a closed shape to ensure proper functionality of the scanline algorithm for barrier approximation.
  • The simulation performance may vary based on the grid size and other parameters.
  • For detailed documentation and technical insights, refer to the project report.

About

2D/3D water simulation with variable gravity direction, simulated using cellular automata and rendered using marching cubes, AI to optimize water extraction using a modified MCTS agent.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors