2 Player GameRoom Extension using Firebase

:video_game: Transform the Way You Build Multiplayer Games

Say goodbye to the complexities of adding real-time multiplayer functionality. GameRoom makes it seamless, fast, and fun.

  • Simplify Development: Create rooms and manage roles effortlessly.
  • Save Time: Build 2-player games in just 1 hour, not half a day.
  • Proven Results: I used it to rebuild a Pong game in record time!

Blocks
SetPlayerId
component_set_get (2)

Set a unique player name to be used in the room.playerId should be set before calling joinRoom function

JoinRoom
component_method (8)

Join/Create room in the given room id.

StoreMyValue
component_method (9)

Store players data

StoreValueAsHostIfHost
component_method (10)

Some values like ball in a pong game cannot be stored by both two players because that cause synchronisation issues.So we select one player as host and uploads his data using this block.This block only works if player is the host.

ClearRoomData
component_method (11)

For reusing of roomcodes room data should be cleared at the time of exit.This method is used to clear the room.

OpponentDataChanged
component_event (8)

Triggers when data of opponent changes. Returns a dictionary containing all the data of opponent.

HostDataChanged
component_event (9)

Triggers when data of host changes

PlayerJoined
component_event (10)

Triggers when a player is joined.

Implementation Example of 2 player pong game


:point_right: Message me to know the price and start building smarter. Let’s make game development stress-free!

1 Like

Nice work.

But this can be done without extension also by using firebase realtime database and some logic.

2 Likes

You are right.But it is very complex and make the block editor crowded with lot of confusing blocks. If an error occurs , it makes hard to debug the error because of the high number of blocks