Inspiration

One issue that I have always had with games is that they aren't that difficult sometimes, and even though there is AI in games, it doesn't really feel like anything that adapts to how the user plays. So I thought how about we try and create something that does just that. Also I think having a new way to improve game AI mechanics, interactions with player data and dstreamlining usage of AI within games might be an interesting topic that not many people I have seen really discuss.

What it does

Echo Warden is an adaptive 2D boss-fighting game where the boss learns from how the player fights and changes its behavior in future encounters.

Instead of simply increasing health or damage after every fight, the system analyzes patterns in the player’s playstyle, such as rushing into melee range, relying on ranged attacks, frequently dodging, jumping over attacks, or playing defensively. A machine-learning classifier estimates which playstyle archetypes best represent the player, and a second neural network uses that information alongside the current game state to guide the boss’s behavior.

As the player repeatedly defeats the boss, Echo Warden can change its spacing, attack frequency, projectile usage, chase behavior, combo patterns, recovery time, and defensive responses to counter the strategies the player relies on most.

We also built a baseline-versus-adaptive simulation mode where the same automated player is used against both versions of the boss, making it possible to clearly compare how the adaptive system changes the fight.

How we built it

The game itself is written in C++ using raylib for rendering, input, animation, collision detection, and the core combat loop.

The AI system is built using Python and PyTorch. During each fight, the game records telemetry describing the player’s movement, distance from the boss, attacks, dodges, jumps, and other combat actions.

We created a set of predefined player archetypes, including rushers, melee brawlers, ranged zoners, hit-and-run players, dodge-heavy players, jump-heavy players, turtles, projectile spammers, combo mashers, and balanced players. Synthetic combat traces are used to pretrain a classification model to recognize mixtures of these different playstyles.

The classifier produces an archetype distribution and behavioral features. Those outputs are then passed into a second feed-forward policy network along with the current combat state. The policy network outputs values controlling boss characteristics such as preferred range, chase pressure, backstep tendency, attack timing, projectile preference, combo probability, and recovery speed.

After a fight, the model can be fine-tuned using the real player’s combat data so future boss encounters become increasingly personalized.

We also built an automated A/B testing system that runs a baseline boss and adaptive boss side-by-side using identical scripted player behavior, seeds, health values, and damage values so that the adaptation can be compared independently from player skill.

Challenges we ran into

The main issue with this problem was figuring out the right architecture and by the time we did we then were limited by resources. At first, I had discussed with some of the other sponsors and mentors in the area in regards to the idea, and discussed with other peers, and a lot of ideas pertained to using something related to prompt refining instead of constant training. This was the initial approach but then the big issue was finding a way to use the prompts to properly move the character, and it was starting to seem that using text in this manner was becoming increasingly difficult and often showed little to no change. So, as the time went on I worked by refining the model with the help of AI. The eventual solution that I landed on was a basic classification system in which there would be some base classifications determined that have certain strategies assigned to them, then we would use a small model that would analyze and classify the type and we would try to then fit the behavior using a FFN to actually determine how the action of the boss would change. In the end, I would say that it did not really work out, the game seems to play almost the same as what the original is and is quite difficult to see the changes in the model. The other issue is the training of the model currently is not per instance of game played its per device as we store the training weights and data locally, so this also limited our size on the model. Overall, Overall, I think the idea was good, it will definitely be something I will iterate on, maybe use some more gpu power and try to extend the amount of parameters that are used in the model to maybe make more niche updates.

Accomplishments that we're proud of

We're proud that we were able to build a working foundation for the idea rather than only a conceptual demonstration.

Echo Warden currently connects a playable C++ boss fight with a PyTorch machine-learning pipeline, records player combat behavior, experiments with classifying different playstyles, and translates model outputs into changes in the boss controller.

We also created automated simulation profiles and an A/B testing system that lets us run the same scripted player behavior against adaptive and non-adaptive versions of the boss. This gives us a way to measure and iterate on the system instead of relying entirely on subjective gameplay impressions.

The system is still experimental, and there are parts of the adaptation that we want to make significantly more sophisticated. However, we now have an end-to-end framework that we can continue building on: gameplay produces data, the model interprets that data, and the resulting information can influence future encounters.

For us, the biggest accomplishment was getting that full feedback loop working within the scope of a hackathon.

What we learned

The biggest thing we learned is that creating adaptive game AI is not simply a matter of attaching a neural network to an enemy.

There are several separate problems involved: recognizing meaningful player patterns, deciding what information the model should receive, determining which model architecture fits the problem, designing useful counter-behaviors, and making those changes clear enough that a player can actually perceive them.

We also learned that a larger or more complicated model is not automatically better. We spent a significant amount of time moving between different architectures before realizing that separating the problem into smaller pieces made experimentation much easier.

One model can focus on understanding the player, while another system can focus on deciding how the boss should react. Traditional game logic can then remain responsible for executing those decisions reliably.

Another important lesson was that model loss alone does not tell us whether the system is creating a better game. For this project, observable behavior, controlled simulations, and comparisons between baseline and adaptive enemies are more meaningful measurements.

Most importantly, we learned that this idea requires far more iteration and training data than could realistically fit into a single hackathon. What we built is a starting point that gives us the infrastructure to continue experimenting with it.

What's next for Echo Warden

The next step is to continue refining both the learning architecture and the boss behaviors available to the model.

We want to generate significantly more simulated combat data and train against a wider range of player behaviors. With more compute and training time, we would also like to experiment with stronger temporal models that can recognize longer sequences instead of relying primarily on short-term behavior and predefined archetypes.

Another direction we are interested in is reinforcement learning or contextual-bandit approaches. Instead of only identifying a player's habits, the boss could learn which counter-strategies actually succeed against that specific player.

For example, the system could measure whether a backstep causes repeated melee attacks to miss, whether an anti-air attack successfully catches frequent jumping, or whether increased pressure actually disrupts a ranged strategy. Over time, the enemy could learn not only how the player behaves, but which responses are effective against them.

We also want to expand the game itself with more attacks, enemies, animations, and combat mechanics so that the learning system has a much larger set of meaningful decisions to make.

Echo Warden is ultimately a prototype for a larger idea: enemies that gradually develop a personalized fighting style based on the individual playing against them. We did not fully reach that goal during the hackathon, but we built the foundation needed to keep iterating toward it.

Built With

Share this project:

Updates

Submission history