[VM] Play System: Internals

Librarian: HexCode
Post Reply
User avatar
HexCode
First Lieutenant
First Lieutenant
Posts: 926
Joined: 2019-09-30 18:54, Monday

[VM] Play System: Internals

Post by HexCode » 2021-04-04 03:38, Sunday

CONTENT LINKS
==============

Introduction
viewtopic.php?f=100&t=547#p8992

Combatant Ownership Representations
viewtopic.php?f=100&t=547#p8993

Unit Target Types
viewtopic.php?f=100&t=547#p8994

Unit Classes
viewtopic.php?f=100&t=547#p8995

Internally Re-Indexed GLN Records
viewtopic.php?f=100&t=547#p8996

Internally "Summarized" Terrain Typology
viewtopic.php?f=100&t=547#p8997

Unit Movement Types
viewtopic.php?f=100&t=547#p8998

In-Game Upgrades & Purchases: Combatant Unit Availability
viewtopic.php?f=100&t=547#p12054


===================================================================

The topic's contents may be modified or progressively added upon as time goes by.

===================================================================

INTRODUCTION
=============

This topic should be of interest to Veteran Modders (VMs). It is assumed that the reader is already intimately familiar with the information featured here:

[NP] Introductory Documentation
viewtopic.php?f=100&t=531
Last edited by HexCode on 2021-12-02 16:02, Thursday, edited 4 times in total.

User avatar
HexCode
First Lieutenant
First Lieutenant
Posts: 926
Joined: 2019-09-30 18:54, Monday

COMBATANT OWNERSHIP REPRESENTATIONS

Post by HexCode » 2021-04-04 03:42, Sunday

COMBATANT OWNERSHIP REPRESENTATIONS
=======================================

Absolute Prerequisite

FLAGS.BMP
viewtopic.php?f=100&t=545#p8990

Preliminaries

PGF's engine does not give a hoot about Combatant Flag Iconic Representation (CFIR) visual descriptors. The engine "wants" to be "told" something exact that it can "fully understand" and "act upon" accordingly. Hence, enter the Combatant Ownership Representation (COR) typology.

COR Typology

COR typology is very, very simple. It is an indexing scheme assuming values 0, 1, 2 etc. PGF's engine "single-mindedly" focuses on the hexadecimal index values (i.e., codes). It is only through such invisible input that PGF's engine usefully "perceives" of "nationalities".

Important

COR descriptors provide PGF's engine with an adequate "understanding" of "nationalities", visual aids for the benefit of humans be damned. The engine puts its "understanding" to good use by appropriately "policing" PGF's play system.

Note

Index-wise, there is a one-to-one correspondence relationship between the image slots (and, by logical extension, any CFIRs residing therein) contained in file FLAGS.BMP and COR codes. By the way, there is no such image slot sporting index value zero (0). Nevertheless, PGF's engine "knows" to visually assign "nothing" (i.e., no "flag") to COR code ZERO (0).

PGF's engine cannot address COR index (code) values higher than 255 (the ultimate restriction due to 8-bit encoding).
Last edited by HexCode on 2021-11-27 05:49, Saturday, edited 4 times in total.

User avatar
HexCode
First Lieutenant
First Lieutenant
Posts: 926
Joined: 2019-09-30 18:54, Monday

UNIT TARGET TYPES

Post by HexCode » 2021-04-04 03:46, Sunday

UNIT TARGET TYPES
==================

Internal Typology

PGF's Unit Target Type (TT) Typology is hard-coded in PGF's executable. There are FOUR (4) technically "recognizable" Unit TTs.

Code: Select all

Target Type Name       Hexadecimal Byte     Decimal Value

Soft                   00                   0
Hard                   01                   1
Air                    02                   2
Naval                  03                   3
PGF's engine does not give a hoot about how SSI or hobbyists refer to all these Unit TTs (in English or any other natural language). All it cares about is the hexadecimal byte (value) which corresponds to a particular Unit TT's relative rank in the definitive, technical listing appearing immediately above. Oftentimes, the listing itself is referred to as the "Unit Target Type Canonical Order".
Last edited by HexCode on 2021-06-01 01:44, Tuesday, edited 1 time in total.

User avatar
HexCode
First Lieutenant
First Lieutenant
Posts: 926
Joined: 2019-09-30 18:54, Monday

UNIT CLASSES

Post by HexCode » 2021-04-04 03:49, Sunday

UNIT CLASSES
=============

Internal Typology

PGF's Unit Class Typology is hard-coded in PGF's executable. There are EIGHTEEN (18) technically "recognizable" Unit Classes (UCs).

Code: Select all

Class Name           Hexadecimal Byte            Decimal Value

