Photon——Lite Lobby Concepts Lite Lobby概念
Lite Lobby Concepts Lite Lobby概念
Lite Lobby is an application that (literally) extends the Lite Application to offer a listing of currently used rooms. To achieve this, it implements two different types of rooms: the LiteLobbyRoom and a LiteLobbyGame.By convention, join will put you into a lobby when the given room name ends on “_lobby” and into a game room in all other cases. The operation join got an optional parameter to name a lobby where the game is listed. This puts the responsibility on the client side again and you can create lobbies on the fly.
Lite Lobby 是一个应用程序,它扩展了Lite应用程序提供了一个房间的清单。为了达到这个目标, 它实现了两种不同类型的房间:LiteLobbyRoom和一个 LiteLobbyGame。按照惯例,当给定的房间的名称在“_lobby”的结尾时,加入操作会使你进入一个大厅,并进入这个游戏房间。加入操作获得一个可选的参数去命名一个游戏列表的大厅。这由客户端负责,你可以创建大厅。
Lobby 大厅
The lobby rooms (LiteLobbyRoom.cs) are special as they are not used to play a match with opponents. They just provide a list of available rooms (games) instead, so player can choose and join those.Despite being a room, too, a lobby won’t send events on join and leave of actors. As a result, players inside a lobby don’t notice each other which prevents a flood of join/leave events. There are no operations aside from leave. As a player leaves rooms when joining another, leave is not even required.On join, the complete games list is sent once to get a client up to date. After that, each player gets the same update event, which is sent every few seconds. It lists each game by name its current number of players. The clients keep and update their initial list. Games that are empty or full, both simply report 0 players as they should no longer be in the room list.To send the room list in intervals, the lobby schedules a message for itself, once the list is sent. This enqueues the event sending in the regular message passing mechanism, avoiding threading issues.
大厅的房间(LiteLobbyRoom.cs)是特别的,因为他们不是用于玩家游戏的。他们只是提供了一个可用房间的列表,因此玩家可以选择和加入。尽管是一个房间,一个大厅不会发送事件在玩家加入和离开的时候。因此,玩家在一个大厅不会通知其他的玩家,这可以防止大量的加入/离开事件被发送。除了离开没有别的操作。作为一个玩家离开房间加入另一个时,离开请求甚至是不需要的。在加入时,完整的游戏列表发送一次去获得一个客户端。在那之后,每个玩家获得同样的更新事件,它每隔几秒钟就被发送一次。它列出每个游戏的名字和目前的玩家数量。客户端保持和更新他们的列表。游戏是空的或是是满的,都只是报告0个玩家,他们不再是在房间列表里。一定时间间隔内发送房间列表,大厅安排一个消息在每次列表发送的时候。这种事件队列发送在常规消息传递机制中,可避免线程问题。
Rooms for Games 游戏房间
In Lite Lobby, regular games can now be connected to a lobby. The lobby of a room is set when gets created. If the lobby does not exist, it will be created as well.Once a room is connected to a lobby it is responsible to update the lobby with its info. The lobby itself does not mind what’s forwarded as info to the clients. By default, each room only sends its actor count and will be “full” when 4 players are in a room.
在LiteLobby中,常规的游戏现在可以被连接到一个大厅。一个房间的大厅是设置在被创建的时候。如果大厅不存在,它会被创建。一旦一个房间是连接到一个大厅,它将负责更新其信息在这个大厅里。大厅本身并不明白信息到客户端转发的是什么。默认情况下,每个房间只有发送它自己的玩家计数,并且当4个玩家在一个房间里时为full。
LiteLobby Config LiteLobby配置
To avoid incompatibilities, Lite Lobby uses its application config file to define the event types, update interval and the lobby suffix.Some values can’t be edited this way yet: count of users to make a room “full”, event-values and more.Lite Lobby can be running parallel to Lite but usually a game would use just one of those. The SDKs Photon Config assigns the name Lite Lobby (used by the clients on connect).
为了避免不兼容,用Lite Lobby配置文件来定义事件类型,更新时间间隔和大厅后缀。一些值不能被这样的方式编辑:用户计数使得一个房间 “full”,事件值还有更多。Lite大厅可以平行运行,Lite通常会使用其中的一个游戏。这个SDKs Photon配置指定Lite大厅的名字 (客户端使用的连接)。