Super Famicom Wars/Notes

From Data Crystal
Jump to navigation Jump to search

Chip tiny.png The following article is a Notes Page for Super Famicom Wars.

Compression

Compressed data is headerless and terminated with opcode 0xFF. However, it is easy to find the location of compressed data streams by setting breakpoints on the decompression routines in the ROM.

The Super Famicom Wars English Translation source code contains tools to decompress and recompress these streams, as well as a writeup on the compression scheme itself.

Units

Super Famicom Wars has a total of 24 distinct units.

Unit IDs

Inside the unit statistics table located in ROM, which contains information such as unit ammo, the units are ordered as follows:

0x00 Infantry
0x01 Mech
0x02 Heavy Tank
0x03 Medium Tank
0x04 Light Tank
0x05 Recon
0x06 APC
0x07 Proto Tank
0x08 Supply
0x09 Artillery
0x0A Rockets
0x0B Train
0x0C Flak Gun
0x0D AA Tank
0x0E Missiles
0x0F Fighter
0x10 Bomber
0x11 Striker
0x12 B. Copter
0x13 T. Copter
0x14 Battleship
0x15 Cruiser
0x16 Lander
0x17 Sub

Active Unit IDs

These IDs are used by the UnitInfo and PredeployedList data structures in RAM.

0x00 Destroyed/Skip
0x02 Infantry
0x04 Mech
0x06 Heavy Tank
0x08 Medium Tank
0x0A Light Tank
0x0C Recon
0x0E APC
0x10 Proto Tank
0x12 Supply
0x14 Artillery
0x16 Rockets
0x18 Train
0x1A Flak Gun
0x1C AA Tank
0x1E Missiles
0x20 Fighter
0x22 Bomber
0x24 Striker
0x26 B. Copter
0x28 T. Copter
0x2A Battleship
0x2C Cruiser
0x2E Lander
0x30 Sub
0xFF EOL

Teams

0x01 Red Star
0x02 Blue Moon
0x03 Green Earth
0x04 Yellow Comet

Commanding Officers

0x01 Yuan Delta
0x02 Rogenski
0x03 Von Rosso
0x04 Hetler
0x05 Caroline
0x06 Billy Gates
0x07 Mr. Yamamoto

AI

AI Presets

Super Famicom Wars has seven COs that can be computer-controlled, however there are only four unique "AI Types". Each AI Type has its own "AI Preset" (256 bytes) for each map in the game (* 4 AI types = 1024 bytes per map). Modifying these presets is essential for making custom maps as they instruct the AI on what types of units to build, as well as how many units to build, among other things.

In ROM, AI presets for each type are stored in the following order for each map:

Yuan Delta / Caroline / Billy Gates / Mr. Yamamoto (Skill level 3+ - Balanced attack and defense)
Rogenski (Skill level 3 - Balanced but makes mistakes)
Von Rosso (Skill level 2 - Aggressive with unit rushes)
Hetler (Skill level 1 - Defensive with unit spam)

Each AI preset is defined as follows:

Priority Conditions (16 bytes)

  • When considering units to build, the AI will assess these priorities first before using the regular deployment rate table.
+0x00 Minimum Foot Soldiers to deploy (Foot Soldiers include Mech and Infantry)
+0x01 Foot Soldiers to Neutral Property ratio
+0x02 Foot Soldier deployment rate
+0x03 Mech replaces Infantry rate (at day 5, begin scaling by this rate each day, caps at 80%, see: $85cdd8)
+0x04 T-Copter/Foot Soldier deployment rate
+0x05 APC/Foot Soldier deployment rate (AI has airport)
+0x06 APC/Foot Soldier deployment rate (no airport)
+0x07 Lander/Ground Unit deployment rate
+0x08 Scaling multiplier for build calculations
+0x09-0F (unknown)

Attack Rate (24 bytes - 1 byte per unit)

  • The AI will attack with this unit when able, if the damage this unit is expected to receive does not exceed this percentage.
  • Setting these values to 0 results in an almost completely passive AI, however Foot Soldiers will still try to capture properties.

Escape Rate (24 bytes - 1 byte per unit)

  • When this unit is in range of an enemy unit, the AI will try to move this unit out of the enemy's range.

Repair Mode Min. Fuel % (24 bytes - 1 byte per unit)

  • When this unit's fuel percentage reaches this amount, the AI will try to retreat this unit to a nearby property and/or resupply it.
  • Setting these values to 0 means the unit(s) will never go into repair mode, even if it is low on fuel.

Repair Mode Min. Health % (24 bytes - 1 byte per unit)

  • Same as above, but concerning this unit's current health.

Unknown (120 bytes/24 bytes * 5)

  • Possibly something to do with Movement AI, similar to Advance Wars 1?

Deployment Rate (24 bytes - 1 byte per unit)

  • Priorities as described above have to be met first before this table is used, even if that means the AI must take multiple turns in order to satisfy those conditions.
  • Units with the highest rates will be deployed first. The AI will then prioritize building at least 1 of each unit that has a deployment rate, if it has the funds to do so.
  • Setting these values to 0 means the unit(s) will never be deployed (unless overruled by the priorities above). If you place Airports or Seaports on a map with no air/sea deployments in the AI preset, then the AI will never utilize those properties; strangely this does not apply to Depots as the AI will always attempt to build a Train unit if a Depot is present.
  • Proto Tanks cannot be deployed normally. They can only be created by capturing a Lab on the map.

Maps

All the available tiles usable by maps.

Map data is stored in the ROM compressed. When decompressed, the format is very simple (in little endian):

Map Header (4 bytes)

16x15 (width x height) is the smallest map size used by official maps, fitting exactly one screen in width. 38x37 or 1406 tiles seems to be the max map size before things start breaking.

+0x00 Map width (16-bit)
+0x02 Map height (16-bit)

Map Data (? bytes)

  • Length defined as width * height * 2 (consisting of 16-bit tile IDs).
  • Sorted from top left to bottom right of the map.
  • Bases on the map must be within a 5x5 square around the HQ if you want to be able to build units on them.