-
玩家們連線到某種匹配服務,匹配服務(一般透過玩家等級)將玩家匹配分組。
-
一旦玩家匹配成功,匹配服務通知遊戲管理器在伺服器叢集中提供一個專屬遊戲行程。
-
遊戲管理器在叢集中某臺機器上建立專屬遊戲服務。
-
遊戲管理器給專屬遊戲服務分配IP地址和服務埠,並傳回匹配器。
-
匹配器將傳回的IP地址和埠回傳給玩家
-
玩家們直連到專屬服務行程開始遊戲。
FROM debian:stretch
RUN useradd -m server
COPY ./bin/game-server /home/server/game-server
RUN chown -R server /home/server && \
chmod o+x /home/server/game-server
USER server
ENTRYPOINT ["/home/server/game-server"]
apiVersion: "stable.agon.io/v1alpha1"
kind: GameServer
metadata:
name: my-game-server
spec:
containerPort: 7654
# Pod template
template:
spec:
containers:
- name: my-game-server-container
image: gcr.io/agon-images/my-game-server:0.1
$ kubectl apply -f gamesever.yaml
gameserver "my-game-server" created
$ kubectl describe gameserver my-game-server
Name: my-game-server
Namespace: default
Labels:
Annotations:
API Version: stable.agones.dev/v1alpha1
Kind: GameServer
Metadata:
Cluster Name:
Creation Timestamp: 2018-02-09T05:02:18Z
Finalizers:
stable.agones.dev
Generation: 0
Initializers:
Resource Version: 13422
Self Link: /apis/stable.agones.dev/v1alpha1/namespaces/default/gameservers/my-game-server
UID: 6760e87c-0d56-11e8-8f17-0800273d63f2
Spec:
Port Policy: dynamic
Container: my-game-server-container
Container Port: 7654
Health:
Failure Threshold: 3
Initial Delay Seconds: 5
Period Seconds: 5
Host Port: 7884
Protocol: UDP
Template:
Metadata:
Creation Timestamp:
Spec:
Containers:
Image: gcr.io/agones-images/my-game-server:0.1
Name: my-game-server-container
Resources:
Status:
Address: 192.168.99.100
Node Name: agones
Port: 7884
State: Ready
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal PortAllocation 3s gameserver-controller Port allocated
Normal Creating 3s gameserver-controller Pod my-game-server-q98sz created
Normal Starting 3s gameserver-controller Synced
Normal Ready 1s gameserver-controller Address and Port populated
-
https://github.com/GoogleCloudPlatform/agones
-
https://github.com/GoogleCloudPlatform/agones/issues/70
-
https://github.com/GoogleCloudPlatform/agones/milestone/2
-
https://github.com/GoogleCloudPlatform/agones/blob/master/docs/installing_agones.md