Infantry             00                           0
Tank                 01                           1
Recon                02                           2
Anti-Tank            03                           3      
Artillery            04                           4
Anti-Aircraft        05                           5
Air Defense          06                           6        
Structure            07                           7
Fighter              08                           8
Tactical Bomber      09                           9
Level Bomber         0A                          10
Submarine            0B                          11
Destroyer            0C                          12
Capital Ship         0D                          13    
Aircraft Carrier     0E                          14
Land Transport       0F                          15
Air Transport        10                          16
Naval Transport      11                          17
PGF's engine does not give a hoot about how SSI or hobbyists refer to all these UCs (in English or any other natural language). All it cares about is the hexadecimal byte (value) which corresponds to a particular UC's relative rank in the definitive, technical listing appearing immediately above. Oftentimes, the listing itself is referred to as the "Unit Class Canonical Order".
Last edited by HexCode on 2021-06-01 01:45, Tuesday, edited 1 time in total.

User avatar
HexCode
First Lieutenant
First Lieutenant
Posts: 926
Joined: 2019-09-30 18:54, Monday

INTERNALLY RE-INDEXED GLN RECORDS

Post by HexCode » 2021-04-04 03:54, Sunday

INTERNALLY RE-INDEXED GLN RECORDS
===================================

Absolute Prerequisite

MAPNAMES.STR
viewtopic.php?f=100&t=550#p9029

Mechanism

While loading a particular scenario, PGF's engine internally generates a localized table of GLN records on-the-fly.

The aforementioned table contains only those GLN records which are actually present on the particular scenario's map.

The engine sequentially "visits" each and every row of map hexes, going from top to bottom, one row of map hexes at a time. In each such row, the engine sequentially canvasses each and every GLN record, starting at the very left and going towards the right.

Every "newly encountered", distinct GLN record is methodically appended to the localized table. The re-indexing always starts with index value ZERO (0) meaning "hex without a GLN alphanumeric descriptor".
Last edited by HexCode on 2021-06-01 01:47, Tuesday, edited 2 times in total.

User avatar
HexCode
First Lieutenant
First Lieutenant
Posts: 926
Joined: 2019-09-30 18:54, Monday

INTERNALLY "SUMMARIZED" TERRAIN TYPOLOGY

Post by HexCode » 2021-04-04 03:58, Sunday

INTERNALLY "SUMMARIZED" TERRAIN TYPOLOGY
===========================================

Absolute Prerequisite

Underlying Terrain Representations
viewtopic.php?f=100&t=550#p9031

UTR Typology Redundancy

From a play system "point of view", PGF's engine "craves" some... simplification. To this effect, it puts the somewhat "bloated" UTR Typology on a serious... diet. :)

UTR Typology Aggregation

PGF's engine internally generates a Terrain Aggregation Table (TAT) "summarizing" its UTR Typology on-the-fly. The TAT defines SEVENTEEN (17) Aggregate Terrain Types (ATTs). Each ATT comprises one or more UTR types. The ATT order in the code is "canonical". The TAT follows:

Code: Select all

ATT           ATT Code              Constituent UTR Codes
Name          (hexadecimal)         (hexadecimal)

Clear         00                    00 01 02 03
Coast         01                    04 05 06
Ocean         02                    07
Port          03                    08 1D 25
River         04                    09 0A 0B
Mountain      05                    0C 0D 0E 0F 10 11 12 1F 20
Airfield      06                    13
Swamp         07                    14
City          08                    15
Rough         09                    16
Forest        0A                    17
Fortification 0B                    19 1A 21
Bocage        0C                    1B 1C
Desert        0D                    1E 26
Rough Desert  0E                    22
Escarpment    0F                    23 24
"Unknown"     10                    18
As usual, PGF's engine does not give a hoot about the ATTs' "given" names. All it cares about are the internally generated ATT codes.

The... strange case of ATT "Unknown" (Code "10") will be covered elsewhere in this Library.

UTR-to-ATT Cross-Table
viewtopic.php?f=100&t=551#p9041

documents the relevant byte locations within PGF's executable.

ATT Typology Aggregation

PGF's engine also internally generates a Compressed Terrain Aggregation Table (CTAT) further "summarizing" its ATT Typology above on-the-fly. The CTAT defines TWELVE (12) Compressed Aggregate Terrain Types (CATTs). Each CATT comprises one or more ATT types. The CATT order in the code is "canonical". The CTAT follows:

Code: Select all

CATT             CATT Code              Constituent ATT Codes
Name             (hexadecimal)          (hexadecimal)

City             00                     06 08
Clear            01                     00
Forest           02                     0A
Bocage           03                     0C
Rough            04                     09
Mountain         05                     05
Desert           06                     0D
Swamp            07                     07
Sea              08                     01 02
River            09                     04
Fortification    0A                     0B
Port             0B                     03
Interestingly enough, ATTs "Rough Desert" (code "0E") and "Escarpment" (code "0F") are missing from the table. For the purposes of ground / naval unit movement, PGF's engine treats them as unenterable.

Once again, PGF's engine does not give a hoot about the CATTs' "given" names. All it cares about are the internally generated CATT codes.

ATT-to-CATT Cross-Table
viewtopic.php?f=100&t=551#p9042

documents the relevant byte locations within PGF's executable.
Last edited by HexCode on 2021-11-02 04:43, Tuesday, edited 2 times in total.

