4 ms·
I was thinking of a game like minecraft or similar (essentially, a ~large world with lots of entities updating in a grid of chunks). In that case, you generally
by foota 3y ago
I was thinking of a game like minecraft or similar (essentially, a ~large world with lots of entities updating in a grid of chunks). In that case, you generally have people fairly clustered in different grid tiles, and they're all likely to get similar information about each chunk, so it seems like re-using the buffers between calls would be beneficial.
So instead of:
for each player:
for each block player needs:
# Write block to player's connection
You could do:
for each player:
for each block player needs:
# Check if the block is already mapped in a kernel buffer. If it is, just append a write for it to the io ring.
# Otherwise, copy the block into a new buffer and send it.