Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
bomberman::MultiplayerLevelScene Class Referencefinal

Client-side scene for one authoritative multiplayer match. More...

#include <MultiplayerLevelScene.h>

Inheritance diagram for bomberman::MultiplayerLevelScene:
[legend]

Public Member Functions

 MultiplayerLevelScene (Game *game, unsigned int stage, unsigned int prevScore, std::optional< uint32_t > mapSeed=std::nullopt)
 Construct the scene from stage data.
 
 MultiplayerLevelScene (Game *game, unsigned int stage, unsigned int prevScore, const net::MsgLevelInfo &levelInfo)
 Construct the scene from authoritative level info.
 
void onExit () override
 Release multiplayer scene state before leaving the scene.
 
void onNetInputQueued (uint32_t inputSeq, uint8_t buttons) override
 Consume one locally queued input for prediction and presentation.
 
bool usesEventDrivenLocalMovement () const override
 This scene applies movement from queued network input instead of events.
 
bool wantsNetworkInputPolling () const override
 Return whether local gameplay input should currently be polled.
 
- Public Member Functions inherited from bomberman::LevelScene
 LevelScene (Game *game, const unsigned int stage, const unsigned int prevScore, std::optional< uint32_t > mapSeed=std::nullopt)
 Construct a shared level scene scaffold.
 
void onEnter () override
 Called when scene become activated.
 
FieldTransform getFieldTransform () const
 Returns the field transform needed to map tile-Q8 world coords to screen pixels.
 
virtual void onEvent (const SDL_Event &event) override
 Catch SDL2 events.
 
virtual void update (const unsigned int delta) override
 Update level scene.
 
void clearLocalMovementInput ()
 Clears locally held movement input and resets player facing/animation state.
 
- Public Member Functions inherited from bomberman::Scene
 Scene (Game *game)
 Construct a new Scene object.
 
virtual ~Scene ()
 Destroy the Scene object.
 
void addObject (std::shared_ptr< Object > object)
 Add object to scene for drawing.
 
void insertObject (std::shared_ptr< Object > object, int position)
 Add object to scene for drawing to specific position.
 
void removeObject (std::shared_ptr< Object > object)
 Remove object from scene.
 
void setCamera (const int x, const int y)
 Set the Camera object to specific position.
 
void draw () const
 Draw objects on the screen.
 
SDL_Rect getCamera () const
 Returns the current camera position.
 

Protected Member Functions

void updateLevel (unsigned int delta) override
 Run one multiplayer gameplay frame.
 
void onKeyPressed (SDL_Scancode scancode) override
 Handle scene-local key presses such as leaving the match.
 
bool supportsPause () const override
 Multiplayer matches cannot be paused locally.
 
- Protected Member Functions inherited from bomberman::LevelScene
void initializeLevelWorld (std::optional< uint32_t > mapSeed)
 Completes shared world setup after derived state is ready.
 
void generateTileMap (std::optional< uint32_t > mapSeed)
 
void spawnGrass (const int positionX, const int positionY)
 
void spawnBrick (const int positionX, const int positionY)
 
void spawnStone (const int positionX, const int positionY)
 
void spawnPlayer (const int positionX, const int positionY)
 
void updateMovement (const bool isPressed, const int keycode)
 
void updateCamera ()
 
void stepLocalPlayerMovement ()
 Steps the local player position by one simulation tick.
 
void syncPlayerSpriteToSimPosition ()
 Writes playerPos_ to the player sprite in screen space.
 
void setLocalPlayerPositionQ (sim::TilePos posQ)
 Replaces the canonical local player position and syncs the sprite immediately.
 

Additional Inherited Members

- Protected Attributes inherited from bomberman::LevelScene
std::shared_ptr< MusicmenuMusic = nullptr
 
std::shared_ptr< Playerplayer = nullptr
 
Tile tiles [tileArrayHeight][tileArrayWidth]
 
int playerDirectionX = 0
 
int playerDirectionY = 0
 
bool isPaused = false
 
unsigned int stage = 0
 
int fieldPositionX = 0
 
int fieldPositionY = 0
 
int scaledTileSize = 0
 
int backgroundObjectLastNumber = 0
 
sim::TilePos playerPos_ {}
 Canonical player position in tile-Q8, owned by LevelScene.
 
- Protected Attributes inherited from bomberman::Scene
Gamegame = nullptr
 

Detailed Description

Client-side scene for one authoritative multiplayer match.

Member Function Documentation

◆ onExit()

void bomberman::MultiplayerLevelScene::onExit ( )
overridevirtual

Release multiplayer scene state before leaving the scene.

Reimplemented from bomberman::LevelScene.

◆ onKeyPressed()

void bomberman::MultiplayerLevelScene::onKeyPressed ( SDL_Scancode  scancode)
overrideprotectedvirtual

Handle scene-local key presses such as leaving the match.

Reimplemented from bomberman::LevelScene.

◆ onNetInputQueued()

void bomberman::MultiplayerLevelScene::onNetInputQueued ( uint32_t  inputSeq,
uint8_t  buttons 
)
overridevirtual

Consume one locally queued input for prediction and presentation.

Reimplemented from bomberman::Scene.

◆ supportsPause()

bool bomberman::MultiplayerLevelScene::supportsPause ( ) const
inlineoverrideprotectedvirtual

Multiplayer matches cannot be paused locally.

Reimplemented from bomberman::LevelScene.

◆ updateLevel()

void bomberman::MultiplayerLevelScene::updateLevel ( unsigned int  delta)
overrideprotectedvirtual

Run one multiplayer gameplay frame.

Implements bomberman::LevelScene.

◆ usesEventDrivenLocalMovement()

bool bomberman::MultiplayerLevelScene::usesEventDrivenLocalMovement ( ) const
inlineoverridevirtual

This scene applies movement from queued network input instead of events.

Reimplemented from bomberman::LevelScene.

◆ wantsNetworkInputPolling()

bool bomberman::MultiplayerLevelScene::wantsNetworkInputPolling ( ) const
overridevirtual

Return whether local gameplay input should currently be polled.

Reimplemented from bomberman::Scene.


The documentation for this class was generated from the following files: