Table of Contents

AI Behavior Mechanic

Description

AI Behavior refers to the artificial intelligence systems that control how non-player characters (NPCs) and monsters behave in Remixed Dungeon. The AI system is implemented as state-based behaviors that can be dynamically changed during gameplay.

AI System Code

The AI system is implemented using the AiState.java interface:

// In AiState.java
public interface AiState {
    void act(@NotNull Char me);
    String status(Char me);
    String getTag();
    void gotDamage(Char me, NamedEntityKind src, int dmg);
    void onDie(@NotNull Char me);
}

Common AI Types

Wandering AI

Hunting AI

Sleeping AI

Passive AI

Fleeing AI

Other AI Types

RunningAmok AI

Horrified AI

ThiefFleeing AI

ControlledAI AI

AI Implementation

The AI system uses a state pattern managed in MobAi.java and Mob.java:

// In Mob.java
public void setState(String state) {
    setState(MobAi.getStateByTag(state));
}
 
// In Mob.java - AI state transitions
public void beckon(int cell) {
    // ... code that may change AI state based on context
    if (state.getTag().equals("WANDERING")) {
        // ... may change to hunting state
    }
}

AI Transition Triggers

AI in Mob Initialization

AI Mechanics

Factors Affecting AI

Player Interaction

Exploiting AI

Code References

See Also