DEADSOFTWARE

Поправлены тайминги, теперь скорости точно не зависят от количества тиков. :)
[netwar.git] / game.h
1 #include <stdbool.h>
3 #include "protocol.h"
5 #define MAX_PLAYERS 32
6 #define MAX_BULLETS (MAX_PLAYERS * 8)
7 #define TICK 24 // 24 World updates per second
8 #define TICK_DELAY (1000 / TICK) // World freeze time ms
9 #define BULLET_TIME (TICK * 6) // Bullet live time 6.0s
10 #define PLAYER_SIZE 0.01785 // Palyer radius
11 #define PLAYER_SHOOT (TICK * 0.8) // Can shoot every 1.0s (less then 1s not work)
13 typedef struct Player {
14 /* public */
15 bool live;
16 float x, y, r;
17 float vx, vy, vr;
18 int shoot;
20 /* internal */
21 bool updated;
22 } Player;
24 typedef struct Bullet {
25 /* public */
26 bool live;
27 int owner;
28 float x, y;
29 float vx, vy;
30 int tick;
32 /* internal */
33 bool updated;
34 } Bullet;
36 extern Player g_player[MAX_PLAYERS];
37 extern Bullet g_bullet[MAX_BULLETS];
39 void g_player_set(unsigned int id, bool live, float x, float y, float r, float vx, float vy, float vr, int shoot);
40 void g_bullet_set(unsigned int id, unsigned int owner, bool live, float x, float y, float vx, float vy, int tick);
41 void g_player_does(unsigned int id, DoesBits code);
42 void g_update();
43 void g_init(bool server_mode);