The problem in that example isn't the memory usage, it's that you're locking a thread for 50ms every 3ms per player.
But that wouldn't be what happens there. It'd be a single point generated to see if they're below it or not, assuming no overhanging terrain. But generating a single point on the CPU is still, I imagine, crazy expensive when you scale it to many players.
So, to extrapolate and assume, lets say the pixel is 1m, and it will take 1/100th the time compared to a 100x100 patch that's 5microseconds.
Well, Flavien confirmed that as I'm writing this.
So if that's the case and you do 5 checks per second, on 200 people, that's 1 millisecond. So 1/200th of the cycles on a core taken up. Yes, that isn't too bad assuming a number of cores. Though, you still add a little more time for greater function call overhead in generating just one many times than a big patch, but still, I guess that would potentially scale to be usable for collision.
Using up 0.5% of a core merely for collision is still a lot in my eyes, but it does sound doable when put like that.
But that's for 1x1m. Ships are larger than that, so you need to generate more.
Me and you both in our examples are assuming you just do collision on the center point versus the ground right below, so really it's going to be much higher cost than that.
Like.. it'd be funny if someone actually figured that out and made a hack where they can have almost half their huge ship through the ground because they know the collision was based on a 1 square meter point.
So in reality, you may want to sample 5 positions. The center and 4 corners, per ship. Now it's gone from 0.5% to 2.5%, or 12.5% in your 500 example.
I'll be more generous and assume the server averages like 25% CPU usage at say.. 500 players, with 200 close enough to the surface that you need to do collisions, plus lets say it's like 0.01 microseconds just to check if they're below the highest point terrain could even be.
Well, you're then spending almost 3% of that 25% on collision. Over 10% of the load on your server sim is very basic collisions alone. That's extremely abnormal, so you see why I'm feeling it won't scale.
You can drop it to every half second, and spread them out over a few ticks, I suppose.
However, yeah, you could look up those 5 points per position on the integrated GPU. The GPU on those modern Xeons is actually good enough, and in that sense your way works if you need that precision instead of lower detail like I thought you could do, while doing that on the CPU would work short term which could scale by doing it on the GPU instead later.
Sure, you can do things like allow clients to agree on collision, and only when they disagree does the server check. Lots more programming involved, this way, but it's doable to have less load on the server.
And even then I'm not sure since the server has to look to the past, but Flavien said replays were planned which solves that problem.