In a peer-to-peer enviroment, it is non-trivial to determine when all peers are ready to take some shared event, such as starting a game from a lobby, or taking the next turn in a turn based game. The problem is that while your system may be ready, and all systems you are connected to may be ready as far as you know, those systems may not know they are ready relative to each other. This is because latency or packetloss may break or degrade the connection between two other systems, so as far as those two systems are concerned not everyone is ready yet.
The ReadyEvent plugin handles this situation automatically. Given a user-defined numerical event identifier, each system can call ReadyEvent::SetEvent(eventId, isReady). When all systems are ready relative to both you and each other, ReadyEvent::IsEventCompleted(eventId) will return true, and you can proceed with the shared event. This value will be stored until the event is deleted with DeleteEvent(eventId);
Common uses:
- In a peer to peer lobby, this can be used to store when users toggle between ready and unready. When all users are ready, the game can start.
- In a peer to peer turn based game, this can be used to signal that everyone is ready for the next turn.
- In any peer to peer game, it can be used to proceed on generic events that everyone has to wait for, such as all players done loading the level.
|