I have completed a full test of the multiplayer system, using a separate client machine and a separate internet connecting, and the live (remote) server.
This test went extremely well, and I did not uncover and issues or problems, which is very encouraging.
The new network code changes seem to be working fine, and are much more performant than the old system. There is far less jittering and rubberbanding with the new system.
I have created a concept for the control object switching behaviour.
It is now possible for the control of an AI entity to switch to another player when the original controlling player leaves the game, or the current control object radius.
This means that the AI will continue to function seamlessly as players join and leave the game.
This client-side AI approach is unconventional, but it should work reasonably well, at least in theory.
The next step is to make the Space-Based AI network safe.
Currently, when enemy or NPC starships are spawned, their positions are not synced across the network.
This will be more complex than the other AI types, since the Space-Based AI needs to have persistence (It needs to be able to follow the player between star systems, and it needs to remain in the world when the player logs out).
For the time being, I can simply have the AI spawned, and controlled, by a single client, and then synced over the network.
When this client logs out, I can then switch control to another client in the same zone, and when that client logs out, I can set the AI to persistence mode, where it will simply wait for another player to enter that zone.
This is not ideal, but I need to balance the goal of keeping most processing on the client (To keep server load light) and the goal of creating a persistent world (Which will require the server to have knowledge of the client world state).
I am in the process of testing and evaluation various options, and the above solution seems to work reasonably well so far, even if it is a little unusual.
All control object positions and rotations work, and I have run extensive tests with paging in and out players, and testing player followers/companions, etc.
I have also fixed some more minor issues that cropped up when I was testing these new changes.
I have also added asynchronous loading of player objects, which should address some framerate and performance issues that I was having.
I also fixed another major issue with performance which was caused by large numbers of persistent objects being loaded at once. I had not created this many objects in one place before, so this issue had gone unnoticed.
There is still further optimisation needed here, but it is going very well.
I am now in the process of optimising the player network code.
This is going well, but there is quite a lot to do, and to test here.
However, it should result in much more reliable, and much faster, netcode, especially with larger numbers of players.
It will also allow me to remove a lot of unneeded code which will streamline the codebase.
The basic mechanics of the new player code works. I can create and delete players, and sync their positions. The next goal is to make sure that the position of all control objects and player companions is properly working.