Devlog: Ship menu, friendly fire and coding

This one is going to be shorter than usual. I had to re-install Windows completely and, of course, everything that goes with it (drivers, updates, settings, most programs, my dev environment…), and it took quite a bit of time. But don’t worry, no data was lost and I still managed to make some important changes and additions.

I rewrote the Ship Info menu, which will allow you to setup and give order to your ships more easily. I also implemented different friendly fire settings so you can attack enemy assets without worrying about hitting neutrals. As usual, I will explain these changes (amongst more technical ones) into more details in the full article.

Ship Setup Menu

This new menu replacing the old ‘ship info’ screen is used when you look at one of your ship. You can change various settings like the ship’s name, its home-base, its turrets and friendly fire settings and so on. There’s also a new tab that’s extremely similar to the one found in shipyards and that is used to change / equip / inspect shields and weapons. It works the same, with drag & drop support and profiles. And of course there’s the usual cargo and hangar tabs. Note that not everything is done yet, but it’s still representative of what it should look like once I am done with it.

As you can see in the screenshots, there’s a give orders menu. I am not sure it will stay there as I am thinking about using a sort of popup-menu on the main screen / map instead to manage all the ‘complex’ commands that can’t really be handled by only a few mouse clicks.

Friendly Fire

The biggest issue with combat until now was probably the friendly fire. Helping non player ships against a common foe was near impossible as your (or your ally’s) bullets would always hit a friendly. To fix this I added new settings for the weapon systems that can be enforced at the faction level (all your ships at once) or at the individual ship level. Right now there’s 3 possible choices:

  • No Avoidance : Bullets will hit everything and everyone
  • No Faction : Bullets won’t hit your own ships (was default until now)
  • Enemies Only : Bullets will only hit hostile ships.

To avoid constant switching, especially if you’re playing as a pirate, if you have another ship or station targeted in the radar, your bullets will hit it even if it’s not hostile (yet).

Technical Stuff

With v0.5.5 released, I have some time to change and (hopefully) improve the lowest layers of the code without the fear of adding bugs that would go completely unnoticed. There’s the conversion from pure object oriented (OO) programming to a component based system (ECS). While it is not going to improve performances in itself, it make the code much easier to maintain and debug especially for a solo programmer like myself.

In the quest of having more ships shooting at each other on the same screen at the same time, I reviewed all the bullet / missile / laser … code as it’s the main culprit of the slowdowns. It’s not much the graphics, but the collision detection part. I made some progress by finding ways to limit the amount of stuff they have to test collision against and by pure code optimization. I also caught a “bug” that was causing missiles and homing mines to use the AI thread instead of the Physics thread to move around. Fixing it saved a couple of CPU cycles (AI being way more solicited that physics during fights).

Oh, I nearly forgot, until now ships could only fly in 8 directions. So I gave them the same movement mechanism as missiles, they can fly in any direction now. They are also much better at handling their acceleration. I have still some cosmetic issues to fix, rotations aren’t always right, and their “escort” flying pattern looks even weirder than before. Still, it’s still an improvement compared to before.

I fixed an annoying but that would cause the camera to often go bonkers when the current player’s ship gets destroyed. Instead of trying to switch to the nearest ship that may have been destroyed as well, the game switch to a sector view. And I also fixed a few smaller bugs from 0.5.5 that would allow you to buy any ship from any shipyard using profiles, or that would cause an error when removed a weapon that fired a shot recently from its slot.

Cheers,
SK.