Dev Update 13-Mar-2017
The previous weeks were really busy! I could spend a good amount of time working on the project during the weekends, mainly on getting lighting work the way I want it to be and also on level generation. And there is some exciting news with the latter, however: First things first! 😉
Area based directional lighting
So this was really a hard one. One of the key features of Biosignature will be how darkness can be really pitch black dark on some occasions. This is, naturally, to prevent you from seeing enemies and your surroundings so you will be forced to use flashlights and otherwise percieving noise:
Another shot, this time with headlight enabled:
On the flipside however, when you turn on the light in a room, light should ideally be nearly equally distributed within the room. This is quite hard to produce without either a) ambient lighting or b) a massive distribution of point/spotlights, especially if you have big spaces. Ambient lighting is off the table because it won’t respect yet unlit areas, and point/spot lights do need shadows to prevent them bleed into adjactent unlit rooms, so that could become quite expensive.
So I was thinking about solutions. One would be to write a shader that uses an additional greyscale texture input. The texture could define where and how much ambient light is added to the surface. But I really didn’t want to do so because then I would always need to stay within the bounds of that very one shader.
Then I had a kinda weird idea. Why not hijack Unitys lightcookies?! After some experimenting I figured it would actually work well enough to do what I would need it to do.This is how it works:
- I place a single directional light with a script attached in the scene.
- The script cares about positioning and resizing the cookie to fit the level bounds (I know the bounds because I procedurally generated the level before).
- Then it writes a texture into the lightcookie input and updates it whenever a light switch is flipped.
See how this looks in action:
And this is the concurring lightcookie texture, getting updated by code:
For ease of use I just write one square meter into one pixel.
Cyclic Level Generation
Last week I decided to redo how level generation works in Biosignature. That decision is based on a pretty amazing talk by Joris Dormans I recently found on Youtube:
The main idea is that rather than having a generated level be a tree with leaves being all dead ends, you can instead have the leaves circle back into the main branch. With that structure you prevent lots of backtracking and you also create levels that feel much more connected and handmade. The circles do also allow some pretty good game design tricks.
Since I am not under pressure with finishing the game – it’s still a spare time project after all, although a very serious one – I decided to shoot for it! 🙂 And I figured it is actually doable. The only major issue I had was that I needed to implement my own very condensed A* pathfinding to reconnect branches back to the mainbranch.
My current state is that I successfully generate a mainpath and circle out side paths that can be used for multiple purposes, based on the circles direction (circle forward/circle backward). I also added an extra route that connects the near end to the near beginning of the main path and serves as a shortcut back. Visualized it looks like this:
In Biosignature, the levels will also be traversed vertically:
It works very well and I already planned the next steps in development. Excitement! 😉
See you next time,
Philipp 🙂
Leave a Reply