PhotonServer
Options
tolkun
✭
How I can create room in Photon Server?
Was trying to extend Lite Application but I haven't idea how to use after?
I want to find any tutorials ,manuals about creating room in photon server!!!!Please help me..
Was trying to extend Lite Application but I haven't idea how to use after?
I want to find any tutorials ,manuals about creating room in photon server!!!!Please help me..
0
Comments
-
hi, tolkun
all what we have is here https://doc.photonengine.com/en-us/onpremise/current/getting-started/photon-server-intro
In lite rooms are created in response to Join operation. This opertation is handled by LitePeer. so, you may find there code. There should be a method something like HandleJoinOperation
best,
ilya1 -
@chvetsov thank u for reply. Yes I read all documentation about LitePeer https://doc.photonengine.com/en-us/onpremise/current/applications/lite-application
When actor connect,and send Join operation :
LitePeer.OpJoin("TestRoom", gameProperties, actorProperties, true), server creates single room "TestRoom" with this actor.
But I can't understand how creates room on the server side*?How I can to limit count of actors,
If i want only two actors in the each room.
How I can get list of actors each room*?
What does Game.cs,LiteGame.cs classes ?0 -
you also need to read about LoadBalancing to understand how it works.
Here is code from LitePeer.cs
protected virtual RoomReference GetRoomReference(JoinRequest joinRequest)
{
return LiteGameCache.Instance.GetRoomReference(joinRequest.GameId, this);
}
call to GetRoomReference creates game object and adds referenece to it. this referenece should be disposed at the end otherwise game will stock.
in order to limit players amount you may set MaxPlayers property of game.
Game class is used for LoadBalancing. it sends some updates to MasterServer. MasterServer gives you load balancing and match making
best,
ilya0 -
@chvetsov Now I'm extending Lite Application,not LoadBalancing .
I try to create server based on Lite Application ,and connect from client(unity),
I understand that's what I should use on client side:
namespace ExitGames.Client.Photon.Lite
{
public class LitePeer : PhotonPeer
{
public LitePeer(IPhotonPeerListener listener) : base(listener, ConnectionProtocol.Udp)
{
}
protected LitePeer() : base(ConnectionProtocol.Udp)
{
}
protected LitePeer(ConnectionProtocol protocolType) : base(protocolType)
{
}
public LitePeer(IPhotonPeerListener listener, ConnectionProtocol protocolType) : base(listener, protocolType)
{
}
public virtual bool OpChangeGroups(byte[] groupsToRemove, byte[] groupsToAdd)
{
if (this.DebugOut >= DebugLevel.ALL)
{
this.Listener.DebugReturn(DebugLevel.ALL, "OpChangeGroups()");
}
Dictionary opParameters = new Dictionary();
if (groupsToRemove != null)
{
opParameters[(byte)LiteOpKey.Remove] = groupsToRemove;
}
if (groupsToAdd != null)
{
opParameters[(byte) LiteOpKey.Add] = groupsToAdd;
}
return this.OpCustom((byte)LiteOpCode.ChangeGroups, opParameters, true, 0);
}
public virtual bool OpRaiseEvent(byte eventCode, bool sendReliable, object customEventContent)
{
return this.OpRaiseEvent(eventCode, sendReliable, customEventContent, 0, EventCaching.DoNotCache, null, ReceiverGroup.Others, 0);
}
public virtual bool OpJoin(string gameName)
{
return this.OpJoin(gameName, null, null, false);
}
public virtual bool OpJoin(string gameName, Hashtable gameProperties, Hashtable actorProperties, bool broadcastActorProperties)
{
if (this.DebugOut >= DebugLevel.ALL)
{
this.Listener.DebugReturn(DebugLevel.ALL, "OpJoin(" + gameName + ")");
}
Dictionary opParameters = new Dictionary();
opParameters[(byte)LiteOpKey.GameId] = gameName;
if (actorProperties != null)
{
opParameters[(byte)LiteOpKey.ActorProperties] = actorProperties;
}
if (gameProperties != null)
{
opParameters[(byte)LiteOpKey.GameProperties] = gameProperties;
}
if (broadcastActorProperties)
{
opParameters[(byte)LiteOpKey.Broadcast] = broadcastActorProperties;
}
return this.OpCustom((byte)LiteOpCode.Join, opParameters, true, 0, false);
}
public virtual bool OpLeave()
{
if (this.DebugOut >= DebugLevel.ALL)
{
this.Listener.DebugReturn(DebugLevel.ALL, "OpLeave()");
}
return this.OpCustom((byte)LiteOpCode.Leave, null, true, 0);
}
}
}
I send LitePeer.OpJoin("TestRoom", gameProperties, actorProperties, true), to server;
Server get opJoin and processing:
case OperationCode.Join:
this.HandleJoinOperation(operationRequest, sendParameters);
return;
Thats all;
I can't understand what should be in this case classes such as LiteGame,Room,RoomBase*?0 -
i do not really understand your question?
LiteGameCache class contains method "CreateGame" where you create Game object.
you also should take a look at MyApplication sampe to get some ideas
best,
ilya0