Quantcast
Channel: Photon Server — Photon Engine
Viewing all articles
Browse latest Browse all 1557

SYNC'in entities in a room and correlation between "messages/sec" and "events/sec"

$
0
0
Hello everyone!

I would like to ask about the following situation:
1) I have one room and this room has 10 monsters and 10 users.
2) This room updates every 100ms. One update means update means updating the positions of the monsters (users are assumed to be NOT moving)
3) At the end of each update, I would like to send the current room's situation to the each user(peer). Current room situation means x(integer) and y(integer) coordinates of each monster to keep it simple.

I have defined the following Event DataContract=>

public class MonsterPositionEvent : DataContract
{
[DataMember(Code = (byte)1]
public int x { get; set; }

[DataMember(Code = (byte)2]
public int y { get; set; }

}

4) At the end of each update inside a Game object, I create
foreach(var monster in MonsterList){
var monsterEvent = new MonsterPositionEvent{x = Position X of Monster 1, y= Position Y of Monster 1};
var eventData = new EventData((byte)EventCode.MonsterPosition, monsterEvent);
this.ExectionFiber.Enqueue(()=>PublishEvent(eventData,actors,new SendParameters()));
///Enqueue one event per monster to each client, at the end I have 10 users with 10 events enqueued I think
}
5) Enqueue one event per monster to each client, at the end I have 10 users with 10 events enqueued I think.
6) When the events are dispatched to clients, does it count as 100 messages or since each event is quite small(overhead included ~60byte times 10 events 600bytes) they are sent as 1 message per client (10 messages in total)?
7) What are other good ways to sync room entitites to each client?

Thanks in advance

Viewing all articles
Browse latest Browse all 1557

Trending Articles