Home Artists Posts Import Register

Downloads

Content

This week I did an exploration around camera logic. I want the camera to zoom and move as the player explores the scene. The camera should zoom-in when the player approaches objects that need attention and should zoom-out when the player flies away. Why? Well, I find that keeping the camera zoomed-out gives a good view of where the player can/should go, but it feels rather dull. A zoomed-in view is more exciting but can negatively affect navigation. There are also situations where the camera should move ahead of the player and other cases where it shouldn’t.

I ended up creating generic utilities that allow defining 2D zones of the scene. Lua code uses these utilities to check whether the player is inside these zones and can do various things in response. Having to write code for every scene is a bit on the heavy side but I couldn’t think of a fully automatic camera logic that would be flexible enough to do the right thing consistently. Note that the camera already implements some automatic tracking mechanisms based on position and velocity of the player, but these alone seem not good enough.

I found it challenging to adjust the camera smoothly enough to not disturb the player. I ended up doing extensive use of SmoothVariable objects. These are numbers (or vectors) that smoothly change to a desired target value. For example, rather than setting the zoom directly I set its corresponding SmoothVariable telling it what it needs to be. The SmoothVariable then gradually approaches the desired target value. The target can abruptly change: the SmoothVariable takes care of it.

I spent the second half of the week fixing and improving the virtual joystick. This is an onscreen joystick that allows using the game on mobile devices (touch screens) and via the mouse. I pushed an update here https://relativisticgame.itch.io/dev the password is still “sounds”.

I also started working on shadows, drafting some code for shadow map computations. More on this in the next post.

Comments

No comments found for this post.