Skip to content

Commit

Permalink
room stream debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatbostanci committed Jun 10, 2021
1 parent 42c889c commit e98dfc2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions handler/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func (h *MultiplayerHandler) RoomStream(stream pb.MultiplayerService_RoomStreamS
h.rooms = make(map[string]map[string]*pb.Player)
}

var currentTick int64 = 0

for {
request, err := stream.Recv()
if err != nil {
Expand All @@ -66,6 +68,11 @@ func (h *MultiplayerHandler) RoomStream(stream pb.MultiplayerService_RoomStreamS
h.rooms[request.GetRoomId()] = make(map[string]*pb.Player)
}

currentTick++
if currentTick%32 == 0 {
log.Trace().Msg(request.String())
}

h.rooms[request.GetRoomId()][request.GetPlayer().GetId()] = request.GetPlayer()

currentPlayers := make([]*pb.Player, 0, len(h.rooms[request.GetRoomId()]))
Expand Down

0 comments on commit e98dfc2

Please sign in to comment.