Cytopia icon indicating copy to clipboard operation
Cytopia copied to clipboard

Twilight support

Open ghost opened this issue 3 years ago • 0 comments

Requirements

  • You must improve on the work done in #659 by adding support for Twilight events
  • Each twilight event must be configured in settings.json under Graphics. The default configuration is the following
"TwilightEventChance": 0.1,
"TwilightEvents": [
  {
    "name": "Belt of Venus 1",
    "triggers": ["Sunrise", "Sunset"],
    "colors": [ "#96939cFF", "#a38e8eFF", "#9e6e6aFF", "#875d6bFF", "#5a576eFF"]
  }
]
  • Please add more events than this. Some good examples are
    • Earth's shadow https://en.wikipedia.org/wiki/Earth%27s_shadow
    • Golden hour https://en.wikipedia.org/wiki/Golden_hour_(photography)
    • Alpenglow https://en.wikipedia.org/wiki/Alpenglow
    • Blue hour https://en.wikipedia.org/wiki/Blue_hour
    • Astronomical dusk https://en.wikipedia.org/wiki/Dusk#/media/File:Desert_Dusk.jpg
  • Currently, only the following triggers should be supported:
    • Sunrise at 7am
    • Sunset at 5pm
    • Dusk at 9pm
    • Dawn at 5am
    • Noon at 12pm
    • Midnight at 12am
  • You must create a RepeatedTask with an interval of 1 gameday which updates the GameTime model
  • On each day, the GameTime model must randomly decide if there will be twilight events during the day. It must make this decision by choosing a random number between 0 and 5, distributed according to the binomial distribution with base probability configured from settings.json. You can implement this using std::binomial_distribution. We will call this number N
  • This random number N represents the number of twilight events we must schedule for the whole day. To figure out which events we must schedule, we make a random choice of N distinct events and for each of those events, we must choose a random trigger in such a way that no two events share the same trigger.
  • The last two steps are complicated and will involve some changes to Randomizer to support these kinds of operations.
  • You must add a TwilightEvent event which gets dispatched at trigger time for the scheduled events during the day
  • MapView must handle this TwilightEvent and display the twilight event through a shader. The shader must multiply-blend the colors in a gradient. You are free to choose where to put the vertices on the screen. I recommend that you do a vertical gradient.
  • You must decide on what the duration of twilight events should be. You can make them configurable, or make it a compile-time constant. However, they cannot overlap each other, so you might want to stick with 1h duration
  • To handle this duration mechanic, you will need to implement a "Null" TwilightEvent event which signals that the twilight event is finished

ghost avatar Jan 03 '21 16:01 ghost