I started working on what I call turret roles – basically a turret’s automatic behavior. Prior to these changes turrets took their parent’s (either ship or station) target, if the parent didn’t have a target, turrets took as their target the parent’s attacker if any. This was way too dumb though, the goal is for AI in this project to be somewhat self sufficient, allowing the player to focus on combat or other tasks – there are so many that a good amount of automation is needed. Besides in the game’s universe these are space ships, crewed by sentient beings and sophisticated AI – they should make somewhat logical choices
Here’s a brief overview of the roles:
Point Defense role – get nearest missile or torpedo that is targeting the parent – otherwise use the defense role for target selection.
Defense role – get nearest ship that is targeting the parent – otherwise use the Parent’s Target role for target selection.
Parent’s Target role – same target as the parent – otherwise (if parent doesn’t have a target) nearest target regardless if it is targeting the ship or not.
Offense role – using the turret’s priority targeting list find the nearest target.
I hope what I accomplished in these roles is a fairly simple system, yet one that gives a good degree of control over the turret. Some of these roles fall back on other roles that are somewhat related – if no missiles, then look for an attacker, if no attacker, then look if parent has a target. Also the Offense role mentions a target priority list, prior to these changes only ships had a priority list of targets, now turrets have this as well. Basically some turrets may work best against some types of targets, for example a slow moving heavy turret shouldn’t try to hit fast moving fighters, instead it should try to target a frigate or bigger ship first.
These roles will be specified in the turret’s xml file, so ships can be fine tuned to their roles on the turret level. For example a corvette may have a light turret for missile defense – giving it more of an edge versus ships with missiles. Or a frigate has a heavy turret for offense making it an assault frigate. These roles can be changed in game by the player – per individual turret. If about to assault a station with torpedoes, setting a turret or two to point defense might be a wise choice.
Having turret roles also allows for the expansion of ship roles – for example a ship that ‘s set to defensive could have its turrets set to point defense, a ship that’s set to aggressive could have its turrets sent to offense.
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.
So normally the past weekend would have been spent preparing the next release, instead I added a few neat features related to missiles. There is a big benefit to a longer cycle between releases, it gains an extra weekend a month of coding, weekends being when the major additions come about. Plus usually during “release weekends” I get burned out from the bug fixes and other little details that I often have to take care of, names in the installer, turning off debug options, bug testing, prepping the installer, finding that it doesn’t work, prepping it again, uploading etc.
So again I don’t think we’ll see an iteration 11 in November, or December. January is fairly fitting for iter 11 because that’s when iter 1 came out – wow almost a fully year ago.. the project certainly progressed. Hopefully, given another year it will be good enough for a commercial release
In other news, I worked a bit on the camera system, I added a camera roll when the ship rolls in first and chase views. Also I tweaked the camera movements in these modes to make the camera more dynamic, that and the addition of the roll has a pretty neat effect, giving a sort of a “wild” animal feel to controlling a fighter.
Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!