The goal of this week was to “overhaul” the mouse system. Meaning that I would scrap the old code and start fresh. I tried this several times and went back to a backup file of the source code dealing with mouse control.
Finally I realized that – I would be creating a nightmare scenario. The code is extremely complex, most of it is my fault – in terms of choosing such a design where the player can control the game via joystick, mouse for maneuvering, mouse for camera, mouse for GUI, in multiple views and even a RTS interface. So the code is complex because it needs to be complex, and since it mostly works (its just a pain to work with) I decided to leave it along. I did simplify a bit of old code via deleting and got rid of some redundant code via merging/re-use so I guess there was a – ever so tiny – overhaul.
The goal of the overhaul was to simplify the code so that adding in new features would be easier, now that the overhaul was a bust I still wanted to add the new features. For the most part I’m very pleased. The mouse maneuver code now has added functionality where the “maneuver cursor” returns back to the “dead zone” – which is an area of the screen (at the center) where the mouse doesn’t have an impact on the ship’s rotation - the ship moves forward. This allows for the dead zone to be much smaller since there is assistance in hitting it, thus allowing for greater precision in flight. Making mouse flight much improved. It feels better, I enjoyed a few rounds of the simple dogfight instant action scenario.
Next up was something a bit more complex – “mouse look to turn” and the ability to manually steer in command mode. To recap – command mode has a “turn to” and “go to” commands. Allowing for the player to issue orders on where to go, but I wanted a manual mode as well. This works now, though I stumbled for a moment wanting to change the command mode camera to eliminate the effect of the attached to ship’s roll. I wanted to eliminate roll because when the ship rolls the camera inherits the roll and thus can feel wild as it changes orientation without the player’s input. Sadly the camera system fought this and I decided to let it go for now. Once I moved on from that aspect the mouse look to turn was quickly added – and I really like it. Although command mode is intended for large ships – there is a sort of a “complex” dogfight mode in there as well with lots of interesting options for the player on how to fly and maneuver. Still this works best for ships with turrets due to the freely rotating/orbiting aspect of the command camera.
Next up was putting in a “mouse look to turn” mode in first and chase person cameras. Works pretty well though I’m a bit disappointed at the end result – its not as good as I imagined it. Though I think some players will prefer it to the “mouse turn” to maneuver mode. The difference is this: mouse turn to maneuver – the camera is attached to the ship’s front, the ship chases the mouse maneuver arrow that the player moves and the attached camera moves with the ship. In “mouse look” to maneuver – the camera can freely turn – without having the ship turn – and the ship chases the center point of the camera. So – the difference is that in mouse look – the player looks at the target or turn to point (like in a first person shooter game) and the ship rotates to achieve that heading. I’m a bit disappointed with it, because it isn’t as “efficient” as “mouse turn” – which feels more “in control” and “responsive” – still this is the first iteration that this feature is fully in (years ago I had a more basic functionality like this – when I first put in turrets) so we’ll only improve it from here on out.