RollbackManager is a class that manages all the rollback mechanisms of the game. It contains two copies of the world (PhysicsManager, TransformManager, etc...), the current one and the validated one. When receiving new information, it can reupdate the current copy of the world.
More...
#include <rollback_manager.h>
|
|
| RollbackManager (GameManager &gameManager, core::EntityManager &entityManager) |
| |
|
void | SimulateToCurrentFrame () |
| | SimulateToCurrentFrame is a method that simulates all players with new inputs, method call only by the clients to update the current state of the visuals.
|
| |
| void | SetPlayerInput (PlayerNumber playerNumber, PlayerInput playerInput, Frame inputFrame) |
| | SetPlayerInput is a method that set the input of a certain player on a certain game frame. It can change an input between the last validated frame and the current frame. It is called by the GameManager when receiving new inputs from packets. More...
|
| |
|
void | StartNewFrame (Frame newFrame) |
| |
| void | ValidateFrame (Frame newValidateFrame) |
| | ValidateFrame is a method that validates all the frames from lastValidateFrame_ to newValidateFrame. It changes lastValidateFrame_ to be newValidateFrame. More...
|
| |
| void | ConfirmFrame (Frame newValidatedFrame, const std::array< PhysicsState, maxPlayerNmb > &serverPhysicsState) |
| | ConfirmFrame is a method that confirms the new validate frame by checking the Physics State checksums It is called by the clients when receiving Confirm Frame packet. More...
|
| |
|
PhysicsState | GetValidatePhysicsState (PlayerNumber playerNumber) const |
| |
|
Frame | GetLastValidateFrame () const |
| |
|
Frame | GetLastReceivedFrame (PlayerNumber playerNumber) const |
| |
|
Frame | GetCurrentFrame () const |
| |
|
const core::TransformManager & | GetTransformManager () const |
| |
|
const PlayerCharacterManager & | GetPlayerCharacterManager () const |
| |
|
void | SpawnPlayer (PlayerNumber playerNumber, core::Entity entity, core::Vec2f position, core::Degree rotation) |
| |
|
void | SpawnBullet (PlayerNumber playerNumber, core::Entity entity, core::Vec2f position, core::Vec2f velocity) |
| |
| void | DestroyEntity (core::Entity entity) |
| | DestroyEntity is a method that does not destroy the entity definitely, but puts the DESTROY flag on. An entity is truly destroyed when the destroy frame is validated. More...
|
| |
| void | OnTrigger (core::Entity entity1, core::Entity entity2) override |
| |
|
const std::array< PlayerInput, windowBufferSize > & | GetInputs (PlayerNumber playerNumber) const |
| |
|
virtual void | OnTrigger (core::Entity entity1, core::Entity entity2)=0 |
| |
RollbackManager is a class that manages all the rollback mechanisms of the game. It contains two copies of the world (PhysicsManager, TransformManager, etc...), the current one and the validated one. When receiving new information, it can reupdate the current copy of the world.
◆ ConfirmFrame()
| void game::RollbackManager::ConfirmFrame |
( |
Frame |
newValidatedFrame, |
|
|
const std::array< PhysicsState, maxPlayerNmb > & |
serverPhysicsState |
|
) |
| |
ConfirmFrame is a method that confirms the new validate frame by checking the Physics State checksums It is called by the clients when receiving Confirm Frame packet.
- Parameters
-
| newValidatedFrame | is the new frame that is validated |
| serverPhysicsState | is the physics state given by the server through a packet |
◆ DestroyEntity()
| void game::RollbackManager::DestroyEntity |
( |
core::Entity |
entity | ) |
|
DestroyEntity is a method that does not destroy the entity definitely, but puts the DESTROY flag on. An entity is truly destroyed when the destroy frame is validated.
- Parameters
-
| entity | is the entity to be "destroyed" |
◆ OnTrigger()
◆ SetPlayerInput()
| void game::RollbackManager::SetPlayerInput |
( |
PlayerNumber |
playerNumber, |
|
|
PlayerInput |
playerInput, |
|
|
Frame |
inputFrame |
|
) |
| |
SetPlayerInput is a method that set the input of a certain player on a certain game frame. It can change an input between the last validated frame and the current frame. It is called by the GameManager when receiving new inputs from packets.
- Parameters
-
| playerNumber | is the player number whose input will change |
| playerInput | is the new input |
| inputFrame | is the game frame of the new input |
◆ ValidateFrame()
| void game::RollbackManager::ValidateFrame |
( |
Frame |
newValidateFrame | ) |
|
ValidateFrame is a method that validates all the frames from lastValidateFrame_ to newValidateFrame. It changes lastValidateFrame_ to be newValidateFrame.
- Parameters
-
| newValidateFrame | is the new value of lastValidateFrame_ |
The documentation for this class was generated from the following files:
- G:/Development/SAE/921/GPR5100_Rollback/game/include/game/rollback_manager.h
- G:/Development/SAE/921/GPR5100_Rollback/game/src/game/rollback_manager.cpp