Basic packet system done.

This commit is contained in:
2025-04-22 20:03:23 -05:00
parent 6b523301ab
commit d0a8f3813d
16 changed files with 331 additions and 29 deletions

View File

@ -34,9 +34,14 @@ int32_t main(const int32_t argc, const char **argv) {
entityInit(&GAME.entities[GAME.entityCount++], ENTITY_TYPE_PLAYER);
float_t lastPing = -1;
float_t time = 0;
while(true) {
inputUpdate();
consoleUpdate();
serverUpdate();
clientUpdate();
if(!CONSOLE.open) {
for(uint32_t i = 0; i < GAME.entityCount; i++) {
@ -47,8 +52,18 @@ int32_t main(const int32_t argc, const char **argv) {
renderresult_t result = renderDraw();
if(result != RENDER_OK) break;
if(exitRequested) break;
time += GetFrameTime();
if(time - lastPing > 1.0f) {
lastPing = time;
if(CLIENT.state != CLIENT_STATE_CONNECTED) continue;
packet_t packet;
packetPingCreate(&packet);
packetQueuePushOut(&CLIENT.packetQueue, &packet);
lastPing = time;
}
}
serverDispose();