Unit placement + move order's effect on map flow

Has anyone noticed that enemy units move in a set order? It seems to be based on their position in the team table - or for those using FEBuilder, the order in which the units are placed.

This is why it sometimes appears the AI is thinking in five dimensions, and why at other times the AI appears to be choking on its own inadequate brain cells.

I feel the potential of deliberately placing units in the table to move in a certain order is overlooked. It has very, very low returns versus effort, but can change the flow of a map a lot and enable or prevent “offensive turtling” tactics where the player advances aggressively but creates dynamic choke points regardless.

It also makes weapon triangle and overlapping range mechanics more dynamic in some cases - if the sword unit is placed before the axe unit and they have overlapping range, and the sword unit’s approach would prevent the axe unit from approaching, it’s a different attack strategy from if it was the other way around. Might also make changing which units you deploy a bit more intuitive without having to implement fatigue - but, of course, it would have to be telegraphed or the map would just have to be ridiculously hard without a certain team composition.

Has anyone experimented with this?

Would it be better if this behavior was altered or made irrelevant - say, through ASM that changes table position for move order based on a seed so that restarting or reloading the chapter changes the order?


That is how the unit move order is decided. I think it should stay as is. It’s become second nature at this point for me and my workflow.

From Shuusuke on discord, this seems to be all the factors that decide movement order (from top to bottom in terms of priority):

Screen Shot 2022-04-18 at 2.23.36 PM

Edit: I believe having a commander drops priority, as well as having staffing AI/dancing AI.


Stan has the AI order function (for FE6, but it’s the same in 7/8) decomped here: fe6/ai-order.c at main · StanHash/fe6 · GitHub

Recovery is it’s own special thing with priority, then non-autoleveled units go first, sorted by move and then by order in RAM (commander and weapons are irrelevant). Autolevelled units are sorted first by their commander. Units with a lower-numbered commander will move before units with a higher numbered commander, regardless of range or move or position in RAM.

Within a given commander, the order is basically:

  1. Units who only have 1 range weapons [priority score 20]
  2. Units with ranged weapons (but no staves) [priority score 40]
  3. Units with staves [priority score 72]
  4. Units with no usable weapons [priority score 87]

Additionally thieves get a +60 bonus to their priority score (so assuming that they’re armed, they’ll move after staffers), while units who either have the lord flag, or are their own commander (their unit ID matches their commander ID) get a +87 bonus (meaning they move last).

Within a given group, ties are broken first by movement (lower move units move before higher move ones) and secondly by order in RAM (which initially corresponds to deployment order, but can get changed up as units die and reinforcements spawn).

If you want to choose exactly what order the enemies move in, the easiest way to do it is to set them all to be auto-leveled and then give each of them a unique commander ID. Assign a commander of 1 to whoever you want to move first, and ID of 2 to whoever should got second, and so on (note that if you’re using an AI that actually looks at the commander field, like AI1=0D, this will obviously mess it up, otherwise nothing really seems to care about the commander field).


Well obviously they need to move in… some order.

That’s why bosses are usually first on the list.

I’m trying to get a boss to move last , the gimmick of the chapter is that he returns to the throne using an event at the start of every player phase. So he can always move and always guard the throne. That’s working perfectly, but the game gets a bit confused if another unit moves onto the throne while he’s left it. So it’s important that he is the very last unit to move on enemy phase. Yet no matter what I do he always attacks in the exact same order, right in the middle of all the other units on the map. I’ve tried putting him at the end of the enemy array, in his own unique enemy array, make the npcs of the chapter his commander and making himself his commander, yet none of the things discussed here seem to actually influence him.