>Visit the Devblog
>Me on Twitter
>Official Website

~ Remember when you gathered in your basement for all night long playsessions?
To fight critters and try keeping your eyes open at 4am?
We do, and we want to have it all again. ~​

Biosignature - escape from ice moon is an aliens-like 80s scifi Top-Down Shooter
for up to 4 Players on the couch/online or mixed if you like


  • View media
  • View media
  • View media
  • View media
  • View media
  • View media
Post article RSS Articles

Dev Update 08-April-2017

Well hello again! The past week was probably one of the hardest for me in all the development process. I ran into a problem that occured as a side effect of me wanting to have the levels spread over multiple floors.


You want to always see your player character!

As simple as it sounds – with a top down camera, it’s totally not. Whenever you are in a room which is below another room on a higher floor, you won’t see anything anymore because your camera will show you the upper room instead:


So what you naturally want to do is to somehow hide that room. Thing is, how do you figure when and what to hide? There are a few options available, but not every option is applicable for my case:

  1. A manager script. Pro: Full control over everything. Con: But what will you do with all the non-static content? Other players or agents might enter that room, new renderers might be spawned over the course of play(like shooting bullets etc) and you won’t really want to constantly track everything, because this would be a) pretty expensive to calculate and b) probably very messy, bulky in implementation.
  2. Unity Layers. Pro: A Built-In, lightweight solution. I could set all objects layers to their respective floor and just render/not-render based on the current camera position. Con: You still need a manager who sets the objects layers, which makes you run into the same problems. Even worse, as the built in layers are also used for physics occlusion, you would automatically sacrifice that convenient feature just for multi-floor levels.
  3. Use the cameras near-clipping plane. Pro: Clips everything away with no hassle. Lightweight, no to little additional code required, the GPU does it for you. Con: Out of the box this would only work when your camera would point down with a 90° angle, but mine is more like 65°-70°.

So the third option was the most appealing to me, however I’d need to somehow force it to cull the way I want it to cull, which means I had to:

Customize the cameras projection matrix

Now what the near clipping plane does is clip away anything closer to the camera than a defined distance. Modifiing the distance during runtime looks like this:


So this is not really helpful yet. I need to find a way to have it clip away along the y-axis instead, and what I need to achive this is: Matrices. I was very good with matrices back at the university, but boy is that long ago. So what I naturally did was Google the shit out of it. And Google delivered, I found that I will need the camera have an oblique projection matrix to compensate:


Basically the near and far clip plane should align with the xz-plane. And after a rough evening, I had a decent result:


Only that on the very next day, when I moved from the test scene and tried to implement it into the actual game, I learned that this actually does completely mess up the lighting, at least in deferred rendering. When the GPU renders shadowmaps, it needs the original projection matrix to work properly. So changing the actual projection matrix is a dead end for me. But there is one more option:

Customize the cameras culling matrix

Yes, you can also do this instead. However it turns out that you can’t just use the previously calculated oblique matrix. I can tell that because I tried it The results are just plain wrong. Some research on the forums point to the culling matrix is somehow not based on the cameras origin but somewhere else within the camera space, most likely its somehow married with the near clipping plane. If you know how to get the matrix right, please let me know! In the meantime, for me it meant it was time to get creative. Fortunatly the Unity documentation pointed to another interesting direction. They use a second cameras matrix on the main camera. So what I did was this:

  1. Create a second camera in runtime, also disable it as we are not interested in it to actually render.
  2. Place the camera on room-height, ie 4 units above the current floor.
  3. Let it point down 90°.
  4. Set a FOV of 180° – so the camera is basically a super-fisheye and sees all the room.
  5. Use this cameras culling matrix on the actual main camera!

And thats it!



Addendum: Since the new camera has a FOV of 180° it would actually see far more on the same level, so I also added a light weight manager that additionally culls static room geometry which is more far away, just for more optimization, however thats only the stuff I know from the generation process, so just some lines of code:


Edit: I put some more work in optimization and added selective Frustum culling. This brought a huge boost in render performance:



PS: New Unity version came out a few days ago, with a new command buffer command that could change the projection matrix during rendering, however it did nothing for me. Maybe that could save me the second camera, if anyone knows more, please tell me! ;-)

That is all for this week and I return to finish the cyclic level generator! See you next time,

Philipp :-)

Biosignature Devlog: Area based directional lighting and cyclic level generation

Biosignature Devlog: Area based directional lighting and cyclic level generation

News

Exploiting Unitys lightcookies and a new, innovative level generation approach.

Biosignature Devlog: Video footage and implementing gameplay distribution

Biosignature Devlog: Video footage and implementing gameplay distribution

News

We had a nice test session on friday and here's videofootage! I also worked on distributing gameplay in the level generation process and live.

Biosignature Devlog: The crew! Plus: Title announced & more 3Dness

Biosignature Devlog: The crew! Plus: Title announced & more 3Dness

News

Finally the game has a title! I also finished the player characters (first iteration) and I added camera rotation control for more emphasis on the 3D...

Biosignature - escape from ice moon

Biosignature - escape from ice moon

News

Introducing Biosignature, an Aliens-like 80s SciFi coop Top-Down Shooter

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Icon
Biosignature - escape from ice moon
Platforms
Windows
Creator
g-phil
Engine
Unity
Contact
Send Message
Release date
Game watch
Follow
Share
Style
Theme
Sci-Fi
Players
Single & Co-op
Project
Indie
Twitter

Latest tweets from @pgrnauer

Wuuuuuuaaaaaeeeeiiip! Wiiiieeeeaaauuuuup! #thursday #indiedevhour #madewithunity T.co

Apr 13 2017

Keep calm and frustum cull #indiedev #coding #rendering T.co

Apr 12 2017

Can't wait for more!

Apr 8 2017

Hey #indiedev s☝️I wrote a new devlog entry about using custom

Apr 8 2017

#gamedev Wisdom of the day: It's infinitly harder to hide something you have than to show something you don't have yet.

Apr 7 2017

And just in time a new Unity version plops up that might or might not turn my delicate rendering issue solvable

Apr 6 2017

Embed Buttons
Link to Biosignature - escape from ice moon by selecting a button and using the embed code provided more...
Biosignature - escape from ice moon
Statistics
Visits
827 (1 today)
Last Update
Watchers
3 members
Articles
5
You may also like
Neon Chrome
Neon Chrome Third Person Shooter
Batch 17
Batch 17 Third Person Shooter
ProjectNimbus
ProjectNimbus Third Person Shooter
Clone Drone in the Danger Zone
Clone Drone in the Danger Zone Third Person Shooter
Wing Commander Flat Universe
Wing Commander Flat Universe Third Person Shooter
Lockdown Protocol
Lockdown Protocol Third Person Shooter