Hi, how would you handle prediction in an online multiplayer game with an event manager, such as in GCC? It seems to me that it would not be as simple as forwarding the same events from client to server and vice versa. So client logic and networkforwarder could both subscribe to PositionEvent(), but it looks like they will soon go into strange loop. Does this mean you need to have two separate events for predicted position and real/corrected position? Or perhaps a field indicating whether this is a prediction or a correction event? The problem once again is that Server and Client emit the same events, and they both have logic and networkforwarder subscribed; listening for those events. Have a look at this picture to understand it better. Any thoughts on this?
Client sends out new PositionEvent() (in green). PredictedLogic and NetworkForwarder get this event and do their respective things. After NetworkForwarder on Server side recreates the event it send it to the real logic, but mistakenly also send it to it's NetworkForwarder since it's also subscribed (this is the loop).
Real logic then creates a correction event (in purple) and send it out to the event manager, which then forwards the event to NetworkManager and Server's Real Logic again... You see where this is going.
[IMG:http://puu.sh/cWlJo/66604cec83.png]
puu.sh/cWlJo/66604cec83.png
Client sends out new PositionEvent() (in green). PredictedLogic and NetworkForwarder get this event and do their respective things. After NetworkForwarder on Server side recreates the event it send it to the real logic, but mistakenly also send it to it's NetworkForwarder since it's also subscribed (this is the loop).
Real logic then creates a correction event (in purple) and send it out to the event manager, which then forwards the event to NetworkManager and Server's Real Logic again... You see where this is going.
[IMG:http://puu.sh/cWlJo/66604cec83.png]
puu.sh/cWlJo/66604cec83.png