Test of a few new control systems for my spaceship battle game.

The missile attempts to strike the ship while the ship's turrets attempt to shoot down the missile. Any time the missile strikes or is intercepted, it begins its approach again with a randomized starting position and velocity.

Three systems are in play as the focus of this experiment:
The missile uses the guidance system shown in my previous experiment to determine the necessary thrust vector to impact the ship.
Unlike the prior experiment, the missile is not able to non-physically snap its facing direction to the desired thrust vector but instead must use rigid body torque to rotate itself onto the correct heading. To accomplish this I created a new fully physics-based system for achieving and holding an orientation, which I intend to explain in more detail in an upcoming post on my blog.
In order to strike the missile, the turrets use a targeting system being built for ShipBasher, with new upgrades to greatly improve its ability to hit rotating targets and, of relevance here, to account not only for linear velocity but acceleration when predicting future target locations. The system assumes constant linear acceleration, so it remains possible for the missile to reach the ship if it changes its thrust with fortuitous timing. In the finished game this is expected to be a mechanic that challenges players to balance ships' maneuverability against enemy defenses and vice versa. I also intend to explain this in more detail in the near future on my blog.

CONTROLS:
Click and drag to rotate the camera.
Either turret will fire if the missile is within its maximum firing range, outside its minimum firing range, and within its angular firing range and the turret has successfully aligned its barrel to take a shot.
This is sort of a "zero player game" in that there is no means provided by which to interact with the ship or the missile. For ease of visibility the missile features a pink flare.

Known issues:
Sometimes the missile fails to hit the ship and flies past it so that it has to make another pass. It hasn't been doing this in the editor in my tests thus far so I am still in the process of identifying the precise cause and a possible solution.
Occasionally the turrets will fire momentarily while the missile is out of range due to not having updated their range measurement yet. I intend to remedy this as the main game project progresses.
The missile may be observed to turn around and brake by retro-thrust as it nears the ship. This is because it is using an approach system intended for ships to use to come within engagement range of other ships, with the range set to zero, so the missile is trying to ensure it comes as close to the center of the ship as possible rather than accepting an off-center hit. In the previous experiment this was overridden with a hard-coded negative range value, but my goal is to find a way to improve the guidance behavior such that ships (of which missiles are considered a type in this scenario) can determine their approach strategy dynamically based on whether they mean to impact at high speed or make contact gently, e.g. to dock.

All artwork and code created by me. No AI was used to create artwork or code for this project. I do not consent to this project being used for AI data sets.

Leave a comment

Log in with itch.io to leave a comment.