oneshot synchronization
[carveJwlIkooP6JGAAIwe30JlM.git] / player_remote.h
1 #ifndef PLAYER_REMOTE_H
2 #define PLAYER_REMOTE_H
3
4 #include "player.h"
5 #include "network.h"
6 #include "network_common.h"
7
8 #define NETWORK_SFX_QUEUE_LENGTH 12
9
10 struct {
11 struct network_player {
12 int active;
13 u16 board_view_slot, playermodel_view_slot;
14 enum player_subsystem subsystem;
15
16 /* this is set IF they exist in a world that we have loaded */
17 world_instance *active_world;
18 int hub_match, client_match;
19
20 /* TODO: Compression with server code */
21 char username[ NETWORK_USERNAME_MAX ];
22 char items[k_netmsg_playeritem_max][ADDON_UID_MAX];
23
24 u32 down_bytes;
25 f32 down_kbs;
26 }
27 list[ NETWORK_MAX_PLAYERS ];
28
29 struct interp_buffer {
30 /* collect the most recent 6 frames of animation data */
31 struct interp_frame {
32 int active;
33 f64 timestamp;
34 enum player_subsystem subsystem;
35
36 u8 instance_id;
37 u16 boundary_hash;
38
39 union interp_animdata {
40 struct player_skate_animator _skate;
41 struct player_walk_animator _walk;
42 struct player_dead_animator _dead;
43 }
44 data;
45 }
46 frames[ NETWORK_BUFFERFRAMES ];
47
48 f64 t;
49 }
50 interp_data[ NETWORK_MAX_PLAYERS ];
51
52 struct net_sfx sfx_queue[ NETWORK_SFX_QUEUE_LENGTH ];
53
54 m4x3f *final_mtx;
55 struct player_board_pose board_poses[ NETWORK_MAX_PLAYERS ];
56
57 u32 up_bytes;
58 f32 up_kbs, down_kbs;
59 f64 last_data_measurement;
60 }
61 static netplayers;
62
63 static void player_remote_rx_200_300( SteamNetworkingMessage_t *msg );
64 static void remote_player_debug_update(void);
65 static void remote_player_send_playerframe(void);
66 static void animate_remote_player( u32 index );
67 static void render_remote_players( world_instance *world, camera *cam );
68 static void relink_all_remote_player_worlds(void);
69
70 #endif /* PLAYER_REMOTE_H */