Implement tick-based game loop, combat overhaul, and attack-any-NPC

Replace immediate combat with a 3-second tick engine that resolves
actions, NPC AI, status effects, respawns, and passive regeneration.
Players queue combat actions (attack/defend/flee/use) that resolve on
the next tick. Any NPC can now be attacked — non-hostile targets incur
attitude penalties instead of being blocked. Status effects persist in
the database and continue ticking while players are offline.

Made-with: Cursor
This commit is contained in:
AI Agent
2026-03-14 15:12:44 -06:00
parent a083c38326
commit 5fd2c10198
9 changed files with 890 additions and 181 deletions

View File

@@ -9,6 +9,7 @@ use tokio::net::TcpListener;
use mudserver::db;
use mudserver::game;
use mudserver::ssh;
use mudserver::tick;
use mudserver::world;
const DEFAULT_PORT: u16 = 2222;
@@ -82,6 +83,13 @@ async fn main() {
let config = Arc::new(config);
let state = Arc::new(Mutex::new(game::GameState::new(loaded_world, db)));
// Spawn tick engine
let tick_state = state.clone();
tokio::spawn(async move {
tick::run_tick_engine(tick_state).await;
});
let mut server = ssh::MudServer::new(state);
let listener = TcpListener::bind(("0.0.0.0", port)).await.unwrap();