Unofficialcrusaderpatch: Any leftovers

Created on 14 Nov 2018  路  2Comments  路  Source: Sh0wdown/UnofficialCrusaderPatch

Complete off-topic: since you're editing executable, I wonder if there are any curious, unused lines of code left over by developers? Maybe any lines for removed "all" enemy, or any other cut personalities (bad_soldier, bad_arab)?

question

Most helpful comment

That's sadly not how it works. The executable is compiled into assembler code which looks f.e. like this. Any comments, variable names or other identifiers from FireFly's original source code are gone. So the chance of finding and especially understanding unused code is very low.

The closest to what you are looking for, which I have found out so far, might be how the AI determines its attack troop number:

After each attack the AI estimates _once_ it's minimum unit count for the next attack approximately with the following formula:

Do I have more than 10000 Gold?
=> next attack unit count = initial attack unit count + 7 * attack number
Do I have less?
=> next attack unit count = initial attack unit count + 5 * attack number

The initial unit counts are:

  • rat => 20
  • snake => 30
  • pig => 10
  • wolf => 40
  • saladin => 50
  • kalif => 15
  • sultan => 10
  • richard => 20
  • frederick => 30
  • philipp => 10
  • wazir => 40
  • emir => 30
  • nizar => 40
  • sheriff => 50
  • marshal => 10
  • abbot => 50

The recruitment intervals for each AI lord are in normal situations:

  • rat => 1
  • snake => 1
  • pig => 1
  • wolf => 4
  • saladin => 1
  • kalif => 0
  • sultan => 8
  • richard => 1
  • frederick => 4
  • philipp => 4
  • wazir => 1
  • emir => 0
  • nizar => 4
  • sheriff => 4
  • marshal => 1
  • abbot => 1

All 2 comments

That's sadly not how it works. The executable is compiled into assembler code which looks f.e. like this. Any comments, variable names or other identifiers from FireFly's original source code are gone. So the chance of finding and especially understanding unused code is very low.

The closest to what you are looking for, which I have found out so far, might be how the AI determines its attack troop number:

After each attack the AI estimates _once_ it's minimum unit count for the next attack approximately with the following formula:

Do I have more than 10000 Gold?
=> next attack unit count = initial attack unit count + 7 * attack number
Do I have less?
=> next attack unit count = initial attack unit count + 5 * attack number

The initial unit counts are:

  • rat => 20
  • snake => 30
  • pig => 10
  • wolf => 40
  • saladin => 50
  • kalif => 15
  • sultan => 10
  • richard => 20
  • frederick => 30
  • philipp => 10
  • wazir => 40
  • emir => 30
  • nizar => 40
  • sheriff => 50
  • marshal => 10
  • abbot => 50

The recruitment intervals for each AI lord are in normal situations:

  • rat => 1
  • snake => 1
  • pig => 1
  • wolf => 4
  • saladin => 1
  • kalif => 0
  • sultan => 8
  • richard => 1
  • frederick => 4
  • philipp => 4
  • wazir => 1
  • emir => 0
  • nizar => 4
  • sheriff => 4
  • marshal => 1
  • abbot => 1

Chances are they used a non-amateurish compiler, which implies that dead code elimination did its thing and did it well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lolasik011 picture Lolasik011  路  4Comments

felicedanieli picture felicedanieli  路  3Comments

Heroesflorian picture Heroesflorian  路  3Comments

mceast picture mceast  路  3Comments

Lolasik011 picture Lolasik011  路  4Comments