I have a room, i have a physics world created by room at start
All's good
I want to do those things with 10hz:
Take input from clients inside room (not lockstep, just as fresh as possible)(Clients update those with ~10hz also).
Do physics step with those values.
Send new positions to clients.
So what is better solution?
1)Queue that UpdateAndSend method into room's fiber
+ : no locks, just works, no new threads, scales
- : can be delayed
2)Create another fiber specially for that method and schedule there (so it will be called with exactly that delay (0.1s)
+ : can't be delayed, no new threads, scales
- : should use ReadWriteLockSlim on positions and inputs
3)Create async Task and while loop inside with use of cancellation tokens
+ : can't be delayed, no new threads, scales
- : should use ReadWriteLockSlim on positions and inputs
4)Explicit thread
+ : can't be delayed
- : not scales, should use locks, explicit thread creation,
The reason why i want to send resulting positions right after calculating physics is to not do irrelevant calculations
All's good
I want to do those things with 10hz:
Take input from clients inside room (not lockstep, just as fresh as possible)(Clients update those with ~10hz also).
Do physics step with those values.
Send new positions to clients.
So what is better solution?
1)Queue that UpdateAndSend method into room's fiber
+ : no locks, just works, no new threads, scales
- : can be delayed
2)Create another fiber specially for that method and schedule there (so it will be called with exactly that delay (0.1s)
+ : can't be delayed, no new threads, scales
- : should use ReadWriteLockSlim on positions and inputs
3)Create async Task and while loop inside with use of cancellation tokens
+ : can't be delayed, no new threads, scales
- : should use ReadWriteLockSlim on positions and inputs
4)Explicit thread
+ : can't be delayed
- : not scales, should use locks, explicit thread creation,
The reason why i want to send resulting positions right after calculating physics is to not do irrelevant calculations