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 (33.3%)
Clock: Like Compass, but each turn the search starts at a new position.
1 (33.3%)
Shake: Looking left-right then up-down (or any combination of one axis before another).
0 (0%)
Random: The order of tiles looked at is always random.
1 (33.3%)
Special: The order of tiles is drawn from an array (possibly over several turns).
0 (0%)

Total Members Voted: 3

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

st33d

  • Rogueliker
  • ***
  • Posts: 111
  • Karma: +1/-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

  • Priest of Roguetemple
  • Administrator
  • Rogueliker
  • *****
  • Posts: 1173
  • Karma: +1/-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: +0/-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: 111
  • Karma: +1/-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.