78 lines
2.3 KiB
C
78 lines
2.3 KiB
C
#include "libsuicmez/libsuicmez.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include <string.h>
|
|
|
|
|
|
// Helper for allocating arrays
|
|
static void* suic_alloc_array(const TypeInfo* type, size_t elem_size, size_t len, void* init_data) {
|
|
void* ptr = gc_alloc(type, elem_size * len);
|
|
if (init_data) memcpy(ptr, init_data, elem_size * len);
|
|
return ptr;
|
|
}
|
|
|
|
// Helper for allocating structs
|
|
static void* suic_alloc_struct(const TypeInfo* type, size_t size, void* init_data) {
|
|
void* ptr = gc_alloc(type, size);
|
|
if (init_data) memcpy(ptr, init_data, size);
|
|
return ptr;
|
|
}
|
|
|
|
void* gc_alloc(const TypeInfo* type, size_t size);
|
|
void gc_init(void);
|
|
void gc_shutdown(void);
|
|
|
|
int suic_main(void);
|
|
|
|
int suic_main(void) {
|
|
char* SERVER_HOST = suic_alloc_array(NULL, sizeof(char), 10, "127.0.0.1");
|
|
int SERVER_PORT = 8888;
|
|
int MAX_PLAYERS = 100;
|
|
int MAX_CONNECTIONS = 128;
|
|
int NETWORK_TICK_RATE = 20;
|
|
int NETWORK_TIMEOUT_MS = 30000;
|
|
int MATCH_DURATION_SECONDS = 600;
|
|
int ZONE_SHRINK_START = 120;
|
|
int ZONE_SHRINK_INTERVAL = 60;
|
|
float INITIAL_SAFE_ZONE_RADIUS = 200.000000;
|
|
float FINAL_SAFE_ZONE_RADIUS = 20.000000;
|
|
int ISLAND_SIZE_X = 512;
|
|
int ISLAND_SIZE_Z = 512;
|
|
int ISLAND_MAX_HEIGHT = 128;
|
|
float ISLAND_SCALE = 50.000000;
|
|
int ISLAND_OCTAVES = 6;
|
|
suic_ode_init();
|
|
void* world = suic_ode_world_create();
|
|
void* null_space = NULL;
|
|
void* space = suic_ode_simple_space_create(null_space);
|
|
suic_ode_world_set_gravity(world, 0.000000, -9.810000, 0.000000);
|
|
void* contactgroup = suic_ode_joint_group_create(0);
|
|
void* ground_geom = suic_ode_create_plane_geom(space, 0.000000, 1.000000, 0.000000, 0.000000);
|
|
int tick = 0;
|
|
float tick_interval = (1.000000 / 20.000000);
|
|
while (true) {
|
|
tick = (tick + 1);
|
|
suic_ode_space_collide(world, space, contactgroup);
|
|
suic_ode_world_step(world, tick_interval);
|
|
suic_ode_joint_group_empty(contactgroup);
|
|
}
|
|
suic_ode_geom_destroy(ground_geom);
|
|
suic_ode_joint_group_destroy(contactgroup);
|
|
suic_ode_space_destroy(space);
|
|
suic_ode_world_destroy(world);
|
|
suic_ode_close();
|
|
return 0;
|
|
}
|
|
|
|
int main(int argc, char* argv[]) {
|
|
// Initialize GC
|
|
gc_init();
|
|
// init globals
|
|
// init event loop
|
|
int result = suic_main();
|
|
// Shutdown GC
|
|
gc_shutdown();
|
|
return result;
|
|
}
|
|
|