Maurice76 Posted September 20, 2015 Share Posted September 20, 2015 Basically, the game determines every month what to do against the inhabitants on earth. The USO's it will spawn, along with the activities they undertake, where they undertake them and how the flow of the mission goes. In order to do so, the game uses numerous data tables, which are mostly linked to one another in sometimes complex manners. This series of posts is intended to detail various specifics regarding those tables and the flow control used by the game to handle everything in proper fashion. The start is formed by the ZONAL.DAT file, in very close correlation to the ACTS.DAT file. The first one contains 12 index values, each referencing a Sea within the game (note that there are 15 defined seas in total; the final 3 in the list aren't used for this purpose). The second one contains actions to undertake within each of those seas. Because of their close relation, I will list the contents of these files together. The starting values of both files are held in the GeoScape.exe file. In my game (DOS v1.0 of TFTD), the addresses are:ZONAL.DAT: address 69620h, 12 bytes.ACTS.DAT: address 6963Ch: 12 strings of 7 bytes each.In table form: ZONAL.DAT ACTS.DAT 01 02 03 04 05 06 0718 ------- 14 16 20 20 20 00 0004 ------- 25 22 12 20 25 00 0004 ------- 25 16 21 18 18 00 0010 ------- 10 24 12 18 20 00 0016 ------- 10 10 15 20 06 00 0012 ------- 08 08 08 08 19 00 0008 ------- 07 08 08 08 09 00 0012 ------- 05 05 06 10 08 00 0015 ------- 08 13 21 13 08 00 0010 ------- 06 00 05 00 09 00 0010 ------- 15 00 00 00 22 00 0005 ------- 15 00 00 00 28 00 00 Each time the game month changes, it will run through a subroutine to determine which missions to spawn next. Note that the first month is taken separately, as it starts at noon on january 1st, so it doesn't go through the mission determination subroutine. The first time the game loops through that subroutine is on the switchover from january to february 2040. Assuming that month 0 is january (I am not 100% sure here, since I see claims on the UfoPedia site that month 0 is actually december 2039, but since the game start on january 1st of 2040 at noon coupled with the fact that a lot of data tables contain sections for month 0, I think month 0 refers to january 2040), the game will spawn 1 action for the aliens to undertake each month, besides the mandatory Terror Site mission at the start of each month. From july 2040 onwards, the game will spawn 2 actions per month, besides the Terror Site mission. Also, the game calculates a month from where to start launching monthly Floating Base Assaults, regardless of success against USO's. For that purpose, it determines the value ( 14 - DiffcultyIndex ), so for Veteran this value is 12 (january 2041), while for Superhuman, this is 8 (september 2040). It will scan the LOC.DAT file to find the first X-Com base that's not already suffering a Floating Base Attack mission against it and schedule one against that unattacked X-Com base, starting from 2h30m into the month. To determine which action to undertake during a month, the game will add up the 12 values in the ZONAL.DAT file and then determine a random number in the range of [ 1 .. that sum ]. Based on that, it is able to pick out a specific row in the table. It then uses that ZONAL.DAT index to find the proper row in the ACTS.DAT file. Like with the column of the ZONAL.DAT file, it will sum up all the values in the correct ACTS.DAT row, determine a random number in the range of [ 1 .. that sum ] and based on that, it is able to select a specific column. Each column in the ACTS.DAT table represents a specific mission type:01 = Alien Probe Mission02 = Alien Interdiction03 = Alien Resource Raid04 = Alien Infiltration05 = Alien Colony Expansion06 = Alien Surface Attacks07 = Floating Base AttacksAs can be seen from the ACTS.DAT table, the values for 06 and 07 are always zero, as these two mission types are determined differently: Terror Missions at the start of the month and Floating Base Attacks when X-Com shoots down too many USO's in a given region, as well as from the start of a certain month onwards (see above). Once it has determined a mission, it will set the corresponding entry in the ACTS.DAT file to 00. In essence, any ZONAL.DAT index can only ever have 1 of each mission types against it. When all missions on a given row in the ACTS.DAT file have been depleted, the corresponding ZONAL.DAT index is also set to 00. The effect of setting these values to zero is that the ratio of missions changes within a ZONAL.DAT index and setting the ZONAL.DAT index to zero changes the ratio between the remaining indices there. The link for the ZONAL.DAT index and the Seas actually came from a subroutine that handles Alien Infiltration success. It uses the ZONAL.DAT index to find which nations defect on a success and in which Seas and which Regions to increase the Alien Activity score (used in the monthly Graphs that can be seen ingame). Based on the information in that subroutine, I found the following: 01 North Atlantic --- USA -> Euro-Syndicate02 South Atlantic --- Africa Corp -> Brazilian Union03 North Pacific --- Euro-Syndicate -> Eurasia04 South Pacific --- Australasia05 Mediterranean --- Egyptian Cartel06 South China Sea --- Free China -> Fed Korea07 Indian Ocean --- Asian Coalition -> Arabian Bloc08 Sea of Japan --- Neo-Japan09 North Sea --- Scandinavia -> Icelandic Union10 Caribbean --- New Mexico 11 AntArctic --- (no coupled Regions)12 Arctic --- (no coupled Regions)13 Eurasia --- (not referenced anywhere by the ZONAL.DAT file; essentially undefined)14 North America --- (not referenced anywhere by the ZONAL.DAT file; essentially undefined)15 Africa --- (not referenced anywhere by the ZONAL.DAT file; essentially undefined) Arrows indicate the distinction between Primary Region of a Sea and Secondary Region. This is important when the game determines which Region will suffer the Alien Infiltration mission. For completeness sake, I have included indices 11 through 15 as well, even though 11 and 12 have no Regions attached to it (but they do have Missions scheduled in them: Alien Probe Missions and Alien Colony Expansions) and 13 through 15 have no Regions or Missions at all. The above dissection suffers from multiple bugs or very weird design choices, however. In no particular order:- Alaska is missing from the list. As a result, Alaska will never suffer Alien Infiltration missions against it and will therefore never abandon the X-Com project;- Alien Infiltrations in the North Pacific will affect the chance for the Euro-Syndicate and Eurasia to defect, even if those two Regions are not anywhere near the North Pacific;- Euro-Syndicate is listed twice (likely one of these should actually be Alaska);- As an expansion to the above, it would actually be better to swap the North Atlantic and North Pacific entries: have the USA and Alaska coupled to activity in the North Pacific and Euro-Syndicate and Eurasia by activities in the North Atlantic;- ZONAL.DAT index 10 has no Alien Infiltration mission in the ACTS.DAT file. As a result, New Mexico will also never be targeted by Alien Infiltration missions and remain loyal to the X-Com project indefinately (maybe by design because that's where T'Leth is located?);- The Region order detailed above is important. When the game determines which Region to affect, it will check if the Primary Region is already defecting or has defected (specifically: whether byte 2 in the DIPLOM.DAT file has been set to 0 for that Region). If not, the Primary Region will defect on Alien mission success. Otherwise, the Secondary Region is targeted, but no check is made to see if that one has already defected!. However, this bug is masked by another one: since each ZONAL.DAT index is targeted by no more than 1 of each mission type, only 1 Alien Infiltration mission will ever be scheduled against that ZONAL.DAT index. As such, all Regions listed as secondary target will also never suffer an Alien Infiltration mission against them (Euro-Syndicate being the exception, since it is listed once as primary Region). Because of that, Brazilian Union, Eurasia, Fed Korea, Arabian Bloc and Icelandic Union will also remain loyal to X-Com indefinately; When it comes down to spawning the monthly Terror Site mission, the game uses the following determinations regardless of difficulty: Month 0 and 1: guaranteed Port Terror Site.Month 2: 50% chance on a Port Terror Site, 50% chance on a Ship Terror site.Month 3+, less than 12 Artefact Sites destroyed: 20% chance on a Port Terror site, 30% chance on a Ship Terror site and 50% chance on an Artefact Terror site.Month 3+: all 12 Artefact Sites destroyed: 40% chance on a Port Terror site, 60% chance on a Ship Terror site. Note that Port Terror Sites get replaced by Island Terror Sites where applicable. See the post about the Spawn table further down this thread on how the game makes this distinction. Link to comment Share on other sites More sharing options...
Maurice76 Posted September 20, 2015 Author Share Posted September 20, 2015 As detailed above, the game uses the ZONAL.DAT file to pinpoint one of the Seas in which to undertake actions. Even as the game shows the Region and Seas maps on the UfoPedia site in graphic form, it doesn't show the values for each. The values are found in the GeoScape.exe file. From address 76A28h onward, it lists 38 strings of 10 bytes each. Each byte has a specific meaning within that string: Byte:[0, 1]: The X-coordinate of the top left corner of the rectangle that makes up the Sea area on the map;[2, 3]: The Y-coordinate of the top left corner;[4, 5]: The X-coordinate of the bottom right corner;[6, 7]: The Y-coordinate of the bottom right corner;[8]: The Sea code for that area (most Seas are composed of a few of these areas close to eachother);[9]: A padding byte and always 0; The X-coordinate runs from 0 (the Greenwich longitude) to 2880 in the eastward direction, the Y-coordinate runs from 0 to 720 (from the equator to the South Pole) and 0 to -720 (from the equator to the North Pole). By providing the top-left corner and the bottom-right corner, the game defines rectangular areas on the world map. The Regions are defined in a similar fashion, with starting address of 76BA4h. Like the Seas areas, the Region areas follow the same 10-byte string detailed above and like the Seas, there are 38 defined Regions. The purpose of these areas is to keep track of mission scores for both Aliens and X-Com. Whenever a mission is performed within a given area (or simply have a Craft present in the area), the score of that area is increased by an amount designated for that particular activity. Link to comment Share on other sites More sharing options...
Maurice76 Posted September 20, 2015 Author Share Posted September 20, 2015 Once the missions have been picked at each month turn, the game refers to a table that controls the general Mission Flow. The table has 8 entries of 8 bytes each, for every of the 8 possible mission types. In addition to the 7 mission types already listed above, mission type 8 is formed by the Colony Supply Missions. Those missions are scheduled independently of the mission spawn table and depend on the presence of Alien Colonies on the map. Generally, the 8 entries represent Mission Stages within that mission. Each stage is composed of 8 bytes with the following meaning:Bytes:[0, 1]: USO type to carry out this Mission Stage;[2, 3]: Number of iterations for this Mission Stage (most have an iteration of 1, but exceptions exist);[4, 5]: Index to the USO Movement Behaviour table (detailed in the next post);[6, 7]: Spawn time base value for this Mission Stage (i.e.: when it has to move on to the next iteration of this Stage or next Mission Stage if it has reached the maximum number of iterations on this Stage); USO type is defined by number:05 = Survey Ship06 = Escort07 = Cruiser08 = Heavy Cruiser09 = Hunter10 = Battleship11 = Dreadnought12 = Fleet Supply Cruiser Iterations simply mean the same stage is repeated that many times. The Movement Behaviour table contains data for the trajectory between each of the waypoints that the USO follows during its mission. This table is detailed in the next post. The actual spawn time is calculated through a formula, to generate a random spread around this base value. The game calculates it as follows: Actual spawn time = [ RAND ( <base value> ) + TRUNC( <base value> / 2 ) ] Basically, this gives an actual spawn time between 50% and 150% of the base value. According to the UfoPedia, successful USO interceptions affect the timer for the next USO in the Mission Stage chain (and may even completely break the chain), but I haven't been able to discover that data yet. The Mission Flow table per mission type is detailed below. At the right hand side of the columns is the timer in better readable format. This is the base value in number of 30 minute ticks that have to pass to spawn the next Mission Stage in question. Note that this is a redundant value for the final Mission Stage and final iteration of that Stage, as no further Stages occur after it. ================================================================== Mission type: Alien Probe MissionStart address: 66604h Columns: USO NUM Index Spawn TimeStage 1: 5 0 1 0 0 0 44 1 || 300Stage 2: 6 0 1 0 2 0 4 1 || 260Stage 3: 7 0 2 0 4 0 44 1 || 300Stage 4: 255 255 255 255 255 255 255 255 || unusedStage 5: 255 255 255 255 255 255 255 255 || unusedStage 6: 255 255 255 255 255 255 255 255 || unusedStage 7: 255 255 255 255 255 255 255 255 || unusedStage 8: 255 255 255 255 255 255 255 255 || unused ================================================================== Mission type: Alien InterdictionStart address: 66644h Columns: USO NUM Index Spawn TimeStage 1: 5 0 1 0 0 0 4 1 || 260Stage 2: 5 0 1 0 2 0 4 1 || 260Stage 3: 6 0 1 0 2 0 200 0 || 200Stage 4: 7 0 1 0 0 0 4 1 || 260Stage 5: 7 0 1 0 3 0 44 1 || 300Stage 6: 8 0 1 0 4 0 100 0 || 100Stage 7: 8 0 1 0 4 0 25 0 || 25Stage 8: 11 0 1 0 2 0 50 0 || 50 ================================================================== Mission type: Alien Resource RaidStart address: 66684h Columns: USO NUM Index Spawn TimeStage 1: 5 0 1 0 0 0 244 1 || 500Stage 2: 6 0 1 0 1 0 88 2 || 600Stage 3: 7 0 1 0 3 0 44 1 || 300Stage 4: 9 0 1 0 3 0 44 1 || 300Stage 5: 9 0 2 0 4 0 2 0 || 2Stage 6: 255 255 255 255 255 255 255 255 || unusedStage 7: 255 255 255 255 255 255 255 255 || unusedStage 8: 255 255 255 255 255 255 255 255 || unused ================================================================== Mission type: Alien InfiltrationStart address: 666C4h Columns: USO NUM Index Spawn TimeStage 1: 5 0 1 0 0 0 38 2 || 550Stage 2: 6 0 1 0 1 0 244 1 || 500Stage 3: 6 0 1 0 6 0 204 1 || 460Stage 4: 7 0 1 0 7 0 44 1 || 300Stage 5: 7 0 1 0 7 0 2 0 || 2Stage 6: 10 0 1 0 7 0 2 0 || 2Stage 7: 12 0 1 0 7 0 2 0 || 2Stage 8: 11 0 2 0 7 0 2 0 || 2 ================================================================== Mission type: Alien Colony ExpansionStart address: 66704h Columns: USO NUM Index Spawn TimeStage 1: 5 0 1 0 1 0 194 1 || 450Stage 2: 6 0 1 0 5 0 244 1 || 500Stage 3: 7 0 1 0 5 0 2 0 || 2Stage 4: 12 0 2 0 5 0 2 0 || 2Stage 5: 11 0 1 0 6 0 2 0 || 2Stage 6: 255 255 255 255 255 255 255 255 || unusedStage 7: 255 255 255 255 255 255 255 255 || unusedStage 8: 255 255 255 255 255 255 255 255 || unused ================================================================== Mission type: Alien Surface AttacksStart address: 66744h Columns: USO NUM Index Spawn TimeStage 1: 6 0 1 0 1 0 244 1 || 500Stage 2: 7 0 1 0 1 0 64 1 || 320Stage 3: 10 0 1 0 0 0 144 1 || 400Stage 4: 10 0 1 0 7 0 44 1 || 300Stage 5: 255 255 255 255 255 255 255 255 || unusedStage 6: 255 255 255 255 255 255 255 255 || unusedStage 7: 255 255 255 255 255 255 255 255 || unusedStage 8: 255 255 255 255 255 255 255 255 || unusedNote that this mission flow control has nothing to do with the Terror Site missions that are spawned at the start of each month! Those missions are spawned without USO presence. Since these Terror Missions are also not spawned through the monthly mission spawning subroutine (see opening post), these may be spawned through another mechanism. I haven't found it yet, but I am very certain that I have shot down USO's that had Alien Surface Attacks as mission, according to the Transmission Resolver. ================================================================== Mission type: Floating Base AttackStart address: 66784h Columns: USO NUM Index Spawn TimeStage 1: 5 0 1 0 8 0 100 0 || 100Stage 2: 6 0 2 0 8 0 100 0 || 100Stage 3: 7 0 3 0 8 0 100 0 || 100Stage 4: 11 0 2 0 8 0 100 0 || 100Stage 5: 255 255 255 255 255 255 255 255 || unusedStage 6: 255 255 255 255 255 255 255 255 || unusedStage 7: 255 255 255 255 255 255 255 255 || unusedStage 8: 255 255 255 255 255 255 255 255 || unused ================================================================== Mission type: Colony Supply MissionsStart address: 667C4h Columns: USO NUM Index Spawn TimeStage 1: 12 0 1 0 9 0 200 0 || 200Stage 2: 255 255 255 255 255 255 255 255 || unusedStage 3: 255 255 255 255 255 255 255 255 || unusedStage 4: 255 255 255 255 255 255 255 255 || unusedStage 5: 255 255 255 255 255 255 255 255 || unusedStage 6: 255 255 255 255 255 255 255 255 || unusedStage 7: 255 255 255 255 255 255 255 255 || unusedStage 8: 255 255 255 255 255 255 255 255 || unused Link to comment Share on other sites More sharing options...
Maurice76 Posted September 20, 2015 Author Share Posted September 20, 2015 While the Mission Flow control table detailed in the previous post handles the general spawning order, it doesn't say anything about where to spawn the USO's and where they have to move to perform their missions. As written in that post, each Mission Stage has a pointer into the Movement Behaviour table, which details the behaviour of the various USO's, based on the missions they perform. To keep track of what a given USO is doing, this is also stored within the CRAFT.DAT file of the corresponding USO, at the bytes 0x58-0x59 and 0x5A-0x5B. The values of those bytes are currently said to be of "Unknown use." according to the CRAFT.DAT entry on the UfoPedia site, but they are used to keep track of the progress within the Movement Behaviour table. Bytes 0x5A-0x5B hold the index into the Movement Behaviour table, while bytes 0x58-0x59 hold the number of Waypoints that the USO has passed since the mission started (where the spawnpoint of the USO is considered to be Waypoint 0). The Movement Behaviour table itself has 10 rows of 52 bytes each. The buildup of each row is according to this:[0, 1]: Maximum number of Waypoints for this Movement Behaviour type (only has values of 2, 5 and 8);[2 .. 17]: Per waypoint, each two bytes contain a sub-index into a (huge) Spawnpoint table (of which the ZONAL.DAT reference is the main index). This Spawnpoint table is detailed in the next post in build-up only, as it's too large to post completely in a forum post. A value of 255 here means the Waypoint is not used.;[18 .. 33]: Per waypoint, each two bytes contain the depth at which the USO is moving between the waypoint it just left behind and the one it's heading towards;[34 .. 49]: Per waypoint, each two bytes contain the velocity percentage at which the USO performs that movement, relatively to its maximum velocity;[50, 51]: A timer. UfoPedia lists this as the decay timer for USO wrecks as well as maximum time spent moving between waypoints, but I don't think this can be correct. It would make decay times for identical USO's depend on the Mission Stage they were performing at the time. Furthermore, the timer on Fleet Supply Cruisers is only some 13 hours, which would mean those USO's would vanish in just over half a day of being downed. As timers for Terror Missions that spawned based on them as well as Touchdown timers before USO's take off again, these values make much more sense. The first waypoint index in the tables below is where the USO is spawned. Each time it reaches the next waypoint on its movement, it will adopt the values listed at that particular waypoint to travel to the next. Once it reaches the final waypoint, it will vanish again from the map. Note that except for the final Waypoint in the list, a depth of 0 means that the USO is touched down (green cross on the world map). In table form (note that the Waypoint counter is implicit, as it is derived from the position in the table): Movement Behaviour type 0Start address: 66804hMaximum Waypoints of this type: 5Expiration timer: 3000 (in ticks of 5 seconds, so roughly ~21 hours) Waypoint counter: 01 02 03 04 05 06 07 08Spawnpoint Index: 5 0 0 0 0 0 1 0 5 0 255 255 255 255 255 255USO Depth: 4 0 3 0 1 0 1 0 2 0 0 0 0 0 0 0 USO speed %: 100 0 74 0 28 0 47 0 100 0 0 0 0 0 0 0 How to read this table:First, a USO is spawned at a point defined by the corresponding ZONAL.DAT index of the mission it is part of, as well as the sub-index of waypoint 01.As it is spawned, it is set to a depth of 4 ("Very Deep"). Note that for the first 3 months ingame, there is an override which sets this to a value of 3 ("Deep").The speed is set to 100% of its maximum velocity. A destination waypoint is created for the USO, this one with a sub-index of 0, but with the same ZONAL.DAT main index. Once the USO reaches this destination waypoint, it will move up in depth to a depth of 3 ("Deep") and change its velocity to only 74% of its maximum velocity. The next destination waypoint is defined, once again with a sub-index of 0. Once the USO reaches it, it will move up to a depth of 1 ("Shallow") and drop its speed to 28% of its maximum. Its destination is a waypoint with a sub-index of 1. At that next waypoint, it picks up in speed, increasing to 47% of maximum and it gets a destination waypoint with a sub-index of 5. Once it reaches that one, its speed picks up to 100% again and it will high tail it out of the map at that point. While this final waypoint has a depth of 2 ("Normal"), I don't think the game actually uses it, since it's set to 0 ("Touched Down") for most of the other Movement Behaviour types. From what I can see in the game code, though, the USO simply gets removed from the game once it reaches this final waypoint if it's invisible. If it's visible, it calls on another subroutine, which is likely displaying it taking off at a high speed, beyond X-Com reach. If that's the case, the depth and speed at the final Waypoint are not used ingame and therefore redundant. ================================================================================== Movement Behaviour type 1Start address: 66838hMaximum Waypoints of this type: 8Expiration timer: 4000 (in ticks of 5 seconds, so roughly ~28 hours) Waypoint counter: 01 02 03 04 05 06 07 08Spawnpoint Index: 5 0 0 0 0 0 1 0 0 0 0 0 2 0 5 0USO Depth: 4 0 2 0 2 0 1 0 0 0 2 0 1 0 0 0 USO speed %: 100 0 76 0 20 0 44 0 20 0 32 0 65 0 100 0 ================================================================================== Movement Behaviour type 2Start address: 6686ChMaximum Waypoints of this type: 5Expiration timer: 5000 (in ticks of 5 seconds, so roughly ~35 hours) Waypoint counter: 01 02 03 04 05 06 07 08Spawnpoint Index: 5 0 0 0 0 0 1 0 5 0 255 255 255 255 255 255USO Depth: 4 0 3 0 2 0 1 0 0 0 0 0 0 0 0 0 USO speed %: 100 0 57 0 26 0 50 0 100 0 0 0 0 0 0 0 ================================================================================== Movement Behaviour type 3Start address: 668A0hMaximum Waypoints of this type: 5Expiration timer: 6000 (in ticks of 5 seconds, so roughly ~42 hours) Waypoint counter: 01 02 03 04 05 06 07 08Spawnpoint Index: 5 0 0 0 0 0 2 0 5 0 255 255 255 255 255 255USO Depth: 4 0 3 0 2 0 1 0 0 0 0 0 0 0 0 0 USO speed %: 100 0 30 0 25 0 20 0 100 0 0 0 0 0 0 0 ================================================================================== Movement Behaviour type 4Start address: 668D4hMaximum Waypoints of this type: 8Expiration timer: 7000 (in ticks of 5 seconds, so roughly ~49 hours) Waypoint counter: 01 02 03 04 05 06 07 08Spawnpoint Index: 5 0 0 0 0 0 2 0 0 0 0 0 2 0 5 0USO Depth: 4 0 2 0 2 0 1 0 0 0 2 0 1 0 0 0 USO speed %: 100 0 67 0 52 0 40 0 30 0 20 0 30 0 100 0 ================================================================================== Movement Behaviour type 5Start address: 66908hMaximum Waypoints of this type: 8Expiration timer: 4000 (in ticks of 5 seconds, so roughly ~28 hours) Waypoint counter: 01 02 03 04 05 06 07 08Spawnpoint Index: 5 0 0 0 0 0 4 0 0 0 0 0 4 0 5 0USO Depth: 4 0 2 0 2 0 1 0 0 0 2 0 1 0 0 0 USO speed %: 100 0 50 0 20 0 15 0 20 0 29 0 42 0 90 0 ================================================================================== Movement Behaviour type 6Start address: 6693ChMaximum Waypoints of this type: 5Expiration timer: 5000 (in ticks of 5 seconds, so roughly ~35 hours) Waypoint counter: 01 02 03 04 05 06 07 08Spawnpoint Index: 5 0 0 0 0 0 4 0 5 0 255 255 255 255 255 255USO Depth: 4 0 3 0 2 0 1 0 0 0 0 0 0 0 0 0 USO speed %: 100 0 50 0 25 0 16 0 100 0 0 0 0 0 0 0 ================================================================================== Movement Behaviour type 7Start address: 66970hMaximum Waypoints of this type: 5Expiration timer: 9000 (in ticks of 5 seconds, so roughly ~62,5 hours) Waypoint counter: 01 02 03 04 05 06 07 08Spawnpoint Index: 5 0 0 0 0 0 3 0 5 0 255 255 255 255 255 255USO Depth: 4 0 3 0 2 0 1 0 0 0 0 0 0 0 0 0 USO speed %: 100 0 60 0 30 0 20 0 100 0 0 0 0 0 0 0 ================================================================================== Movement Behaviour type 8Start address: 669A4hMaximum Waypoints of this type: 8Expiration timer: 6000 (in ticks of 5 seconds, so roughly ~42 hours) Waypoint counter: 01 02 03 04 05 06 07 08Spawnpoint Index: 5 0 1 0 2 0 3 0 4 0 0 0 2 0 5 0USO Depth: 4 0 1 0 1 0 1 0 1 0 1 0 1 0 4 0 USO speed %: 100 0 60 0 20 0 30 0 20 0 42 0 56 0 100 0 ================================================================================== Movement Behaviour type 9Start address: 669D8hMaximum Waypoints of this type: 2Expiration timer: 2000 (in ticks of 5 seconds, so roughly ~14 hours) Waypoint counter: 01 02 03 04 05 06 07 08Spawnpoint Index: 5 0 5 0 255 255 255 255 255 255 255 255 255 255 255 255USO Depth: 4 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 USO speed %: 80 0 100 0 0 0 0 0 0 0 0 0 0 0 0 0 Movement Behaviour type 9 is only used by Colony Supply Cruisers on Colony Supply Missions. Note that it's the only USO that moves at 80% of its maximum velocity right after spawning. Given that it moves towards an Alien Colony after spawning, I am guessing that the proper coordinates of the corresponding Alien Colony are supplied as an extra Waypoint directly between the Spawnpoint and the final Waypoint (which functions as the exit for the USO, where it vanishes off the world map). Link to comment Share on other sites More sharing options...
Maurice76 Posted September 20, 2015 Author Share Posted September 20, 2015 As written in the previous post, there is a Spawn Table, which takes the ZONAL.DAT index as well as a sub-index based on movement behaviour to define a specific spawnspot. This spawn table is rather huge: the ZONAL.DAT index has 12 different values and the sub-index has another 6, making for 72 rows. Each row has 10 entries of 8 bytes each, making each row 80 bytes. The total size is therefore 72 x 80 = 5760 bytes in size. Given that massive size, I can't and will not post the full data table here, but I will describe the contents and how the game uses it. First of all, in my GeoScape.exe version, the start address is 66A0Ch, the final address is 6808Bh. When the game references the Spawn Table, it takes the ZONAL.DAT index as well as the sub-index to find the proper row in the Spawn Table. Then it will randomly determine a number from 0 to 9 to find the proper entry on that row. Each entry holds coordinate information for a Spawn Point and if the first two bytes contain the value 255, the spawnpoint is not used. In that case, the game will redetermine the random number and keep at it until it has found a valid spawnpoint. As said, each entry has 8 bytes, which have the following meaning:Byte [0, 1]: X-coordinate of the spawnpoint on the worldmapByte [2, 3]: Y-coordinate of the spawnpoint on the worldmapByte [4, 5]: Maximum X-offset relative to the X-coordinateByte [6, 7]: Maximum Y-offset relative to the Y-coordinate The maximum X-offset value is used as maximum value in a random number generation. The outcome is added to the specified X-coordinate to get the actual X-coordinate of the object to spawn. The same applies for the Y-offset value. Using the maximum X-offset and maximum Y-offset essentially forms a small box for each Spawn point, in which an object can be spawned. It would be an interesting exercise to map each of them on a Sea and Region, drawing them on the world map just like the image was made for the Seas and Regions on the UfoPedia site (see an above post for the link). Note that the coordinates are as used in the ingame worldmap: X runs from 0 to 2880 eastwards, where 0 and 2880 are the Greenwich longitude positions. Y runs from 0 to 720 for the southern hemisphere, with 720 being the South Pole. Similar, it runs from 0 to -720 for the northern hemisphere, with -720 defining the position of the North Pole. Besides being used by the Movement Behaviour table to find Waypoints, some of the sub-indices have another purpose, too. Sub-index 4 is used to generate locations for Alien Colonies. Sub-index 3 is used to define Port Terror sites and Island Terror sites. Since they are fixed on the world map, their X-offset and Y-offset values are all 0, which means sub-index 3 values are all precise coordinates. There are 51 of those out of the 100 possible ones for sub-index 3, the other 49 are invalid coordinates (value 255 for the first 2 bytes). The game actually uses an overlay to find whether the coordinates of sub-index 3 represent a Port Terror site or an Island Terror site. This overlay starts at address 681E0h and is 102 bytes in size, 2 bytes per Terror Site. The second byte is a padding byte in each case. 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 Omitting those for readability, the byte string can be ordered per ZONAL.DAT index as follows (with the ZONAL.DAT and NUM SITES numbers added by me for readability, they are not part of the overlay byte string): ZONAL NUM TERROR MISSIONINDEX SITES TYPE 0 6 1 0 1 0 0 0 1 7 0 0 0 1 1 1 1 2 5 0 1 0 1 0 3 8 0 1 1 1 1 1 0 1 4 5 1 0 0 0 0 5 5 0 0 0 0 0 6 5 0 1 1 1 1 7 3 0 0 0 8 4 0 1 0 0 9 3 0 0 0 The column NUM SITES equals the number of Spawn points at sub-index 3 for the corresponding ZONAL.DAT entry. Once the game has determined which of the Spawn points it is going to use for the Terror Mission, it will look up the matching value in the overlay. If this value is 0, it will generate a Port Terror Site at the designated coordinates. If the value is 1, it will generate an Island Terror Site instead. I have not found references to this table to spawn Ship Terror missions or Artefact Terror missions, but those of course must exist, seeing as they're spawned on the world map too. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now