9#define ALIGNED __attribute__((aligned(4)))
11typedef float ipc_real_t;
12typedef uint64_t ipc_guid_t;
107const size_t IPC_FOOD_MAX_BYTES = 1 * 1024*1024;
108const size_t IPC_FOOD_MAX_COUNT = IPC_FOOD_MAX_BYTES /
sizeof(
struct IpcFoodInfo);
110const size_t IPC_BOT_MAX_COUNT = 1024;
111const size_t IPC_BOT_MAX_BYTES = IPC_BOT_MAX_COUNT *
sizeof(
struct IpcBotInfo);
113const size_t IPC_SEGMENT_MAX_BYTES = 1 * 1024*1024;
114const size_t IPC_SEGMENT_MAX_COUNT = IPC_SEGMENT_MAX_BYTES /
sizeof(
struct IpcSegmentInfo);
116const size_t IPC_COLOR_MAX_COUNT = 1024;
117const size_t IPC_COLOR_MAX_BYTES = IPC_COLOR_MAX_COUNT *
sizeof(
struct IpcColor);
119const size_t IPC_LOG_MAX_BYTES = 1024;
121const size_t IPC_PERSISTENT_MAX_BYTES = 4096;
171 enum IpcRequestType type;
174enum IpcResponseType {
185 enum IpcResponseType type;
IPC representation of a bot.
Definition: ipc_format.h:79
ipc_guid_t bot_id
Bot ID.
Definition: ipc_format.h:80
IPC representation of a color value.
Definition: ipc_format.h:101
uint8_t g
Green channel (0-255)
Definition: ipc_format.h:103
uint8_t b
Blue channel (0-255)
Definition: ipc_format.h:104
uint8_t r
Red channel (0-255)
Definition: ipc_format.h:102
IPC representation of a food particle.
Definition: ipc_format.h:68
ipc_real_t val
Food value.
Definition: ipc_format.h:71
ipc_real_t dist
Distance measured from the center of your head.
Definition: ipc_format.h:73
ipc_real_t x
Relative position X in world orientation.
Definition: ipc_format.h:69
ipc_real_t y
Relative position Y in world orientation.
Definition: ipc_format.h:70
ipc_real_t dir
Direction angle relative to your heading (range -π to +π)
Definition: ipc_format.h:72
A request to the bot by the gameserver.
Definition: ipc_format.h:170
Definition: ipc_format.h:188
ipc_real_t deltaAngle
Direction change in this frame (radians, -π to +π).
Definition: ipc_format.h:189
bool boost
Set to true to boost.
Definition: ipc_format.h:190
Response of the Bot.
Definition: ipc_format.h:184
IPC representation of a snake segment.
Definition: ipc_format.h:87
bool is_self
True if this segment belongs to ones own snake.
Definition: ipc_format.h:95
ipc_real_t dist
Distance between the center of your head and the segment's center.
Definition: ipc_format.h:92
ipc_guid_t bot_id
Bot ID.
Definition: ipc_format.h:94
ipc_real_t dir
Direction angle relative to your heading (range -π to +π)
Definition: ipc_format.h:91
ipc_real_t r
Segment radius.
Definition: ipc_format.h:90
ipc_real_t y
Relative position Y in world orientation.
Definition: ipc_format.h:89
ipc_real_t x
Relative position X in world orientation.
Definition: ipc_format.h:88
uint32_t idx
Segment number starting from head (idx == 0)
Definition: ipc_format.h:93
IPC representation of one's own snake and current world parameters.
Definition: ipc_format.h:17
ipc_real_t consumed_food_hunted_by_self
Amount of food you consumed and that was created from snakes you killed.
Definition: ipc_format.h:30
uint32_t start_frame
Frame number when your snake was spawned.
Definition: ipc_format.h:23
ipc_real_t consume_radius
Radius around your snake's head in which food is consumed.
Definition: ipc_format.h:21
ipc_real_t speed
Distance per step.
Definition: ipc_format.h:26
ipc_real_t mass
Your Snake's current mass.
Definition: ipc_format.h:19
uint32_t current_frame
Current frame number.
Definition: ipc_format.h:24
ipc_real_t consumed_food_hunted_by_others
Amount of food you consumed and that was created from snakes others killed (carrion)
Definition: ipc_format.h:31
ipc_real_t consumed_natural_food
Amount of "naturally" spawned food your snake consumed.
Definition: ipc_format.h:29
ipc_real_t segment_radius
Radius of your snake's segments.
Definition: ipc_format.h:18
ipc_real_t sight_radius
Radius around your snake's head in which you can see food and segments.
Definition: ipc_format.h:20
ipc_real_t max_step_angle
Maximum direction change in this step.
Definition: ipc_format.h:27
IPC representation of the static server and world configuration.
Definition: ipc_format.h:40
ipc_real_t log_initial_credits
How many log messages you can send right after startup.
Definition: ipc_format.h:61
ipc_real_t snake_segment_distance_exponent
segment distance = (mass * factor)^exponent
Definition: ipc_format.h:49
uint32_t snake_boost_steps
Number of steps a snake moves per frame while boosting.
Definition: ipc_format.h:41
ipc_real_t snake_turn_radius_factor
Multiplied with your segment radius to determine the inner turn radius.
Definition: ipc_format.h:42
ipc_real_t snake_self_kill_mass_threshold
Mass below which a snake dies through starvation.
Definition: ipc_format.h:56
ipc_real_t snake_boost_loss_factor
Multiplied with the snakes mass to determine how much mass is lost per frame while boosting.
Definition: ipc_format.h:53
ipc_real_t food_decay_step
Food decays by this value each frame.
Definition: ipc_format.h:58
ipc_real_t snake_segment_distance_factor
segment distance = (mass * factor)^exponent
Definition: ipc_format.h:48
ipc_real_t log_max_credits
You can send at most this many messages in a row.
Definition: ipc_format.h:62
ipc_real_t snake_pull_factor
Pull-together factor (determines how fast segments move to the center of a loop)
Definition: ipc_format.h:44
ipc_real_t snake_consume_range
consume range multiplier (multiplied with segment radius)
Definition: ipc_format.h:51
ipc_real_t snake_conversion_factor
how much of a snake's mass is converted to food when it dies
Definition: ipc_format.h:46
ipc_real_t log_credits_per_frame
How many log messages you can send per frame.
Definition: ipc_format.h:60
ipc_real_t snake_survival_loss_factor
This part of your mass is dropped every frame (to limit snake growth)
Definition: ipc_format.h:54
Shared memory structure.
Definition: ipc_format.h:129
uint32_t faceID
Select a face for your snake (not used yet).
Definition: ipc_format.h:148
struct IpcSelfInfo selfInfo
Information about your snake (updated every frame).
Definition: ipc_format.h:132
uint32_t dogTagID
Select a dog tag for your snake (not used yet).
Definition: ipc_format.h:149
struct IpcBotInfo botInfo[IPC_BOT_MAX_COUNT]
List of bots related to segments in segmentInfo.
Definition: ipc_format.h:138
uint8_t persistentData[IPC_PERSISTENT_MAX_BYTES]
Persistent data: will be saved after your snake dies and restored when it respawns.
Definition: ipc_format.h:151
struct IpcSegmentInfo segmentInfo[IPC_SEGMENT_MAX_COUNT]
List of segments seen by the snake.
Definition: ipc_format.h:141
uint32_t segmentCount
Number of items used in segmentInfo.
Definition: ipc_format.h:140
struct IpcColor colors[IPC_COLOR_MAX_COUNT]
Colors to set for this snake.
Definition: ipc_format.h:144
struct IpcFoodInfo foodInfo[IPC_FOOD_MAX_COUNT]
List of food items seen by the snake.
Definition: ipc_format.h:135
uint32_t botCount
Number of items used in botInfo.
Definition: ipc_format.h:137
uint32_t colorCount
Number of items used in colors.
Definition: ipc_format.h:143
char logData[IPC_LOG_MAX_BYTES]
Log data for the current frame.
Definition: ipc_format.h:146
uint32_t foodCount
Number of items used in foodInfo.
Definition: ipc_format.h:134
struct IpcServerConfig serverConfig
Information about the world and server configuration.
Definition: ipc_format.h:130
Definition: ipc_format.h:187