#7DRL , Day 6 : AI

My entry for 7DRL this year is “Dead Horizons 7DRL”, a wild-west-in-space cover-based-shooter roguelike (overly-hyphen-ated). It started from a conversation with writer Matthew Ritter, and is set in a world that he created. It is meant to be the prequel to a much larger game, and a proof-of-concept for several new ideas.


I’m most of the way through my sixth day, and now I have to write the AI. I usually rely on dijkstra maps for my AI, because it’s a fast way to let an AI navigate towards the player in a maze, and every entity can use the same map during a given loop.

But for this game, two roguelike staples are upside down: Instead of melee combat in tight spaces, Dead Horizons focuses on ranged combat in wide open spaces. It also relies on a destructible cover mechanic. If someone is hiding behind a cactus, they are much harder to shoot. But put a few shots into the cactus, and becomes less effective, and the target might decide to bolt for something better.

So my AI needs to take this into account.

Most things in the world are hostile, so i don’t need too many complex behaviors. Basically, every turn, each AI unit will look around itself and ask questions about each tile: can i go there? am i safer there than i am here? would i have a better chance of hitting the player if i stood there? And then it will make its move based on whichever square is most desirable. I plan to give each question a random weight as well, so some AIs will prefer to stay safe, and some will want to charge.

That’s enough English for now, it’s time to start writing code!

ghost town

A Ghost Town Map


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s