cs4344 09/10 lecture 8: hybrid architecture

102
Lecture 8 Hybrid Architecture for Games 15 March 2010 1

Upload: wei-tsang-ooi

Post on 05-Dec-2014

950 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Lecture 8Hybrid Architecture

for Games

15 March 2010

1

singlecentralized

server

completelydecentralized

2

P2P with Central Arbiter

3

A trusted central arbiter receives all game traffic and resolves conflicts if necessary.

4

Benefits ofP2P + Arbiter

5

low latency among players

6

have trusted authority now

7

Drawbacks ofP2P + Arbiter

8

limited scalability

arbiter becomes bottleneck

9

Mirrored ServersArchitecture

10

Multiple servers, each replicates the complete game states and serves clients from different geographical regions. Each client connects to one server.

11

Servers may be connected with high speed, provisioned networked, reducing synchronization latency among the servers.

12

Updates from a client are sent to its server, which then forwards it to other servers. The servers then forward the updates to all relevant clients.

13

P2P-style state synchronization among servers is easier, since 1. servers can be trusted2. clocks can be synchronized3. IP multicast may be used4. higher availability5. shorter delay

14

Benefits ofMirrored Servers

15

no single point of failures

A client can use another replicated server if their nearest server fails.

16

increase total network capacity

good if networking bandwidth is the bottleneck

17

lower latency between client and server

18

Drawbacks ofMirrored Servers

19

latency between players increases

due to additional forwarding

20

cannot scale to large world

each server still keeps the complete states

21

Q: How to assign players to servers?

22

Assigning players to closest servers may lead to overloaded servers.

23

Assigning players to remote servers may increase end-to-end latency.

24

But we only care about latency between players that are relevant to each other.

25

Zoned ServersArchitecture

26

Divide the game world into independent regions. One server is in-charged of one region.

27

A client connects to the server serving its current region, and is handed-off to another server when it moves to another region.

28

Servers seldom communicate with each other.

29

Updates from a client are sent to its server, which then forwards it to all relevant clients in the same region.

30

31

Advantages of Zoned Servers

32

Can scale to large world

Just add more servers

33

Drawbacks of Zoned Servers

34

Single point of failures

(But can deploy mirrors for each region)

35

Constrained Game Designs

36

Supporting Seamless Game Worlds

37

Divide the game world into regions. One server is in-charged of one region.

38

Player may move around the world seamlessly

39

A client may see events and objects from neighboring regions.

40

Events occurring in one region may affectobjects in another region.

41

Advantage: Partitioning is transparent to the players. No artificial constraints in game design.

42

Advantage: We can now resize the regions to load-balance among the servers, improving server utilization.

43

A client connects to the server serving its current region, and is handed-off to another server when it moves to another region.

44

Server communicates with each other to transfer states, update states etc.

45

Updates from a client are sent to its server, which then forwards it to all relevant clients in the same region or neighboring regions.

46

or

47

A client connects to the servers serving its current region and regions it subscribes to. Updates from neighboring server are sent directly.

48

Q: How to partition the game world?

49

Ideally: each server should handle the same

number of players

50

Ideally: minimize communications between servers

51

Ideally: minimize the number of hand offs

52

Generic Gaming Proxies

53

Proxy: trusted host providing specialized services for games

54

Proxy: typically close to the players

55

Examples of Proxy Services:

Time-stampingMessage Ordering

Interest Management

56

Example 1:Time-stamping Services

57

Timestamp Cheat inP2P Games

58

Player generates fake, earlier timestamp to gain advantage after knowing the opponent's move.

(m1,t1)

(m2,t0)

59

(m1,t1)

(m2,t2)

But such cheat is impossible if a trusted proxytimestamp the messages instead of the players.

m2

(m2,t2)(m2,t2)

m1

Proxy

Proxy

60

(m1,t1,s)

(m2,t2,s)

The proxy can digitally signed the message to proof that he is the one that added the timestamp.

m2

(m2,t2)(m2,t2)

m1

Proxy

Proxy

61

Timestamp Servers is generic and is game

independent

62

Example 2:Message Ordering

63

Client/Server Architecture

64

Game is divided into rounds based on updatesfrom the server.

65

Messages (action) from players are grouped into rounds. Reaction time is the time between receiving

message from server and sending an action.

Reaction Time

66

We want to deliver messages to the server in the following order:

67

1. for a player, messages are delivered in the order they are generated.

