Something I enjoyed a lot in Battletech games was handling overheat. A well aimed CPP shot could blow a mech up in a blink. CPPs, however, raised your mech’s heat a lot, and an overheated mech would switch off for a while. Installing enough heat sinks allowed you to control heat, but also standing knee deep in water or fighting on icy regions.
We wanted something like that, so we created the Heat component & system. Entities that may overheat and malfunction have a Heat component to keep track of their temperature. Laser weapons, for instance.
Heat components store an entity’s current temperature in a simplified way, with values ranging from 0 (operating temperature) to 1 (maximum operating temperature). Their dissipation rate is used by the Heat system to lower temperatures constantly. Any system that may increase the entity’s temperature will do so by adding an operating heat when used. External factors like flying close to a star can increase temperatures too.
We tested it with laser weapons. When triggered they increase the current temperature by their operating heat. If heat raises above 1 the laser weapon is jammed until temperature falls down back to zero.
We also added the LaserWeaponGunner component&system, which are able to shoot laser weapons when certain conditions are met: there is a locked target in the Entity Targeter Component and temperature is low enough in the Heat component. In this example the gunner ignores temperature and jams the laser weapon.
This week we refactored the flight control system. Heading and velocities are now independent components, allowing us to create entities that rotate and move, like our ship; entities that move but don’t rotate, like… railgun slugs? And entities that rotate but don’t move, like unmanned turrets. We created the later to test our new systems.
They are able to detect nearby targets in range, choose the closest one (AI is just the simplest), set a desired heading so their barrel faces towards the target and rotate:
They don’t shoot, yet. That will depend on the mounted weapon. Firing an energy weapon will require keeping an eye on heat while ballistic/kinetic weapons require managing ammo and reloading times. We’ll get there.
Fun fact: we can create elite-like gimbal-mounted weapons by simply attaching a turret to our ship and telling what to look for. This one is targeting the planetoid:
Furthermore… by separating the current input control system into heading (rotation) and velocity (thrust & strafe) we could easily get manned turrets! And we would be a step closer to this:
Here’s an early prototype of a space flight game we would like to turn into a proper game someday. Plus, it’s also our Christmas and New Year postcard this year! So Happy 2017!
So far we are already able to turn the spaceship with a mouse, accelerate (W), brake (S), strafe left (A) and right (D), fly upwards (Space) and downwards (Left Ctrl) and roll left (Q) and right (E). Yup, it works like a FPS! We can also shoot our lasers (Left mouse button) and a tractor beam (Right mouse button). We’ll add gamepad control at some point.
Behind the curtains we are also toying with an Entity Component System (ECS) architectural pattern on Unity, and so far we have a good feeling about it. Those gifts swarming around the Christmas tree are nothing but pure data!
Plenty of work ahead and surely lots of fun. And headaches. But that’s what game development is about: solving problems to create fun!