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

Updating lighting system #695

Open
BenCheung0422 opened this issue Aug 27, 2024 · 0 comments
Open

Updating lighting system #695

BenCheung0422 opened this issue Aug 27, 2024 · 0 comments
Labels
Blocked Requires fixing another issue before this one. Improvement Something that we can improve. Proposal/Scheme/Plan Feature request with detailed description or guidelines. World system Issue related to game world system/mechanics.

Comments

@BenCheung0422
Copy link
Member

Background

The current lighting system is kind of "outdated". In details, there are several issues that should be overcome by updating the lighting system to be more complete. Several tasks and functionalities could be resolved to change the mechanisms of lights.

Issues

First of all, spawning. Though this is just one of the related issues, this is the most obvious one. The current lighting system just affects visual effects, which means, just areas of bright circles, rendering on pixels, per tick. It can be a performance issue if the "pixels" are saved as lighting data on "pixels of tiles" actually on the level. It must be changed to let lighting actually be saved as data on the level.

Then, balancing of lighting by lighting sources must have to replanned for more different kinds of sources added into the game. Then, players should not emit lights by themselves, so they must hold light sources to let it make more sense. For dark areas, there is something needs to note. When there is light nearby but players are not on light areas, the darkness levels of other areas visually would be lighter according to the light levels of the tile they are on. But only when they are on dark areas. If they are light areas, dark areas would be darker. This is the kind of implementation of eye lightness adaptability. This would make more sense and might be later could be implemented by using shaders.

Changes

The entire system would be rewritten, including "light radius" and rendering results. The most significant part is that lighting data would be saved in saves, as a part of level data. Rendering would be done according to the saved data on the level/tiles instead.

Basic Mechanism

The simplest approach could be done is the one similar to Minecraft, where light levels decrease gradually. Light levels are only possibly non-zero on top-most tile of solid column of tiles or tiles with transparency. Other blocking solid tiles would be zero light inside. It means, each tile associates with a lighting level value, and a data value (re)calculation is done only when any of the tiles nearby (6 directions) have a lighting level update. And the calculation depends on the data value from tiles nearby (6 directions). This part may be related to #396. Rendering results of lighting would be further adjusted by gamma value.

Light Sources

Originally, items do not emit light when holding, but lanterns (because of rendering of entities) which are furniture items. For other sources, as shown as below:

Light source Radius (in tile)
Torch 5
Lava 6
(Wood) lantern 9
Iron lantern 12
Gold lantern 15

However, "radius" will be no longer used, but the light level values emitted. At the moment, no much plan here, so 7 as spawning level and 15 (2^4-1) as the maximum lighting level will be adapted. There is potential implementation of power system, so I have a thought that electric lighting could be implemented and other lighting sources would become fueled, making it more abundant and challenging in gameplay.

No Power System

This is my original plan where there was no any plan of power system.

Light source Light level emission
Lava 15
Torch 10
(Wood) lantern 10
Iron lantern 12
Gold lantern 14
Fire 5
Sparks/Lava brick 3

The lighting level emitted when holding items would be the same as when they are placed.

With Power System

When there is electricity, there can be electric lamp, so the different could be made by having fuels implemented in other sources made by coal. Then, torches would have less timespan compared with other lanterns. When made, they are not fueled, so they must have to be fueled separately, on hand (perhaps switching hands or something I am not sure) or when placed. The only fuels can be used are perhaps wood and coal. I am not sure for other items and maybe there can be flint and steel to light up them. All lanterns would share the same length and thus larger fuel capacity. For more light sources, further decisions would have to be made.

Conclusion

At the moment, these are the changes least to be made into the game to update the lighting system. However, there should be more plans to be made in order to complete the system more thoroughly. You are welcome to propose more opinions and ideas.

@BenCheung0422 BenCheung0422 added Improvement Something that we can improve. Blocked Requires fixing another issue before this one. Proposal/Scheme/Plan Feature request with detailed description or guidelines. labels Aug 27, 2024
@BenCheung0422 BenCheung0422 added the World system Issue related to game world system/mechanics. label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked Requires fixing another issue before this one. Improvement Something that we can improve. Proposal/Scheme/Plan Feature request with detailed description or guidelines. World system Issue related to game world system/mechanics.
Projects
Status: Todo
Development

No branches or pull requests

1 participant