Finished revision harvester behaviour. Added Some metrics for every loop.

This commit is contained in:
douwe
2025-08-21 23:35:00 +02:00
parent 1ede4cce47
commit 0c8da1d472
5 changed files with 126 additions and 99 deletions

View File

@@ -14,18 +14,22 @@ EMSCRIPTEN_KEEPALIVE
extern "C" void loop()
{
Screeps::Context::update();
EM_ASM({console.log('Starting loop: ')});
// Structures
for (auto& spawn_entry : Screeps::Game.spawns())
{
for (auto &spawn_entry : Screeps::Game.spawns())
{
auto spawn = DouwcoHivemind::Spawn(&spawn_entry.second);
spawn.process();
}
JS::console.log(std::string("Processing tick:\t") + std::to_string(Screeps::Game.time()));
DouwcoHivemind::Engine engine;
engine.loop();
EM_ASM({console.log('\n\n\n')});
JS::console.log("Used CPU:\t" + std::to_string(Screeps::Game.cpuGetUsed()));
JS::console.log("Bucket:\t" + std::to_string(static_cast<int>(Screeps::Game.cpu()["bucket"])));
JS::console.log(std::string("\n\n\n"));
}
EMSCRIPTEN_BINDINGS(loop)