Yes, no matter what way you cut it, this is not a priority for now -- even if we figured out exactly what to do, and it was an obvious win, that wouldn't happen until later this year when we're working on the second expansion (any updates, of course, would be free for all players, as per usual). And it will be a guts replacement, as NickAragua says.
As usual, I am letting myself get way to sucked into a discussion that I shouldn't let take up so much of my time by this stage, so I'm going to say one last bit and then get back to work on Tidalis for now. But, others feel free to keep discussing. A couple of points:
Why The Collision Detection Is Dependent On Other Stuff
In answer to Black's question, which was very well laid out, I'm going to try to explain something very complex in a concise manner. For those following along, please try to read this very carefully and really understand what I'm saying. It's more complex than it seems at first blush.
Okay, to sum this section up as concisely as I can: the simulation must give a deterministic result, and thus everything -- everything must happen in the exact same order on every computer, regardless of any other factors.
In other words, if Ship A collides in Frame 1, it is using the game state from Frame 1. If Ship A collides in Frame 2, the game state has likely changed in subtle ways. This may lead to any of the following, which causes a desync:
- Different random values coming up (completely assured).
- Ships being in slightly different positions, and so colliding slightly differently (not all that common, given the precision of time we are talking about here, but will happen frequently enough to cause desyncs at least once an hour, if not more frequently).
- Ships having died, gone through wormholes, or whatever other status changes that cause them to not collide or collide differently, and which then cause desyncs.
Now, in thinking about this, I hope everyone will extrapolate out to the rest of the program. This applies to targeting, to... well, there isn't anything it doesn't apply to. Now, hold on, I know that there's a subsequent argument brewing, and I'll get to that one:
Splitting Tasks Per Client, Or Taking Things Out Of The Simulation
Okay, so Black's argument was that collision detection could be lifted off the main thread and done on worker threads. After all, it only depends on all the ships on a planet and their positions and any statuses that would cause them not to collision-detect, right? I say that non-facetiously; compared to the targeting requirements, that's no data at all.
Here are the problems:
1. For this to be deterministic, the working data has to be exactly the same on all the clients when it is passed over. This essentially makes one thread completely dependent on the other, which introduces all-new bottlenecks. Something might could be done with this, but it wouldn't be all that pretty and performance would likely be questionable even with so (comparably) few data points for this.
2. If you make it per-client, then this is something that is no longer part of the simulation. Literally, in the same sense that the AI Thread that currently exists in AI War is not part of the simulation. When you take something outside of the simulation, that means it no longer has to be deterministic, which is great because it lets the main simulation keep chugging away without need to wait on the main thread.
However, #2 does have downsides, most notably command lag. If something is outside the simulation, then the only way that it can impact the simulation is by issuing internal "game commands" that get sent to the server, then scheduled for execution on the next turn that the server sends to all clients. Thus everybody still winds up integrating those commands into the simulation at exactly the same time. There is a 400ms round-trip time sending stuff like this from the clients to the server and then back. That may not sound like a lot, but in terms of collision detection or auto-targeting, that's a huge amount of lag.
Case in point, this is the normal lag of the AI in making decisions -- except that it is even worse for the AI, because I only allow it to send 200 game commands per game turn (200ms), in order to keep it from bogging down the network with all its commands (which it definitely does in the absence of that speed cap). We compress, we combine, etc, but there is still no way to get around the volume of data that has to send. In terms of the AI Thread, this sort of added lag is actually good, because it makes the AI seem a bit more human-like. It might take it a couple of seconds to respond to something a human does, which seems fair, right?
But: that is only fair because, like human ships, the AI ships have autotargeting, FRD mode, etc, which can make them react in a more automated way prior to getting their real commands from the AI overlords (same as your ships act in an automated way prior to getting their commands from you). Collision-detection, compared to the autotargeting, is really almost nothing of a load. Yes, collision-detection is probably the second-highest load of the simulation thread, but it's so much less than autotargeting that it's not even in the same class of load.
Okay, so take autotargeting onto the AI thread, then, right? That should be possible, and easier than one might expect since all the needed data is already on that thread, thus avoiding the addition of any of that nasty added syncing-related performance load I've been talking about. In fact, I went through a lot of work back in late November converting the game to do this, but the results were so disastrous that I reverted it. Here's what happened in my fully-functioning tests:
1. All autotargeting was moved to the AI thread, which meant that until ships got a command from the AI thread, they would just sit there. Not a problem if the interval between AI thread data sends is 200ms, right? That's what I thought I could work off of.
2. Because of all the extra commands being sent for autotargeting purposes, however, and because of the (very much needed) 200-commands-per-game-turn cap, this caused an incredible bottleneck, though. Often autotargeting commands wouldn't arrive for 10-15 seconds or more. This meant that ships that happened to luck into getting earlier autotargeting commands had an incredible advantage, as they could basically completely wipe the other side off the face of the map before the other side even knew to fire.
3. To experiment with countering this on just my local machine -- single player, now, not even multiplayer -- I took the AI thread command cap off. The flood of data messages that were needed in order to run autotargeting at anything approaching full speed was such that it made the game all but unplayable even in really lightweight scenarios that presently the game laughs at.
Could I have made optimizations to the above approach I was experimenting with? Undoubtedly. But that doesn't escape the fact that there is simply too much data to push through the network pipe like that, and so you can't take autotargeting out of the simulation and expect a game at all like what the current game is. Anything that talks about splitting stuff per-client, just running some activities on one machine versus another, is going to fall under this category. Basically, if you add in voice chat (which is common), plus all the commands that players tend to issue along with what the AI issues, the game is using about as much network bandwidth right now as I care for it to for minimum system requirements purposes.
So, in the end, that takes us back to the main kind of questions, which is basically splitting actual simulation activities amongst multiple threads that are all "part of the simulation" and thus expected to give the same result on every machine. And for an explanation of all the various pitfalls of an approach of that sort with this type of game, please see all the stuff I've already written in this thread, along with the "Why The Collision Detection Is Dependent On Other Stuff" section above.