You can meet me tomorrow at gamescom in cologne!
I would be glad to meet you!
Lighting: Radiosity shooting vs gathering
I have worked a bit on the light engine. It needed an extension that I can have colored light and light beyond the scale from 0 to 1 to make blocks stand out if the scene is dark. Previously brightness level 1 at night was still dark.
For the lighting I use an approach which can be compared with radiosity.
With the “update-approach”, which I tried before, each block had to collect the light it gets. This is similar to “gathering” when using radiosity procedures. A light source would be updated and set the light to a different level ignoring other light sources. So each changed block has to perform an analysis of the surrounding blocks. This is too expensive so I dropped that.
Today I tried a different approach. The engine iterates over each chunk at each frame to reset the lighting. Then the light can be accumulated for each surface by sending the light from each light source. This is similar to the radiosity-“shooting”-approach. The performance seems to be okay and the result is also working as expected.
To prevent iterations I store as many data as I can in each block in memory. But because the amount of blocks in memory can get huge I have to improve the memory consumption. Therefore I store 4 integer values for all the lighting information of each block. Each side has one integer at each 32 bit. Then I store a color with 10 bit for each channel in RGB format (many bit wise operations).
A whole block has another colorless base light level which is used for the shading based on the height. You can see it in this screenshot:
Here is screenshots of the result and a gif. The flickering is achieved by randomizing the light.
I added the caves which are procedurally generated. At the moment the caves all look like the same and are just simple rectangles. The caves also have some robots in them, which you can fight, and each cave has a portal to a next cave.
The generator uses a function which gets three coordinates as an input and the output is a block ( f(x,y,z)=i ). The nice thing about this that you can debug it via console by two nested for loops.
I also improved the crafting and the building. Both should be working properly and as intended soon.