Category Archives: Game Development

Happenings

Been meaning to update, always short on time so I’ll try to keep this short…

Currently working on turrets as main guns, watch them pivot/turn to their target, press the trigger and they fire, very neat. These go with the new corvette, very cool model. The barrels on the new turret weren’t positioning exactly on the center/top of the turret’s base so this threw off my muzzle flash positioning code, converted it to use “bones” instead (in case you aren’t familiar, models can have bones, which are used for animation and positioning). This method is much better than old method, but required some code re-writes.

Flying the new corvette with the “turrets as main guns” feels really neat, I enjoy it a lot, the turrets auto tracking gives them and the ship a “living/intelligent” feel. Looking forward to take advantage of this in the future on other ships.

The corvette also features a “secondary” weapon, a “charging gun” that can push objects away. Gotta code in the support for the secondary weapon…

Thinking that the end of March release goal for iter 11 maybe somewhat out of reach, but will try to get it done.

Iter 11 news and happenings

The goal is for iteration 11 to be available at end of this month (March). In keeping with this goal I’m trying to focus on general polish and readiness in addition to mostly minor additions… Sometimes polish gets boring so adding something in keeps me motivated, but I have to try to keep it to the less intensive elements so that I’m good to go by the deadline.

One of “less intensive elements” is the new HUD markings in ship mode, I’ve added a little HUD marker to show whether a ship is a friend or foe. Before this the only way to tell would be to target the ship or to switch to tactical mode (since tactical mode has objects colored with faction colors). This is a really cool thing because you get the sense of what’s around you, and will be especially important since the player will be able to capture/build a vast array of ships so simply looking at the hull configuration doesn’t always indicate whether it is a friendly or not.

Some minor tweaks and fixes: made the aim assist of projectile weapons more accurate, my code had an inconsistency which depending on the position of the weapon to the ship would throw aim off. The funny thing is that this inconsistency became apparent only when we changed the ship and weapon parameters, making everything faster, which also boosts projectile range as well (since distance = speed * time).

The other thing that I’m working on is tutorials. I’ve tweaked the old tutorials, for example showing how to use the afterburners and turrets. Also I’ve added a gravity drive tutorial which means I had to add a “go to object” objective.

Camera work

The intent was to work on tactical mode enhancements, selection enhancements, a new overhead camera issuing orders, grouping, etc. After I dabbled for a bit with improving selecting (eg: hold down shift to add/remove to/from selected ships), I headed towards putting in an overhead cam.

The idea was that it would work like a standard real time strategy camera, sort of an angel’s eye view of the battle, but I quickly realized that this was somewhat silly idea, why put this “only look down” limit? So I scrapped that idea and took out the few good ideas that came along with the overhead cam, which is a better movement mechanic, basically the player would always want to go forward, but what does forward mean? Forward where the camera is facing? Or forward in terms of the overhead cam, where moving forward is sort of like looking down, but still moving “ahead”. The forward where the camera is facing already has a very intuitive mechanism – zoom. So I put in the “ahead” mechanic and voila much improved map traversal in tactical mode. Also I got rid of the rigid follow system, where you’d have to press F to follow an object then press F to un-follow, instead if the player is following an object, but moves the camera away from the focused object the camera will stop following automatically. Zooming in/out and orbiting the focused object is still ok and would. This automatic un-follow means that there’s less things keeping the player from traversing the map.

The follow mechanic also got a huge improvement, instead of an instant transition, which can be somewhat disorienting, following an object will now have a transition period where the camera flies towards that object than attaches itself to it to follow it. This preserves the distance and rotation of the camera, so it is a fairly nice system. Another less major improvement is that the tactical camera now ignores all roll, meaning that the camera is always “upright” which should be less disorienting on the player.

With these added improvements to tactical I wanted to use the same code on ship mode, so I used it to create a “death camera” – so now when the ship that the player is in is dying, the camera zooms out and sees the ship fly out of control and eventually explode. This meant that there is a time period where the player may not be in a ship – which is a first in the history of this project – this may one day lead to the player controlling something other than a ship, maybe a avatar in a space suit? Who knows.

Almost forgot to mention, the death camera and transitional cameras are optional. So if the player doesn’t want to wait for their ship to explode before moving onto another one, the player can still switch ships, or if the player doesn’t want to wait for the camera to travel from one ship to another the player can just jump into the cockpit/chase/etc cameras.

New weapon type

Been meaning to add this new weapon type for a bit now and am very glad that its in and works fairly as I expected.

Recap – current weapons:
Projectile – flies forward (has a velocity), when hits something does damage. Has a varient called a scatter gun (which is basically a shot gun) which fires multiple projectiles at once in a cone pattern.
Missile – same as projectile, but can turn to track its target. Has a variant called torpedo – which is much less maneuverable, but does more damage.
Beam – instant hit damage over time weapon (continuous while hitting target and has energy) – aka lasers/phasers/etc.

