Expand description
§GGRS
GGRS (good game rollback system) is a reimagination of the GGPO network SDK written in 100% safe Rust 🦀. The callback-style API from the original library has been replaced with a much saner, simpler control flow. Instead of registering callback functions, GGRS returns a list of requests for the user to fulfill.
Structs§
- Game
State Accessor - A read-only accessor for the
T
that the user previously saved into a GameStateCell. - Game
State Cell - An
Arc<Mutex>
that you cansave()
/load()
aT
to/from. These will be handed to the user as part of aGgrsRequest
. - Message
- A messages that
NonBlockingSocket
sends and receives. When implementingNonBlockingSocket
, you should deserialize received messages into thisMessage
type and pass them. - Network
Stats - The
NetworkStats
struct contains statistics about the current session. - P2PSession
- A
P2PSession
provides all functionality to connect to remote clients in a peer-to-peer fashion, exchange inputs and handle the gamestate by saving, loading and advancing. - Session
Builder - The
SessionBuilder
builds all GGRS Sessions. After setting all appropriate values, useSessionBuilder::start_yxz_session(...)
to consume the builder and create a Session of desired type. - Spectator
Session SpectatorSession
provides all functionality to connect to a remote host in a peer-to-peer fashion. The host will broadcast all confirmed inputs to this session. This session can be used to spectate a session without contributing to the game input.- Sync
Test Session - During a
SyncTestSession
, GGRS will simulate a rollback every frame and resimulate the last n states, where n is the given check distance. The resimulated checksums will be compared with the original checksums and report if there was a mismatch. - UdpNon
Blocking Socket - A simple non-blocking UDP socket tu use with GGRS Sessions. Listens to 0.0.0.0 on a given port.
Enums§
- Desync
Detection - Desync detection by comparing checksums between peers.
- Ggrs
Error - This enum contains all error messages this library can return. Most API functions will generally return a
Result<(), GgrsError>
. - Ggrs
Event - Notifications that you can receive from the session. Handling them is up to the user.
- Ggrs
Request - Requests that you can receive from the session. Handling them is mandatory.
- Input
Status InputStatus
will always be given together with player inputs when requested to advance the frame.- Player
Type - Defines the three types of players that GGRS considers:
- Session
State - A session is always in one of these states. You can query the current state of a session via
current_state
.
Constants§
- NULL_
FRAME - Internally, -1 represents no frame / invalid frame.
Traits§
- Config
- Compile time parameterization for sessions.
- NonBlocking
Socket - This
NonBlockingSocket
trait is used when you want to use GGRS with your own socket. However you wish to send and receive messages, it should be implemented through these two methods. Messages should be sent in an UDP-like fashion, unordered and unreliable. GGRS has an internal protocol on top of this to make sure all important information is sent and received.
Type Aliases§
- Frame
- A frame is a single step of execution.
- Player
Handle - Each player is identified by a player handle.