Closed shredder2500 closed 3 years ago
doing multithreading for networking is not really the best idea. we would add an order of magnitude complexity to worry about. with miniscule (if any) performance gains.
imho use Burst instead. it's already insanely fast.
the goal for now is to keep DOTSNET & networking on main thread and let people use the other threads for things like monster AI. that's what the DOTSNET Benchmark demo does too.
I get your point and there is value in it. but we should really avoid multi threaded networking unless there is absolutely no other way around it. for now, it's insanely fast as is and we still have plenty of improvements to apply.
This is not multithreading networking. its applying all the logic in a multithreading safe dots way and avoiding sync points to the main thread till the end and sending messages on the main thread at the end. this is how Unity recommends using dots avoid sync points witch dotsnet currently causes. It also makes more sense to me to send messages at the same point in a frame rather than all over the place. I have been able to implement this myself.
I would like to build up messages in jobs and send them at a sync point similar to Command Buffers. This would allow me to process more Entities in parallel and send queue a message to be sent.
Only built in option right now is to have a system write to a container and now the system has to wait on the job to finish then iterate over the messages and send them. This causes a sync point in the middle of the system flow.