spaceeinstein 1,800 Posted January 24, 2015 Share Posted January 24, 2015 (edited) UPDATE 1: Section 4 mapped! Many of the flag values have been documented! UPDATE 2: Section 2 mapped! Still unknown what it does. UPDATE 3: Check out my post regarding visibility of tunnels affected by section 4 flag 128. UPDATE 4: Flag 64 completely described! Check it out below. There seems to be almost no documentation on GTA III's CULLZONE.DAT anywhere other than at GTAModding.com. This topic will attempt to fully document the file format. The file is a binary file and is split into seven distinct sections. Section 4 is mostly documented, controlling a variety of behaviors for camera control, police, and map visibility. I have generated a table of all values for sections 1 to 4 here. -- SECTION 1 --0x00000 - dword - number of entries in section 2-- SECTION 2 --0x00004 - 52 bytes[512] - structures 0x00 - float[3] - center 0x0C - float[2] - x bottom left/top right 0x14 - float[2] - y bottom left/top right 0x1C - float[2] - z bottom left/top right 0x24 - dword - ? 0x28 - word - ? 0x2C - word - ? 0x2E - word - ? 0x30 - word - ? 0x32 - word - ? 0x34 - word - ?-- SECTION 3 --0x06804 - dword - number of entries in section 4-- SECTION 4 --0x06808 - 28 bytes[288] - structures 0x00 - float[2] - x bottom left/top right 0x08 - float[2] - y bottom left/top right 0x10 - float[2] - z bottom left/top right 0x18 - word - flag, see below for details 0x1A - word - flag, unknown details-- SECTION 5 --0x08788 - ?-- SECTION 6 --0x23538 - ?-- SECTION 7 --0x26030 - ?I am stumped at how the last three sections are formatted. It looks like they are just a bunch of 2-byte values with no structure at all. Map of section 2: Interactive map Map of section 4: Flags for section 4: [table] Flag Binary Description 1 00000001 Both on foot using classic controls and in car, when you are in the zone in third person camera modes, the camera is stuck to a close in view. Once you leave the zone, the camera returns to its former distance. If the camera is already in cinematic or GTA 2 camera mode when you enter the zone, nothing changes. The camera mode can be changed to first person, but then afterwards changing camera modes remains stuck in third person. Once you leave the zone, it will automatically switch to cinematic mode. 2 00000010 When on foot, the camera is stuck in place as it remotely follows the player. The position where the camera is stuck seems to depend on the zone geometry and point of entry. The player is best controlled when in classic controls; the zone was not designed for standard controls. If you are in GTA 2 camera mode, it will leave that mode until you leave the zone. The flag has no effect on cars. 4 00000100 When in a vehicle, GTA 2 camera mode is disabled and becomes first person. When on foot, GTA 2 camera mode is just disabled. Once you leave the zone, the camera returns to normal. 8 00001000 Rubbish is limited on the ground and there are no raindrops when it is raining. The weather can still be rainy though, like dark skies, reflective ground, etc. 16 00010000 Cops in vehicles will ignore you but you can still attain wanted level as usual. They will not chase you or use their siren. Police cars still spawn as usual when you are wanted. Cops on foot seem to be stuck in a spot when spawned but sometimes they can move to a limited extent. They will still shoot at you like normal. Once you leave the zone, they will resume chasing you down. 32 00100000 64 01000000 Resumes level transitions when traveling under z = -4.0 (level transitions are disabled below that level). 128 10000000 An interior system like Vice City and onwards was implemented for GTA III's subway system and tunnels. They are by default invisible. When you are in the zone, they will become visible. [/table] Vice City doesn't seem to read the Cullzone.dat and Cullzoneempty.dat files. Sections 1 and 3 for the former, and sections 1, 2, and 3 for the latter are completely blank. Edited June 25, 2015 by spaceeinstein 3 Link to post Share on other sites
Seemann 289 Posted January 24, 2015 Share Posted January 24, 2015 (edited) Maybe these names shed some light: http://www.3dhole.com/gtafiles/ghost_bear/GTA%203%20Source%20code%20classes.htm#CCullZones A cull zone seems to be an exception rule for some in-game places (no rain while in subway). Edited January 24, 2015 by Seemann Link to post Share on other sites
OrionSR 2,428 Posted January 25, 2015 Share Posted January 25, 2015 I have a vague memory of a cull zone map for SA by pdescobar but I can't find reference for it online. I'll dig out an old hard drive and see what I can find. IIRC, he had independent access to the SAM Java Map coding and could crank out complicated maps without too much trouble. What I remember mostly showed areas around tunnels and underground areas, and most commonly by far, under bridges and overpasses. In addition to "exceptions" for weather the cull zones appear to send away helicopter and hydra pursuit when CJ is wanted. [ NoPolice (void) ]? "Apear" in this case is a 1:1 observational correspondence of standard settings. I have used this trick extensively for 4-star exploration. My vague memory of the map makes it pretty easy to pick out what is probably a cull zone in the general area. I don't remember any surprises. Mysteries: I've long suspected that there is some sort of magic zone around the Maverick at the SF airport that prevents the Hydra from pursuing for a minute or so - you'll never get shot while taking off. Flying low over the Maverick seems to extend the same effect to other aircraft. I have no idea if this is related to cull but it seemed related to the overpass thing, sort of. [ GetWantedLevelDrop (void) ] Krawk has been trying to learn something more about what he calls "hidden bribes." The observation is that certain spots on the map will bleed away a star from the wanted level, almost like a bribe, but it has nothing to do with pickups. Ordinarily a report like this would be locked like a bigfoot myth but Krawk is a very skillful player and makes very good observations. There seems to be some independent confirmation but with only a couple of isolated spots no one knows what to think of it. Again, I've got nothing to associate this with cull other than it seemed like a good place to look. Link to post Share on other sites
Seemann 289 Posted January 25, 2015 Share Posted January 25, 2015 The GTA III saves format is more or less described, so I might have a look into the cull files soon. Link to post Share on other sites
spaceeinstein 1,800 Posted January 26, 2015 Author Share Posted January 26, 2015 (edited) Many (maybe all) zones in the cullzone.dat file do match the zones in the cull.ipl file, which has been somewhat documented already. I feel like the CCullZones class mainly deals with the CULL section of the IPL file and not the cullzone.dat file. Edited January 26, 2015 by spaceeinstein Link to post Share on other sites
spaceeinstein 1,800 Posted June 8, 2015 Author Share Posted June 8, 2015 (edited) I just discovered something interesting. It seems that GTA III does not use data from the cull.ipl; it uses data from the CULLZONE.DAT file instead. I have been doing tests on Section 4 and documented all the flags that I can test. Flag 1 - Camera close inBoth on foot using classic controls and in car, when you are in the zone in third person camera modes, the camera is stuck to a close in view. Once you leave the zone, the camera returns to its former distance. If the camera is already in cinematic/GTA 2 mode when you enter the zone, nothing changes. The camera mode can be changed to first person, but then afterwards changing camera modes remains stuck in third person. Once you leave the zone, it will automatically switch to cinematic mode. Flag 2 - Camera remotely followWhen on foot, the camera is stuck in place as it remotely follows the player. The position where the camera is stuck seems to depend on the zone geometry and point of entry. The player is best controlled when in classic controls; the zone was not designed for standard controls. If you are in GTA 2 mode, it will leave that mode until you leave the zone. The flag has no effect on cars. Flag 4 - GTA 2 camera mode disabledWhen in a vehicle, GTA 2 mode is disabled and becomes first person. When on foot, GTA 2 mode is just disabled. Flag 8 - No raindropsRubbish is limited on the ground and there are no raindrops. It can still be rainy though, like dark skies, reflective ground, etc. Flag 16 - Police behaviorCops in vehicles will ignore you but you can still attain wanted level as usual. They won't chase you or use the siren. Police cars still spawn as usual when you are wanted. Cops on foot seems to be stuck in a spot when spawned but sometimes they can move to a limited extent. They will still shoot at you like normal. Once you exit the zone, they will resume chasing you down. Flag 128 - Map visibilityThis I found most interesting. R* implemented an interior system like you see in Vice City and onwards. GTA III's subway system and tunnels by default are invisible. When you are in the zone, they will become visible. The very last parameter seems to be another flag. A flag of 100 limits your wanted level to 2 when in the zone. It won't decrease your wanted level if you already attained a higher one. A flag of 20 is used but I have not found what effect it has yet. Map of all Section 4 zones: The color scheme is similar to what I did for GTA III's cull.ipl. Almost all zones matched that file. The biggest difference is the exclusion of zones with flag 0 in them. Edited June 8, 2015 by spaceeinstein 1 Link to post Share on other sites
spaceeinstein 1,800 Posted June 10, 2015 Author Share Posted June 10, 2015 Section 2 matches many of the zones with a flag of 0 in the cull.ipl file. It seems like this section is related to loading scenes but I am unable to see any effects in my tests. I have created an interactive map for you to explore the zones yourselves. The first box is the entry number of the zone. The second box is the rest of the values that are not coordinates. Overall map of all Section 2 zones: The game does use the zones as seen with this CLEO script. The value it outputs corresponds to the entry number of the zone that you are in currently. while true wait 10 05E0: [email protected] = read_memory 0x8E2C90 size 4 virtual_protect 0 01E5: text_1number_highpriority 'NUMBER' [email protected] 10 ms 1end 1 Link to post Share on other sites
spaceeinstein 1,800 Posted June 24, 2015 Author Share Posted June 24, 2015 (edited) Something new! Flag 64 - Control level transitions while undergroundNormally when you pass the level transition boundary (see the map.zon map), the load screen pops up and the level you are entering will load as usual. The exception is that once you are below z = -4.0, level transitions are ignored no matter the boundary. If you go above that height or enter a zone with this flag, level transition resume. For example, when you enter the Porter Tunnel on the Portland side, you are traveling below z = -4.0. As you travel to Staunton Island the level transition will not occur at the map.zon boundary because you remain below this height level. Staunton Island only loads once you enter a zone with this flag. Without the zone, you would never be able to reach Staunton Island because the tunnel collision ends before you reach past the height level. The subway ignores this behavior and has its own level transition procedure. If you manage to escape the tunnels, remain below the height level, and not enter any zones with this flag, the collisions of unloaded levels will become spotty and peds and cars will pop in and out of existence. EDIT: After further tests, I have clarified and corrected any errors in my description of this flag. This should be the most complete description. Edited June 25, 2015 by spaceeinstein 2 Link to post Share on other sites
Nick007J 270 Posted October 22, 2016 Share Posted October 22, 2016 (edited) Flag 32 and last 3 sections are unique for III. Flag itself would be used if game used cull data from cull.ipl file, if flag isn't set, cull zone isn't added to zone data (section 2; CCullZones::aZones). This can be noticed in existing cullzone.dat files that zones from section 4 that have flag 0x20 set aren't present in section 2, while zones that don't have this flag are present in section 2. However, since game loads only cullzone.dat and doesn't use cull.ipl, this flag has no effect on actual game. Sections 5-7 only have effect on zones from section 2 (or, again, ones without flag 32 in IPL file). Values at offsets 0x2E, 0x30 and 0x32 of section 2 of cullzone.dat add up to a difference between at offset 0x24 of next zone and current zone. This value (at offset 0x24) is a first index in indices array (section 5), that is related to this zone. First (0x2E) elements are buildings, next (0x30)+(0x32) are treadables and difference between them is that ones from (0x30) part are used in CCullZone::DoStuffEnteringZone_OneTreadablePlus10m and from (0x32) part are used in CCullZone::DoStuffEnteringZone_OneTreadable. I'm not sure what 'Plus10m' means, function difference is in first of them sets specific treadable flag. If value from section 5 is more than 6000, instead of this new index is taken from indices array at (index-6000), (index-5999), (index-5998). Values from 6-7 are data for CCullZones::PointersToBigBuildingsForBuildings and CCullZones::PointersToBigBuildingsForTreadables. Besides using index from section 5 as an index in building and treadable pools, it's also used as an index is those arrays. This data is also used as indices in building and treadable pools. Unlike index from indices array, treadable visibility flag is not set for treadables from pointer array. Said flags affects behaviour of function CRenderer::IsEntityCullZoneVisible, which checks general flag, or, if this is a vehicle, if vehicle's treadable's own flag is set (see 'plus10m' note). It also affects CRenderer::ScanBigBuildingList. However, I am not sure what exactly it affects in-game. Values at offsets (0x28)-(0x2C) seem to be unused. However, it looks like that they are related to (0x2E)-(0x32) since these values are always more or equal than their used counterparts. Edited October 23, 2016 by Nick007J 2 Link to post Share on other sites