User avatar
HexCode
First Lieutenant
First Lieutenant
Posts: 926
Joined: 2019-09-30 18:54, Monday

UNIT MOVEMENT TYPES

Post by HexCode » 2021-04-04 04:04, Sunday

UNIT MOVEMENT TYPES
=====================

Absolute Prerequisites

Unit Classes
viewtopic.php?f=100&t=547#p8995

Internally "Summarized" Terrain Typology
viewtopic.php?f=100&t=547#p8997

Ground Conditions
viewtopic.php?f=100&t=544#p8986

Preliminaries

A unit's Movement Allowance (MA) represents the "maximum distance" that the unit can travel in a single half-turn. During its movement phase, a unit's available MA points are "expended" at various rates depending on:

a) traversed hex underlying terrain types (including roadwork)
b) movement method assigned
c) prevailing ground conditions (weather related)

Internal Typology

PGF's Unit Movement Typology is hard-coded in PGF's executable. There are ELEVEN (11) technically "recognizable" Unit MTs.

Code: Select all

MT Name                        Hexadecimal Byte     Decimal Value

Tracked                        00                    0
Half-Tracked                   01                    1
Wheeled                        02                    2
Leg                            03                    3
Towed                          04                    4
Air                            05                    5
Naval                          06                    6
All-Terrain                    07                    7
Tracked Amphibious             08                    8
All-Terrain Amphibious         09                    9
Mountaineer                    0A                   10
PGF's engine does not give a hoot about how SSI or hobbyists refer to all these Unit MTs (in English or any other natural language). All it cares about is the hexadecimal byte (value) which corresponds to a particular Unit MT's relative rank in the definitive, technical listing appearing immediately above. Oftentimes, the listing itself is referred to as the "Unit Movement Type Canonical Order".

User avatar
HexCode
First Lieutenant
First Lieutenant
Posts: 926
Joined: 2019-09-30 18:54, Monday

IN-GAME UPGRADES & PURCHASES: COMBATANT UNIT AVAILABILITY

Post by HexCode » 2021-12-02 16:00, Thursday

IN-GAME UPGRADES & PURCHASES: COMBATANT UNIT AVAILABILITY
===========================================================

Absolute Prerequisites

Unit Upgrade & Purchase Pop-up Screens
viewtopic.php?f=100&t=531#p9210

Units: Upgrades & Purchases
viewtopic.php?f=100&t=531#p9917

Listed & Unlisted Combatants
viewtopic.php?f=100&t=543#p11540

Unit Upgrades & Purchases In-Game: Combatant Pseudo-Tab Display Details
viewtopic.php?f=100&t=543#p11541

Engine Sorting Operations (Conceptual)

Unit Upgrade

Every time a unit is selected for potential upgrade in-game, PGF's engine engages in the following cascading, sorting operations based on data residing inside File EQUIPMENT.PGEQP:

Step A) It sorts the file's records on the basis of the selected unit's Class. The data appearing under column entitled "Class" control the sorting operation under this Step. All records sporting Unit Class designations other than the selected unit's are summarily discarded.

Step B) Next, it sorts the records identified under preceding Step A on the basis of the selected unit's Combatant ID designation. The data appearing under column entitled "Flag" control the sorting operation under this Step. All records sporting Combatant ID designations other than the selected unit's are summarily discarded.

"Flag" value MINUS ONE (-1) automatically drops the record and excludes it from any future consideration. Such Unit Types can NEVER serve as upgrade options.

Step C) Finally, the engine sorts the records identified under preceding Step B on the basis of the scenario current date. The data appearing under columns entitled "Month", "Year" and "Last Year" collectively control the sorting operation under this Step. All records sporting Time Period Availability designations within which the scenario current date does NOT fall are summarily discarded.

The remaining Unit Type records (if any) identified under Step C populate the applicable Unit Upgrade Pop-up Screen.

Unit Purchase

Every time a player activates the Unit Purchase Pop-up Screen and selects a "flag pseudo-tab", PGF's engine engages in the following cascading, sorting operations based on data residing inside File EQUIPMENT.PGEQP:

Step 1) It sorts the file's records on the basis of the selected "flag pseudo-tab's" Combatant ID designation. The data appearing under column entitled "Flag" control the sorting operation under this Step. All records sporting Combatant ID designations other than the selected "flag pseudo-tab's" are summarily discarded.

"Flag" value MINUS ONE (-1) automatically drops the record and excludes it from any future consideration. Such Unit Types can NEVER serve as purchase options.

Step 2) Next, It segregates the records identified under preceding Step 1 on the basis of Unit Class. The data appearing under column entitled "Class" control the segregation operation under this Step.

Step 3) Finally, it sorts the segregated records identified under preceding Step 2 on the basis of the scenario current date. The data appearing under columns entitled "Month", "Year" and "Last Year" collectively control the sorting operation under this Step. All records sporting Time Period Availability designations within which the scenario current date does NOT fall are summarily discarded.

The remaining Unit Type records (if any) identified under Step 3 populate the applicable Unit Purchase Pop-up Screen and are separately presented therein on a per Unit Class basis.

Post Reply