I started off last week wanting to do something minor – adding roll to the camera when the ship rolled. I ended up doing a major overhaul to the camera system – to be clear I am talking about the aspect of the camera system that reacts to the ship turning with the intent of giving the player a “feel” for movement of the ship. I’m very happy to say that it is much better, some portions are even “release quality.” Other portions are being debated/watched and some portions need tweaking. The movement is now gradual, therefore the “spring back” that would happen when the ship stopped turning has been eliminated – it bothered me from day one. The key was to link the camera system with the physics system. When I first coded the camera system I didn’t have a physics engine in the game yet, so the camera system did its thing based on the ship’s orientation changes, when the ship changed orientations (by turning or whatever) the camera system would react, when the ship stopped turning then the camera would spring back to the “initial position.” I didn’t judge how much the ship was turning, so it was either all or nothing. It worked and looked ok, but was clearly flawed.
By using the physics engine as the driving force for the camera I use the actual turning force of the ship and give that to the camera to re-act to, this is a much better source of data and allows me to do the more fine tuned camera system.
This week I started on adding in a “turret camera” and allowing the player to manually control a turret. So far so good, the basics are in – the player can switch to turret view, seeing the turret and the turret’s cross hairs up close and personal. The player can also control the turret, still more tweaks and I have to add in a turret hud for controlling its parameters. Its AI – point defense (attack torpedoes), offense (attack a ship equal or larger than the turret’s parent – prioritize the parent’s target), defense (attack ships that are smaller than the turret’s parent). Allowing the player to set targets and priorities for individual turrets very easily.
The cool thing about controlling the turret via the mouse is that I implemented a “look to turn” method, what happens is this: the player points their view on where they want the turret to turn, the mouse movement and the turret movement are independent meaning that the slow turret isn’t slowing down the nimble mouse. A idea from Slaor triggered me to then have the camera orbit the turret always keeping it in sight, a great addition to the system – making it nearly perfect, all that’s left is to change the camera’s Y (up/down) position as a response to the turret’s pitch.
The funny thing about manually controlling a turret is that (to me) it is a fun, but useless feature. The turret AI – I think – probably does a better job than the player could at aiming at targets, but this does give the player more options and a fun aspect of controlling the ship that they are in. Plus some ships may not have forward guns (carriers, troop transports, etc) but do have turrets, so the player can set the ship to crew control and jump into a turret to still fire off some rounds. Even in ships that have primary weapons – manual turret control allows for the player to have the fun of controlling a more nimble weapons platform when in a big clumsy destroyer. Basically its fun The targeting aspect is serious business however, it will allow the player to give individual turrets individual targets, so a large cruiser could attack multiple ships at the same time… a sight to behold and one I’m eagerly awaiting.