This new weapon type I call “rail gun” – it is is a hybrid between the beam weapons and the projectile weapons. Basically it has ammo like a projectile weapon, but instantly hits like the beam weapon, however unlike the beam weapon it doesn’t do damage over time, it does the damage instantly. This weapon has a variant that can be “charged” – basically the longer you hold down the fire button the more damage this weapon does, and when you release the trigger the weapon fires. The rail gun type weapons can also push objects away, what’s really neat is that because of the physics engine I’m using the objects are pushed away in a “realistic” fashion, so if the rail gun hits an object off center then what happen is that instead of being pushed away, the object spins. Which I think is pretty neat! I bet you’ve seen this in Half Life 2 with the gravity gun and other games, a very cool weapon. The push effect will be especially good versus fighters because of their lower mass, so this could be adapted to a sort of a defensive weapon.

Some interesting things come about the rail gun, because the weapon instantly hits it is un-dodgeable once the weapon platform (ship/station/etc) lines up the shot, therefore I should avoid giving enemy ships this weapon especially early in the game, otherwise this would frustrate the player too much. However giving it to the player at early stages could ease the player into the game fairly well because the non-charged version is easier to use than standard projectile weapons. The instant hit nature is also very adept against missiles and torpedoes.

Very much looking forward to adding this new gun type into the game and having battles with and against it :)

More AI and happenings

I was hoping to be wrapping up the basics of AI and heading into adding another weapon type then working on tactical mode. But there’s still more work to do. Recently I changed over the the save/load system so that it would be compatible with the new AI and it I thought I’d be done with it by now. It is working well for the most part, but when I went to do the same with the trading ship AI I noticed it wasn’t very compatible, so now I’m fighting with it a bit to make it compatible with the AI manager system. Its good stuff all around because this means that the trading ship AI will more modular so that it can be used for other ships – for example ferrying ore from asteroids or cargo pods from destroyed ships. While doing this I was testing the transport ship AI and noticed a few bugs here and there to the gravity drive system, as usual I think I finally have it fixed heh heh…

Speaking of AI I had a really neat moment recently, a drone fighter turned to face its target (while turning off its thruster engines) and then when facing the target the drone hit its afterburner to charge at its opponent. I guess you’d have to be there to appreciate it, but it looked and felt fairly intelligent and dramatic :)

In other news I posted about my project on reddit.com’s gaming reddit here’s a link I had a good response to it so that made me glad, even got an email with some additional kudos :)

The posting made me realize that its been far too long between iterations, so I have to clean up the current version enough so that its playable and then release it, getting tired of saying: but in the in development build… besides the change log is getting very crowded.

Fighter AI and afterburners

Meanwhile… while working on the AI I added the potential for AI ships to evade their attackers or switch to target them. The evade maneuver had an issue, it needed a power boost, so I added in afterburners (been meaning to add these for a long time). The result – much more fun, both in terms of seeing the AI use these in combat and in terms of using them in combat myself. Obviously afterburners have a variety of uses, close in on a target, run away from a target, boost to reach the new gravity drive speed threshold, do a 180 then engage burners to slow the ship down :) Lots of fun. Combat feels more tactical and engaging now that there is an added ship function.

Have been running through a lot of fighter versus fighter scenarios in a small asteroid field, and its a lot of fun, very happy about this, the AI now has about 4 potential “attack patterns” sometimes it chose them at random and sometimes it somewhat intelligently (very small decision criteria) decides the best one out of the available options. Battles are much more dynamic with this and seeing the AI use afterburners as well.

Still a lot of work to do on the new AI initiative. I want to make larger ships more interesting in combat as well, plus I have to add in “dynamic speed” settings for ships, basically having the AI intelligently speed up or slow down to reach a target, based on distance and target’s velocity.

AI work – obstacle avoidance and turning

The big news is that I greatly enhanced obstacle avoidance, something I’ve been struggling with for years now. Did I ever tell you the time about my super crappy implementations of this? no.. well.. let me tell you they were super crappy. The previous method was (when an obstacle was in a ship’s path) was to simply tell the ship to go to a position above or below (depending on if the ship was nearer to the “bottom” or “top” of the obstacle) the obstacle until it could look at the destination without any obstruction, this worked most of the time unless the destination was positioned in such a way that looking at it from the above/below was impossible, in which case the ship would fly off into space. Pretty dumb and not anywhere close to release worthy.

Needless to say path finding is a huge issue and was a huge worry, this new system takes into account what is in the ship’s path, and intelligently plots a course to avoid it – based on math – figuring out the perpendicular to a vector, then projecting that vector outwards to find a safe position. Somehow the crazy thing works, even though my math skills are embarrassing.

The other neat thing that I worked on was giving larger ships different turning and speed parameters when their AI is active. Basically the larger the ship the more it will turn to face its destination before engaging its engines, also during these turns the larger ships will turn more so than pitch up or down, this makes them more very much different from small fighters and corvettes, further distinguishing them, giving them a more epic feel.

Lotsa happenings – gravity drive

Its funny because the more stuff is happening the less I update this blog. But I have to make a effort, at the very least for myself because I enjoy reading this stuff, its motivational and I go “ooh I remember when I did that… yeah…”

