Coder Diary #24 -- UID Slots Expansion, Part 1
Another very long Coder Diary. But you might want to skim through it and stick around until the very end...
Yet another foundational issue:
In the Campaign Series, units are identified by ID number, or UID. For example, in West Front, in the German platoon01.oob file, we have this
P01018 4 7 13 40 0 0 46 24 45 2 4 1 11 0 1 766 9 P01018 7 33 16 1 0 15 43 7 53 12 21 8 7 PzKpfw V Medium Tanks , Pz V , Panther
where for the PzKpfw V Medium Tank, its UID# is 01018.
Let's break the UID# down. In
01018
[*]the leading 01 (green digits) signifies the nation ID#, in this case the German nation ID# 01
[*]the middle 0 (blue digit) signifies the unit type, in this case the Tanks, Light Tanks, Self-propelled Gun category 0
[*]the trailing 18 (red digits) signifies that this is the 18th unit of this type, for this nation
Let's take a look at the (revised) Platoon Codes.
As you can see, for most unit categories, we are limited to at most 100 units per category, since available UIDs for each nation, each category range 0-99 only.ORIGINAL: Jason Petho
Here is the latest Platoon coding for NEW ARMIES that are for the Campaign Series.
This is a work in progress!
PLATOON CODES
Jason Petho -- February 4, 2009
PXX001 – PXX099 Tanks, Light Tanks, Self-propelled Gun (as SU-100)
PXX101 – PXX199 Artillery (Self-propelled and towed)
PXX201 – PXX299 Infantry (All types)
PXX301 – PXX399 Headquarters (All types)
PXX401 – PXX499 Leaders (All types)
PXX501 – PXX599 Off-map Airplanes (All types)
PXX601 – PXX619 Reconnaissance Vehicles (Armoured Cars, Recce Jeeps, etc)
PXX620 – PXX669 Helicopters and ON MAP aircraft (All types)
PXX670 – PXX699 Naval Units (Boats, Landing Craft, etc)
PXX701 – PXX799 Transport units (All types of Trucks, APC’s, IFV’s, etc)
PXX801 – PXX879 Antiaircraft (Self-propelled, towed, man portable)
PXX880 – PXX899 Misc Buildings, special units (Factories, News Crews, etc)
PXX901 – PXX999 Antitank (Self-propelled, towed, man portable)
Are 100 units per category enough? Seems not, as Jason placed this concern near the top of his Middle East wish list. How so?
In the game Middle East, let's see how many units there are, for each nation, in the first (Tanks, Light Tanks, Self-propelled Gun) category:
[root@berto middle_east]# ls *[Pp]latoon*.oob
Platoon08.oob Platoon22.oob Platoon25.oob Platoon28.oob
Platoon09.oob Platoon23.oob Platoon26.oob Platoon29.oob
Platoon14.oob Platoon24.oob Platoon27.oob Platoon30.oob
[root@berto middle_east]# for n in 08 09 14 22 23 24 25 26 27 28 29 30; do echo $n; awk '{print $1}' [Pp]latoon$n.oob | egrep "P$n[0]" | sort | uniq | wc -l; echo; done
08
97
09
26
14
63
22
67
23
47
24
33
25
28
26
38
27
11
28
64
29
17
30
23
Hmm, for nation 08, France, there are 97 different Tanks etc. units. Nearing the 100 limit!
For nation 22, Israel, it's not so bad -- 67 Tanks etc. units. We've still got some slack there.
What about infantry?
PXX201 – PXX299 Infantry (All types)
In Middle East, let's check their unit counts:
[root@berto middle_east]# for n in 08 09 14 22 23 24 25 26 27 28 29 30; do echo $n; awk '{print $1}' [Pp]latoon$n.oob | egrep "P$n[2]" | sort | uniq | wc -l; echo; done
08
95
09
68
14
47
22
89
23
77
24
56
25
56
26
65
27
44
28
49
29
49
30
53
Hmm. Israel now has 89 different Infantry units, nearing the 100 maximum. And France? (France does play a limited role in the game Middle East.) France has 95 different Infantry units. Nearly running out of free slots!
Let's take a quick look at East Front...
[root@berto East Front]# for n in 00 01 02 03 04 05 06 07 08 09 10 13 17 24 26 30 37 39 40; do echo $n; awk '{print $1}' platoon$n.oob | egrep "P$n[0]" | sort | uniq | wc -l; echo; done
00
94
01
99
...
09
98
10
89
...
24
94
...
40
96
For unit type Tanks etc., category 0, for nations Russia (00), Germany (01), Britain (09), the U.S. (10), Soviet (24), and Allied Germany (40), unit counts are near 90 or above. Nearly running out of free slots here too!
In fact, for Germany (01), we are effectively at the limit. You want to add some more Tank units to the German OOB? Sorry, no can do! Unless you retire some other units, thereby freeing up their UID slots. Which will likely break scenarios having those retired/substituted units.
In East Front, for the Infantry category, the situation is no better. For several nations, we are near the maximum number of Infantry units allowed. Same story for West Front and Rising Sun.
When this game was first designed, it was likely thought: 100 units per category? That's more than enough.
Except who could have foreseen that, nearly 20 years and 1,200+ scenarios later, this game series would still be going strong? And that 100 units per category is now a tight and worrisome constraint?
What to do?
What if we take the easy way out and simply steal unit slots from one category to another? For example, maybe borrow some free slots from
PXX670 – PXX699 Naval Units (Boats, Landing Craft, etc)
and devote them to Tanks, or Infantry, or wherever we have the need.
Bad idea. Category codes aren't just for show; the game engine employs them to differentiate among units for different purposes (tanks vs. infantry vs. leaders vs. amphibians vs...). So we can't just reapply UIDs from one category to another willy nilly.
What if instead we increase the number of slot digits from 2 to 3, so that for exampleLet's break the UID# down. In
01018
[*]the leading 01 (green digits) signifies the nation ID#, in this case the German nation ID# 01
[*]the middle 0 (blue digit) signifies the unit type, in this case the Tanks, Light Tanks, Self-propelled Gun category 0
[*]the trailing 18 (red digits) signifies that this is the 18th unit of this type, for this nation
01018
becomes
010018
That is, by prepending an extra digit to the current slot values, we increase the available slots from 0-99, 100 slots, to 0-999, 1000 slots.
Hey, great idea! Let's get to work converting all the many .oob and .org and .scn and ... thousands of unit .bmp files (that have to be renamed).
[X(]
OMG! Many thousands upon thousands of UIDs in hundreds and hundreds of data files (all games) that we have to tweak by hand. Thousands of file renamings too. Shudder at the amount of work that entails! Imagine all the errors that such a mistake-prone manual editing operation would introduce.
Hopeless, yes?
[continued in next post...]

