Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Lazy evaluation of a continuous field of signals #600

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Commits on Mar 24, 2023

  1. Configuration menu
    Copy the full SHA
    9823d9f View commit details
    Browse the repository at this point in the history
  2. Use the same approach as tile selection to display signals

    I'm not really pleased with the fact I had to disable the
    `display_tile_overlay` system when using the signal overlay but this
    can be cleanup later.
    
    Color scheme has been updated to look better with the new terrain and
    shadows, and the overlay material has been made transparent a bit.
    Austreelis committed Mar 24, 2023
    Configuration menu
    Copy the full SHA
    883319e View commit details
    Browse the repository at this point in the history
  3. Implement lazy evaluation of a continuous field for signal diffusion

    This only takes into account sources for now. This means that it only
    reaches part of the goal set in Leafwing-Studios#511:
    
    1. It only tracks signal emitters.
    2. It does determine an equation for each emitter. The equation simply
      is the solution of the diffusion equation for that emitter:
      `1/(1+D*t) * 1/sqrt(4*pi*k*t) * exp(d^2 / (4*k*t))`
      where:
      - `D` is a decay rate constant, and `1/(1+D*t)` is a decay term.
      - `k` is a diffusivity constant.
      - `d` is the distance between the emitter and a tile.
      - `t` is the time elapsed since the signal was emitted.
    3. Contributions of each emitter are then integrated to compute the
      actual field value. This works because of the linearity of this subset
      of the problem, but may not hold when tackling e.g. barriers or signal
      modifiers (I haven't yet investigated it).
    4. It lazyly looks up the field value when needed, but I suspect this
      is pretty costly when displaying the signal overlay. I don't know if
      and what we'd want to do about it yet.
    Austreelis committed Mar 24, 2023
    Configuration menu
    Copy the full SHA
    90f0fe9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2c89ef6 View commit details
    Browse the repository at this point in the history
  5. Fix the formula of the fundamental solution of the diffusion equation

    Our application is in 2D. The 1D fundamental solution was used
    previously.
    Austreelis committed Mar 24, 2023
    Configuration menu
    Copy the full SHA
    e9cf281 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    07bc38f View commit details
    Browse the repository at this point in the history