Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEFORM: Dynamic Environmental and Formative Response Mechanism for Real-Time Terrain Simulation #76

Open
erematorg opened this issue Sep 8, 2024 · 4 comments
Assignees
Labels
environment feature independent Issues that can be worked on without needing other issues to be resolved.
Milestone

Comments

@erematorg
Copy link
Owner

erematorg commented Sep 8, 2024

Problem Description

The current terrain simulation systems do not provide a sufficiently realistic, scalable, and dynamic response to both player interactions and environmental phenomena in 2D open-world games. Many existing systems are either player-centric or lack the depth to simulate complex terrain interactions such as erosion, material blending, and large-scale geological events.

For a systemic ecosystem game, there is a need for terrain to evolve naturally over time, driven by forces like erosion, landslides, and pressure, while also interacting dynamically with player actions. The goal is to create a "living" terrain where solid materials like sand, dirt, and rock deform, compact, fracture, and shift realistically, without overwhelming system performance.

Proposed Solution

DEFORM (Dynamic Environmental and Formative Response Mechanism) is a hybrid simulation system designed to address the need for real-time terrain evolution based on both player interactions and environmental forces.

Key features of the solution:

  1. Hybrid DEM & FEM Logic (slashed for now, pending PBD implementation):
  • Use DEM (Discrete Element Method) for granular materials (sand, dirt, gravel) to simulate flow, compaction, and erosion.

  • Use FEM (Finite Element Method) for solid materials (rock, clay) to simulate cracks, fractures, and deformation under pressure.

  • Use PBD (Position Based Dynamics) to simulate realistic terrain responses like compression and bending efficiently. PBD provides stable, real-time deformations for both granular and solid materials, bridging DEM and FEM principles for future expansion.

  1. Environmental Forces:
  • Natural events such as erosion, landslides, and rock fractures dynamically reshape the terrain.
  • Terrain responds to weight and pressure, deforming in real time based on natural phenomena.
  1. Player Interaction:
  • Players can influence terrain deformation through digging, constructing, or applying pressure to certain areas. Interaction scales based on the action's magnitude, with minor actions like footsteps having minimal impact, while larger actions like explosions or structures cause significant deformation.
  1. Dormant Values & Chunk-Based Updates:
  • Inactive terrain regions are placed in a dormant state to reduce computational overhead. Only regions affected by events or player interactions are recalculated to ensure real-time performance.
  • Chunk-based, event-driven updates for large-scale world simulation, improving efficiency in dynamic environments.

Alternatives Considered

  • Rule-Based Systems (e.g., cellular automata): Considered for simplicity but rejected due to limited scalability and lack of flexibility in simulating diverse material behaviors.
  • Pre-Calculated Erosion Patterns: Could simplify the system, but would reduce the realism of terrain evolution, as pre-calculated patterns may not accurately reflect player interactions or unpredictable environmental forces.
  • Particle-Based Terrain Systems: While particle systems provide detailed simulations, they are often too computationally expensive for large, real-time, open-world simulations and don't integrate easily with other systemic game mechanics.

Additional Context

The terrain simulation system is intended to be a key feature in a 2D open-world ecosystem game, where the world evolves naturally, driven by both environmental and player-driven phenomena.
This system will also integrate with other core systems like SPH fluid dynamics for water simulation and L-System vegetation growth to create a rich, immersive ecosystem where every element influences the others.

The goal is to maintain an high level of realism while ensuring that performance is optimized for real-time simulation in large, open-world environments. The system should provide a modular, scalable foundation for future expansions, such as adding complex interactions between terrains, fluids (SPH), and vegetation systems (L-System).

@erematorg erematorg added feature independent Issues that can be worked on without needing other issues to be resolved. environment labels Sep 8, 2024
@erematorg erematorg added this to the 0.1 milestone Sep 8, 2024
@M1thieu M1thieu self-assigned this Sep 16, 2024
@M1thieu
Copy link
Collaborator

M1thieu commented Sep 16, 2024

I'm slowly working on it, for now prototyping with Pygame however it seems a bit hard to handle, I will try my best this week to perform this system further and making it a reality inside Godot, I'm focusing merely on Finite Element Method rather than Discret Element Method for now
FEM Graphic

@erematorg
Copy link
Owner Author

After some considerations for simplicity it might be better to go for Position Based Dynamics to start with as this woud be much easier to implement and shares principles with DEM & FEM as well making expansion later affordable.

@M1thieu
Copy link
Collaborator

M1thieu commented Dec 9, 2024

Small update again I went for PBD instead to start, there's still a lot to do, however I think it's going in the right direction rough idea below with the particles being even mixed with DEM as well.
DEFORM will takes FORM (pun intended) before Christmas that's promised.

20241209-2034-30 9357499-ezgif com-video-to-gif-converter

@M1thieu M1thieu closed this as completed Dec 9, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in LP MVP Roadmap Dec 9, 2024
@M1thieu M1thieu reopened this Dec 9, 2024
@M1thieu
Copy link
Collaborator

M1thieu commented Dec 9, 2024

Missclicked on the close with comment oops! A bit too soon to be able to finish such a system

@M1thieu M1thieu removed the status in LP MVP Roadmap Dec 9, 2024
@M1thieu M1thieu moved this to Todo in LP MVP Roadmap Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
environment feature independent Issues that can be worked on without needing other issues to be resolved.
Projects
Status: Todo
Development

No branches or pull requests

2 participants