More turret updates

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.

Updates – camera system and manual turret control

Camera system:
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.

Turret control:
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.

Happenings

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.

Iteration 11 news – no Iteration 11 this month

So for the first time since the project went public there won’t be a monthly update. Reason being is that although quite a lot has changed since iter 10 (take a look at the current change log here) there’s not much to show. For example the game now features pivoting turrets, “energy” missiles (something like photon torpedos from Star Trek), torpedos (slow moving destroyable missiles), multiple barreled guns (for turrets mostly), energy bullets, rocket bullets, and a new shotgun type of a gun. There’s quite a lot more changes, so why not release them to you to enjoy? Well just because the turrets can pivot… doesn’t mean that I have turret models that support pivoting (I only have 1, an awesome one, but still just one). There is a new super cool “shotgun” type gun (shoots bullets in a cone) but no ships that actually have it. So in the end Iteration 11 would look pretty much like iteration 10 – only most likely more buggy.

So I decided that iteration 11 will take some more time. Also I’m not sure if iteration 11 will come at the end of November, behind the scenes there’s a fairly big graphics overhaul going on so releasing it piecemeal would diminish the effect, plus the aforementioned aspects. This may become the norm in alpha as the focus is on polish more so than adding in features month by month. Let me know what you think and feel about this, your feedback may sway me to release updates in a more timely manner – if there is something tangible to release.

Happenings – Iteration 11

Iteration 10 came and went so the project is officially in alpha state :) This means that more focus will be taken towards improvement and polish than adding game elements. The previous iterations had a fairly narrow focus (adding in the command ship, adding in base captures, adding research etc), iteration 11 has no such focus instead its aim is to generally improve the gameplay. This past week turrets have been given the ability to pivot (no longer will projectiles exit a turret at an angle that the barrel is not facing), multi barreled weapons have been put in place, muzzle flashes added, and other such enhancements.

For example right now I’m working on torpedos. Torpedos are a type of a missile, except that unlike standard missiles these obey the laws of the physics engine (inertia and momentum) and can be destroyed, however they pack a much more powerful punch and have greater range. Right now however torpedos are strangely wobbling in the general direction of their target… but not quite ready for battle.

Its a lot of fun doing this kind of work because visually many things are happening. Much more to come!

Battle editor – video


Here’s a demo video of the new battle editor. Still many things to do: add “scenery objects” like asteroids, select different environments for example: asteroid fields, debris fields, nebulas etc. Add support to link stations to bases. Add ability to specify targets for ships in battle editor prior to starting battle. Add support for modders to add objectives, triggers, etc. Add support for modders to specify custom battle tunes :)

Updates

Instant action mode and the battle editor are coming along nicely. XML files are working – the game reads them to create ships/stations/asteroid bases. You can now mod in game objects now, add in new ones, etc. Go nuts! You can make a carrier whose hangar bay launches has other carriers! Oh the infinity! Will have to create some documentation on modding.

Also I overhauled the way that moving objects happened (either station placeholders or instant action objects). Pretty happy about this, been meaning to improve this, I think its pretty sold now.

Somewhat worried because I’ve modified the game in several key places and didn’t do much testing. Hopefuly not too many bugs in there. Also the XML files could have a lot of typos leading to sluggish ships (if I typed in the speed value wrong) or other issues.

Happenings

Instant action mode is going well. The game now reads XML files for ships, stations and soon asteroid bases. These aren’t used yet to generate ships, but soon will (that’s the easy part once the loading is complete). The “Battle Editor” can add ships and stations to the play area and clicking play pushes those objects into “game mode.”

A lot of polishing still left to do, error checking like making sure there’s at least one playable ship and making sure objects aren’t colliding with each other before beginning the battle. Setting factions, duplicating groups of objects (for quick and easy you versus them scenarios and for quickly adding ships). Saving and loading of previously created scenarios. Things like that :)

Already this is reminding me of when I was in grade school recess, I would play with little plastic toy soldiers and even pull up weeds and plant them into the sandbox battlefield to create trees and terrain.