Poll

When a monster or effect looks at all adjacent tiles in your code, in what order do you look at them?

Compass: Starting at north (or any point) then looking at tiles clockwise or anticlockwise.
1 (14.3%)
Clock: Like Compass, but each turn the search starts at a new position.
2 (28.6%)
Shake: Looking left-right then up-down (or any combination of one axis before another).
1 (14.3%)
Random: The order of tiles looked at is always random.
3 (42.9%)
Special: The order of tiles is drawn from an array (possibly over several turns).
0 (0%)

Total Members Voted: 7

Author Topic: Order of Execution In Turn Based Roguelikes  (Read 14133 times)

st33d

  • Rogueliker
  • ***
  • Posts: 112
  • Karma: +2/-0
    • View Profile
    • Email
Order of Execution In Turn Based Roguelikes
« on: August 07, 2020, 12:09:24 PM »
This discussion came up on a Discord I am on and the responses I received made it clear that many people don't consider this important - when in fact it is the difference between life and death in a turn based game.

Consider the Compass option. If a monster always looks at north first and east last when pathfinding then the player has an advantage when approaching from the east. Depending on the type of roguelike you are making, the order in which you look at adjacent tiles determines the outcome of all situations where a player's life hangs in the balance.

In a current project I'm using Clock - this mitigates some of the problems with Compass, whilst encouraging kiting from enemies. Though it's a little less predictable and less puzzle-like.

I'm posting this poll in the hopes to find out how people generally approach this problem and to raise awareness of what I think is a core piece of roguelike design. It affects the A.I. of all your enemies and the nature of all your effects.

Slash

  • Creator of Roguetemple
  • Administrator
  • Rogueliker
  • *****
  • Posts: 1203
  • Karma: +4/-1
    • View Profile
    • Slashie.net
    • Email
Re: Order of Execution In Turn Based Roguelikes
« Reply #1 on: August 07, 2020, 02:44:25 PM »
I hadn't considered how impactful this could be, but it makes total sense. I believe the RANDOM solution would work best for most kinds of roguelikes.

Paul Jeffries

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 257
  • Karma: +1/-0
    • View Profile
    • Vitruality.com
Re: Order of Execution In Turn Based Roguelikes
« Reply #2 on: August 07, 2020, 04:20:04 PM »
I'm assuming the context of this is mainly scenarios where an AI is deciding between moving/attacking/whatevering two or more different tiles which are equally 'attractive' so far as the AI is concerned?

In situations like that I usually add a randomised modifier to the scoring for each tile which depending on the magnitude can be used to tie-break or (if big enough) to make the AI occasionally make 'mistakes' and not always take the optimal path.  So, technically I go clockwise but in effect it's randomised.  I can see how that wouldn't work in a more puzzle-orientated game where enemy behaviour needs to be 100% predictable, however.


st33d

  • Rogueliker
  • ***
  • Posts: 112
  • Karma: +2/-0
    • View Profile
    • Email
Re: Order of Execution In Turn Based Roguelikes
« Reply #3 on: August 07, 2020, 05:44:57 PM »
For a classic roguelike I'm getting feedback that random is preferable to avoid any bias and I happen to agree. When the level is random and most effects are random then the fairest method is to look randomly.

The execution order doesn't just apply to A.I. - imagine that you have an explosion - and that explosion hits more fuel for another explosion. The order in which these events occur can have different effects on the level, perhaps vaporising elements before they can react if the execution steps one way instead of another.

In my own project I have unlimited Undo - so there needs to be repeatable logic. Or perhaps you want enemies with a specific bias because of map structure.

blargdag

  • Newcomer
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Order of Execution In Turn Based Roguelikes
« Reply #4 on: November 06, 2020, 06:45:57 PM »
Wow, I never thought this order would be important at all!  Currently in my WIP I didn't even think about this, and it's just an ad hoc mishmash of different orders, depending on the code at hand. Mostly it's just some arbitrary order determined by the underlying hash tables I use to store position-related information.  But I imagine at some point I ought to put more thought into what order things should be done in.

mekaerwin

  • Newcomer
  • Posts: 15
  • Karma: +1/-0
    • View Profile
    • Email
Re: Order of Execution In Turn Based Roguelikes
« Reply #5 on: March 31, 2021, 06:44:33 AM »
One game that really drove home this idea was DROD. There were levels you literally couldn't win unless you utilized the order that the enemy did things in. It was more of a puzzle game and discrete in its outcomes but I thought it was an interesting reminder of this and how to make enemies distinctly different without resorting to stats. I wish more roguelikes took notes from it, although some do.

KhaoTom

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 64
  • Karma: +0/-0
    • View Profile
    • My Projects
Re: Order of Execution In Turn Based Roguelikes
« Reply #6 on: April 07, 2021, 10:30:18 PM »
This is really interesting to think about. I'm not sure I prefer any one method. On the one hand, looking in random directions might be considered more fair in a game full of other randomness. But on the other hand, something that appears random at first due to the overall complexity or amount of interactions, but upon closer inspection is systematic and understandable has a sort of "seeing the matrix" aesthetic to it, which I also appreciate.

xangelo

  • Newcomer
  • Posts: 2
  • Karma: +0/-0
    • View Profile
    • Xangelo.ca
    • Email
Re: Order of Execution In Turn Based Roguelikes
« Reply #7 on: April 20, 2021, 05:11:02 PM »
I've been toying with the idea of "moods" (aggressive, calm, searching) for dictating movement order for mobs. The hope is that allowing players to observe different mobs movement once in FOV will help decide how (not) to interact with them.

Outside of FOV I tend to make it random.