Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.
pgrossma edited this page Jan 24, 2024 · 8 revisions

Map (Server -> Client)

Datatypes:

  • number -> ulong/ u64

Authentication

Has to be sent once after socket connection

{
   "id": 42 //ID 42 is for spectators, can not be 0
}

Config

  • active stats always in 1/second
{
	"width": number, //min: 2 max: todo
	"height": number, //min: 2 max: todo
	"idle_income": number, //a value of the currency every team gets per second
	"core_hp": number,
	"teams": [
		{
			"id": number,
			"name": string
		}
	],
	"units": [
		{
			"name": string,
			"type_id": number,
			"cost": number,
			"hp": number,
			"dmg_core": number,
			"dmg_unit": number,
			"dmg_resource": number,
			"max_range": number, //maximal range to attack a unit
			"min_range": number, //minimal range to target to attack
			"speed": number,
		},
	]
}

State

{
	"status": number [0 OK | 1 PAUSED | 2 END | 3 WAIT_FOR_CLIENTS],
	"cores": [
		{
			"id": number,
			"team_id": number,
			"x": number,
			"y": number,
			"hp": number
		}
	],
	"resources": [
		{
			"id": number,
			"type_id": number,
			"value": number,
			"x": number,
			"y": number,
			"hp": number,
		}
	],
	"units": [
		{
			"id": number,
			"type_id": number, //defines type of unit [warrior | worker ...]
			"hp": number,
			"x": number,
			"y": number,
			"team_id": number,
		}
	],
	"teams": [
		{
			"id": number,
			"balance": number
		}
	]
}

Request (Client -> Server)

{
	"actions": [
		{
			"Create": {
				"type_id": number, //creates unit next to core
			}
		},
		{
			"TravelTo": {  // travel with x = 0 and y = 0 stops the unit
				"id": number,
				"x": number,
				"y": number
			}
		},
		{
			"TravelDir": {  // travel with x = 0 and y = 0 stops the unit
				"id": number,
				"x": number,
				"y": number
			}
		},
		{
			"Attack": { //also used for collecting ressources
				"attacker_id": number,
				"target_id": number, // if you put yourself as target you stop attacking
			}
		}
	]
}

IMPORTANT!! Inside the JSON there are no '\n' allowed. The responses are split on '\n'

Clone this wiki locally