Change one Marine's damage with EUD and every Marine changes. But when one Marine drops to 20 hit points the others are untouched, and when one is Ensnared the rest are not. Same unit type, yet some data is shared and some is not.
| units.dat / weapons.dat | One per unit TYPE: damage, max hit points, cost, size, properties. Writing one changes every unit of that type. |
|---|---|
| Structure offsets (CUnit) | One per unit INSTANCE: current hit points, owner, position, active spells, invincibility, and which unit it is. |
That per instance storage is the structure offset, and eudplib calls it CUnit. There are 1,700 slots and each is 0x150 bytes, which is 336.
index 0 0x59CCA8 index 1699 0x59CDF8 <- 0x150 다음 칸인데 1번이 아니다 index 1698 0x59CF48 ... index 1 0x628298
This layout defies intuition: index 0 is first, but the slot after it is 1699, not 1. Walking units by computing addresses yourself will almost certainly be wrong. Use eudplib's EUDLoopPlayerUnit or EUDLoopUnit. The reason to know the ordering is not to compute with it but to know not to.
In practice the place this distinction bites most often is appearance. The flingy a unit wears is type data, so if you dress a mob in some unit's flingy and then write a speed onto that flingy, every unit wearing it changes speed. If anything the player owns is in that list, you have shipped a bug.
If you are building an RPG this distinction changes the design immediately: "+50 attack, but only for this player's Marine" is not possible. Damage and weapon type are type data, so two units of the same type cannot have different damage. Only what has a slot in CUnit can differ per unit.
| An invisible extra attacker | Park an invisible unit on the buffed one and let it deal the extra damage. |
|---|---|
| Change the unit type | Make a clone type that differs only in its weapon, and swap the unit to it while the buff lasts. |
| A dat write across the whole map | The simplest, and it applies to everyone - which is the right answer when everyone is meant to rise together. |
Stun, slow, haste and shields, on the other hand, are all cheap - those timers sit in CUnit, one per unit. Nearly every "why is this easy and that hard" in skill design comes down to this one distinction.
One flingy, many units