Combat mode camera
Goblinson Crusoe hex based turn based rpg
Today, I decided to tinker with the combat mode camera. In the previous iteration, the camera would lock tight onto NPC and enemy units during combat mode when it was their turn. During a player unit's turn, the camera would snap to the unit but then enter a free-scroll mode where moving the mouse to the edges of the screen would scroll the view RTS style, letting them get a clearer view of the battlefield as desired.
The camera would snap quickly to the next unit, sometimes scrolling extremely quickly so that it was difficult to tell, for widely spaced units, where a unit stood in relation to the others. For long, protracted sieges or explorations of a large sub-map, this could get confusing.
So, since I'm switching visual styles I thought I'd tinker with the camera a bit. The current iteration of the camera will now snap to the currently active unit as before; however, it does so on a spring so that the movement is more fluid. Also, I've removed the scroll from the side of the screen; it seems unnecessary now that I can spin the camera and zoom out. While the camera is connected by a spring to a given location, the viewing angles and zoom level can be adjusted any time by holding the right mouse button (to move the camera) or scrolling the mouse wheel (zoom). I'm still tinkering with the basic mechanics, and trying to decide if I should lock the horizontal view angle to the currently active non-player unit so that the player can have a better view of what the unit is doing. But for now, here is a short video of the camera in action on a battlefield full of dummy units:
The spring constants are adjustable. I did have to turn up the delay between when a unit becomes active and when it actually starts to move; with a lower delay, some NPC units that were a long distance from the last active unit would start to move before the camera snapped to them. These units in the video don't do anything but random pathing. Even with a tight spring and rapid movement, the 3D view is much easier to read as the camera scrolls, and it is significantly easier to keep track of your place on the battlefield than it was in the old combat mode.
Here's a video with lock-to-facing-angle springing. It feels kind of swoopy but cool.