123456789101112131415161718192021222324252627282930313233 |
- #include "server/Game.h"
- #include "server/GameServer.h"
- #include "server/commands/Commands.h"
- #include "server/snuviscript/Snuvi.h"
- void loop() {
- Clock clock;
- constexpr Clock::Nanos NANOS_PER_TICK = 50000000;
- Clock::Nanos lag = 0;
- while(Game::isRunning()) {
- lag += clock.update();
- while(lag >= NANOS_PER_TICK) {
- lag -= NANOS_PER_TICK;
- GameServer::tick();
- Game::tick();
- }
- Clock::Nanos waitNanos = NANOS_PER_TICK - lag;
- if(waitNanos > 300000) {
- clock.wait(waitNanos);
- }
- }
- }
- int main() {
- Snuvi::init();
- Commands::init();
- if(GameServer::init(11196, 50)) {
- return 0;
- }
- Game::init();
- loop();
- return 0;
- }
|