68

69

2. messages from the same round from different players are delivered in increasing order of “reaction time”.

70

Messages are not delivered according to reaction time.

71

3. messages in a round is delivered to the server before messages from the subsequence rounds.

72

The second green message from the top playerviolates this condition.

73

Server

Server Proxy

Player Proxies

Players

74

Ui

(Ui, i)(Ui, i)

The server proxy tags each message (“updates”) from the server with the round number.

75

Ri

(Ui, i)(Ui, i)

The player proxy remembers Ri, the time message Ui is received, and forwards it to players.

76

Aij

Action messages from the players are tagged by the player proxies with (i) round number i (ii) reaction time tij and (iii) order of action messages from that player.

Aij, i, tij, k

Pj

77

Example of tags inserted by the proxy.

ProxyP2

Proxy

t12 t22 t32

k=1 k=2 k=1 k=1

78

The server proxy now determines two things:(i) in what order to deliver the messages, and (ii) when to delivery the messages

Aij, i, tij, k

Pj

Aij’, i’, tij’, k’

79

Delivery order: sort the queue according to round number, then by reaction time. Deliver messages in the order inside the queue.

80

Delivery time: can deliver the head of the queue as long as no other messages from the same round is still in transit.

81

ServerProxy

PlayerProxy j

PlayerProxy

Receive Time = RTTj + tij + Si

Si

tij

RTTj + tij + Si

82

RTTj + tij + Si

Message from k within the same round i should be sent first if tik < tij

83

RTTj + tij + Si < RTTk + tik + Si

If message from k is still in transit when message from j is received, then

< RTTk + tij + Si

84

RTTj + tij + Si < RTTk + tik + Si

If message from k is still in transit when message from j is received, then

< RTTk + tij + Si

If message from j is delivered at this time, then message from k should have arrived

85

max {RTTk} + tij + Si

It is safe to set the delivery time of a message from j to be

k in the set of hostswhose messages have not arrived

86

Example: Consider a given round i. Si = 0ti1 = 1 ti2 = 2 ti3 = 3RTT1 = 10 RTT2 = 20 RTT3 = 10

At time 11, message from Player 1 is received.Delivery time for message 1 = 21

1

87

1

Example: Consider a given round i. Si = 0ti1 = 1 ti2 = 2 ti3 = 3RTT1 = 10 RTT2 = 20 RTT3 = 10

At time 13, message from Player 3 is received.Delivery time for message 3 = 23

3

88

Example: Consider a given round i. Si = 0ti1 = 1 ti2 = 2 ti3 = 3RTT1 = 10 RTT2 = 20 RTT3 = 10

At time 21, message from Player 1 is delivered

3

89

Example: Consider a given round i. Si = 0ti1 = 1 ti2 = 2 ti3 = 3RTT1 = 10 RTT2 = 20 RTT3 = 10

At time 22, message from Player 2 is received.Delivery time for message 2 = 12. The messageis sent right away. At time 23, message from Player 3 is delivered.

(We can actually delivery message 3 earlier as an optimization)

23

90

When a message is inserted into the queue, the delivery time of messages ahead in the queue may shorten, while the delivery time messages behind remains unchanged.

max {RTTk} + tij + Sik in set of hostswhose messages have not arrived

max {RTTk} + tij + Sik in set of hostswhose messages have not arrived

now

>

91

max {Ti-1, max {RTTk} + tij + Si}

Consider the case where messages from previous round is still in transit,

the delivery time should be set as

k = set of hostswhose messages have not arrived

where Ti-1 is the time where maximum delivery time from previous round

92

What if a message is late?

Then it is delivered immediately to the server

93

Advantages: No need to synchronize clock or estimate one way delay.

Estimating RTT is easier.

94

Server

Server Proxy

Player Proxies

Players

95

Examples of Proxy Services:

Time-stampingMessage Ordering

Interest Management

96

Example 3:Interest Management

97

Servers

Proxies

Players

Regions 1 2 3 4

Regions 1 3 41 2 32

98

Servers

Proxies

Players

Regions 1 2 3 4

Regions 1 3 41 2 32

99

Servers

Proxies

Players

Regions 1 2 3 4

Regions 1 3 41 23 32

100

Advantages:

Reduced network cost at server

No connect/disconnect at clients when player moves/region migrates

101

P2P + arbitermirrored servers

zoned serversservers + proxies

102