Recent work: re-wrote the “gravity drive” – prior to this gravity drive only functioned via autopilot, this is of course very lame, also the whole gravity drive process was pretty bland – select far away target, press auto pilot button, ship would stop, face target, and then accelerate. Another awesome thing here is that the new code is sooo much simpler than the old, and the old code was mix of AI and acceleration, very lame, it was some off the earliest code I’ve written and it shows.

Now you can manually “engage” gravity drive – first you select a “valid hop” – a large object that allows for the gravity drive to function, meaning that the map turns into sort of islands in the void, enabling for strategic/choke points, meaning much more interesting map design. You can still fly to any spot via the standard engines, but to quickly travel from spot to spot that’s why there’s the gravity drive. So anyway you select a valid hop, then you “initialize” the gravity drive (via keyboard or hud) and now you have to travel at three times the cruise speed to “engage” the gravity drive, at this point you accelerate 20 times the normal factor – until you reach your destination at which point the gravity drive disengages and you rapidly decrease your momentum, if the ship veers off course (you are still allowed any maneuver you want) and you get further away from your hop, then the gravity drive disengages.

The other limitation of the gravity drive is that it only works on the “nearest” hop, so you may have to jump to a hop nearer to your final destination, meaning that that intermediate hop is able to become more strategic.

I think that this new take on “warp” or “hyperspace” mechanic in space sims is pretty neat. There’s a few limitations that add to the game play, and allow for greater strategy (the need to go towards a valid object), but still allows for rapid travel between positions, no need to fly through boring empty space too much. It isn’t the tired “jump” mechanic where a ship disappears and reappears in a different spot instantaneously, while really convenient this is somewhat boring.

In other news: the AI work continues, and is progressing well, the light is at the end of the tunnel. Today I finished up basic target selection and order commands for the combat AI.

Happenings

Did an interview with True PC Gaming, you can check it out here. It was a bit harder than I thought putting my thoughts in writing. The interview also features new screen shots, showing the new art style. I’ve also added them to the media page on the main website here.

It was about a year ago that I first made the project public via this blog and the website. Its been a good year, hopefully this year will bring even more to the project.

AI work

I’ve started working on the new/enhanced AI. The primary goal is to give the AI the ability remember more than one task, as you can probably guess, the old AI could only remember one. This lead to a few problems mainly being that the AI was very inflexible, and that whatever task I gave it had to be complete in and of itself.

First up the inflexibility – say for example the player orders one of his/her ships to attack a object that is 1000 distance units away, but while the ship is flying towards that object it is attacked. Because the old AI only remembers one task at a time if the AI responded to the attacker it would forget the original order, because I want to give the player the ability of absolute command over ships in their arsenal, this meant that I had to tell the AI to ignore any attacker (the turret’s would defend the ship, but the ship itself wouldn’t respond) under these conditions (where the player directly orders a ship to perform an action, the ship would ignore everything else around it and try to do that action). But! If the AI can remember more than one thing, it can respond to things – in this example defend itself, and then afterwards continue onto the target that the player commanded it to. So giving the AI some memory is of clear benefit here.

The second issue is that the tasks had to be complete in and of themselves – this is actually an internal coding thing, so technically invisible to the player, however having each task be complete in itself means that AI tasks are prone to bugs, they are hard to save (for saving/loading), and that they are hard to add. So the new state of the AI is that it will be built up of small and reusable tasks that form larger ones.

For example this is how I stared coding what I called in code “AI Nodes”:
Idle node – set ship speed to 0
Wait node – use idle node until a timer expires
Turn to position mode – turn ship towards a specified point in space
Go to position node – use the turn to position node, and set the ship speed so that it can travel to the position
Go to object node – use the go to position node and update the position based on the go to object’s position
Follow object node – use the go to object node, when within distance of the follow object switch to the idle node.
Formation follow object node – like the follow object node, but instead of idling when near use the turn to position node to align with the followed ship, with some speed matching.

As you can see the go to position node uses the turn to position node. This very simple example shows how I can create more complex behaviors, eventually giving me the ability to set complex tasks, that are easy to arrange and create. For example: go to position abc, destroy this ship, pick up that object, and then return to position xyz. This could be useful for pirate raids, for civilian traffic, for trading ships, for scripted events, for boss battles, for cutscenes and other story elements – anything really.

The very very flight basics are in, what I’m currently working on now is the gravity drive changes for the AI and player controlled ships. All along I’ve been planning on not having the standard “warp” or “hyperspace” type mechanism in this project, instead what I call a “gravity drive” – a method of traveling at a high rate of speed, but not the boring already seen mechanics, instead ships can use the gravity drive to pull themselves (or as I like to think of it fall towards) large objects, making them choke points and giving them strategic value. These objects will be asteroid bases, large rocks, and potentially special “gravity field generating” stations and even maybe some special ships. So the player can either use standard engines to travel to a position, or can use the gravity drive to hop along from nearby large object to nearby large object until they get to their destination. So it basically calls for some basic distance comparison based mapping, which I’ve coded in tonight.

Next up more logic, the pull mechanism of the gravity drive, and better obstacle avoidance, then off to combat, and then off to intelligent node selection/addition/removal/management.