Example JSON Messages - fractalbach/gamenet GitHub Wiki
Abstract Event
{
"AbstractEvent": {
"EventId": 12345,
"SourceId": 12345,
"TargetId": 1234,
"EventType": "move",
"SourceType": "PlayerClient",
"TargetType": "Server",
"Position": [
0.132,
0.234,
0.352
]
}
}
How the structure is represented on the server:
type AbstractEvent struct {
EventId int
SourceId int
TargetId int
EventType string
TargetType string
SourceType string
Position []int
}
Example Game State
Game state messages are arrays, with an ID integer corresponding to an Entity object. These are from the server.
{
"1": {
"Name": "arthur dent",
"Type": "human",
"Location": [
-48,
-42
]
},
"2": {
"Name": "teapot",
"Type": "item",
"Location": [
3,
4
]
},
"3": {
"Name": "towel",
"Type": "towel",
"Location": [
9,
5
]
},
"4": {
"Name": "vogon",
"Type": "alien",
"Location": [
30,
40
]
},
"42": {
"Name": "the ultimate answer",
"Type": "unknown",
"Location": [
-100,
-345
]
}
}
AbstractEvent
- // unique event id
- // id of event source
- // id of target, or null
- // type of source obj
- // type of target obj
- // id of event responded to, or null