Devlog #15 Semi-Dynamic 2D Lighting

Dynamic lighting was something I wanted to do for a long time. I wanted to use it in one way or another in my project. Until now, I was using the static type of lighting in the project, it is called basic lighting. However, I will probably switch the project to the dynamic lighting side when I type this post.

First of all, since I do not use any game engine, there is no default support for lighting.I had to do what I had to do from scratch. However, the dynamic lighting issue is a complex concept, it brought along many questions such as how it affects the performance of the game, and whether a better view can be obtained. Frankly, I am not very positive about dynamic lighting at first. One of the biggest reasons for this was that the lighting obtained with the Raycasting method would not look very good in the game. Also, to use this method efficiently, the good optimization was required and the coding side of the method seemed too complicated to me. Of course, I still tried and ran it successfully, but I did not like it. For this reason, I put this dynamic lighting issue on the shelf for a while.

Fortunately, I decided to use a different method that came to my mind these few days. This method is the flood fill method I mentioned before. Then I took a look at the lighting projects used with this method. I could have developed a similar method for my own project and in a sense provided dynamic lighting in the game.

After two days of work, I managed to prototype the dynamic lighting required for my project, as in the video below:

Well, there are still some strange glitches in the lighting, but these are processes that will be fixed over time.Judging by the demo, it's pretty efficient in terms of performance. In other words, it doesn't look much different from static lighting. However, the CPU usage may increase in moving lighting.

Now it's time to adapt this prototype to the actual project. After the adaptation, let's see if I can get the result I want. 

One eternity later:
Grid-based Lighting
Finally, I got result what I want. Well, there are some performance issues. But I have some solutions that will solved these issues. 

No comments:

Post a Comment