sholloway / agents-playground

MIT License
4 stars 0 forks source link

Simulation Landscape #124

Closed sholloway closed 7 months ago

sholloway commented 8 months ago

A simulation can have a landscape. A landscape serves the purpose of providing a "ground" surface for agents to traverse.

Landscape Characteristics.

Tile Characteristics

Code Definition

@dataclass
class Landscape:
  """
  A static landscape could have it's own static spatial data structure for physics and path finding.
  """
  gravity: Newton
  tiles: Dict[Id, Tile]

@dataclass
class Tile:
  """
  Tiles should be immutable. 
  """
  id: Id                           # The unique identifier for this tile.
  material_id: Id           # Refers to which material or texture should be applied?
  vertices: List[Point]  # The list of points that define the shape of the tile.
  sides: int                   # number of sides this tile has. len(vertices)/2.

Landscape Builder

A GUI tool that aids in the landscape creation.

Area Feature Considerations
File Management New Landscape Launch from main menu.
File Management Edit Landscape Launch from main menu.
Format Landscape File Format Need a grammar and a parser.
Editing Interactive Camera
Editing Ambient Lightning Shouldn't have to worry about lightning in the landscape editor.
Tiling Add Tile I'm thinking a of having a Tile Toolbar with toggle buttons. Add Square, Add Hex...
Tiling Delete Tile Need to ability to select a tile then do actions. Perhaps a right click context menu.

General Tiling Considerations

Square Tile Considerations

Hexagon Considerations and Resources

Landscape File Related Tasks

Rendering Landscape Tasks

Tessallation Considerations

Scene Tasks

sholloway commented 7 months ago

Reusable Landscapes and Rapid Prototyping

I want Simulation scene files to reference a Landscape file. This is for the following reasons.

JSON Landscape Files

TOML has proven to not be great for storing geometry information. I will leverage JSON for storing Landscape files for the following reasons.

The general process for loading a scene with a landscape file should be:

I want a progress loader that shows me an overall progress bar and that displays a message on what step we're on.

  1. Parse the scene.toml file. If it has a reference for a landscape file, then proceed. Otherwise continue on with the scene parsing.
  2. Load the JSON Schema.
  3. Validate the Landscape File. If it is invalid display the error and stop. Don't crash the app.
  4. If the landscape is valid, then parse the JSON into the intermediate format.
  5. Tesselate the Landscape into a Triangle Mesh.
  6. For the Triangle Mesh calculate face and vertex normals.
  7. Continue on with the scene.