Lighting Objects - UQdeco2800/2021-studio-6 GitHub Wiki
Description
Objects that give off their own light in-game. In the first level, there are multiple lampposts around as it is a city, although some of the lampposts are in disrepair and are in danger of dying out. In the second and third levels, these torches are (likely) placed there by other fireflies that have came before you. Touching a torch while the player's own torch is dim allows for the player to replenish their own torch's light to an extent, allowing them to push onwards with just a little bit more light.
Positions and amount of external lighting in levels
Because part of the game's theme is dealing with darkness, as well as finding ways to fend off the darkness with your own lighting, the amount of external lighting objects should be carefully managed, so as to not undercut this theme of the game.
In the first level, the lampposts go wherever it makes sense for a lamppost to go. There is an abundance of light, which makes sense for the first level, as an introduction to the game.
In the second and third levels, however, torches are much scarcer, and serve as a beacon for the player to head towards after traversing a significant portion of the level. One torch is placed somewhere in the middle of the level, on the main path towards the end of the level, and another (set of) torches is placed on the final stretch to the safehouse itself. As the torch is placed on the main path, the player is drawn towards the correct path to the end of the level. However, the player still has to make it through most of the level with only their torch for company. This strikes a good balance between giving the player some help with external lighting while not undercutting the theme of the game itself.
Lighting torches
The torches are capable of lighting the player's own torch when it dims, simply by touching them. However, because torches are a buyable item from the shop, this function may run the risk of devaluaing the torches in the store.
In order to counter this, there are two measures taken. Firstly, the placement of torches in levels 2 and 3 is intentionally kept scarce. There are only 2 positions where torches are placed in each level, and one of them is near the end of the level. Therefore, the player in practice only gets to refresh their torch timer once, near the middle of the level.
Secondly, this function is currently restricted to only work when the player's torch is under 70% of maximum lighting radius, and only refreshes up to 70%. 70% of the max radius is chosen because the total amount of light at 70% is approximately half of the light at 100% radius. This strikes a balance between giving the player just enough light to go on, while still making the store bought light valuable enough to spend the player's precious cash on.
Animations
The torches are animated simply, with the fire moving back and forth like a real fire.
The lampposts, or more specifically, the vined lampposts, are animated in a different way. Periodically, the lamppost flickers on and off a few times, showing its state of disrepair and seemingly about to fail at any moment. Accordingly, the light generated by the lamppost turns on and off alongside the flickering.
The rate of flickering is set to less than 3 times per second. According to google, starting from around 3 to 5 times per second, there is a risk of epilepsy in people who are sensitive to flickering lights. While it is unlikely for such a low flickering rate to trigger anything, there is no sense in risking it, therefore, the rate is carefully set to below that amount to avoid that risk.
In addition, even without consivering those who are photosensitive, a constant flickering light can be annoying to people. Therefore, the lamppost is set to remain on for a period of time, flicker a few times, then remain on again, on repeat.
Sequence Diagrams
The following illustrates how the lamp animation is done. There is one set of actions for turning on the light, and one set of actions for turning off the light, and the controller manually turns the light on and off in accordance with the desired flicker rate.
The following illustrates the sequence of events when the player collides with a torch.
Assets
Lamppost (unanimated)
Lamppost with vines (animated)
Torch