Alpha Centauri 2

Sid Meier's Alpha Centauri & Alien Crossfire => Modding => Bug/Patch Discussion => Topic started by: scient on June 11, 2020, 12:22:28 AM

Title: Continent variable naming
Post by: scient on June 11, 2020, 12:22:28 AM
I've been making progress on the Path class and as part of that working on the Continent structure (https://github.com/b-casey/OpenSMACX/blob/master/src/map.h#L143). It's essentially metrics on each internal map region. For example, the first value of the struct is a tile count and another is how many pods are available. For unk_3, I pretty much know what it is but I'm leaving it alone until I wrap my head around faction sites vs goals. I just finished an initial draft of the the function (https://github.com/b-casey/OpenSMACX/blob/master/src/path.cpp#L331) that sets up unk_6 (it's essentially a bitfield for ocean regions connected to the specific land region/continent). I'm fairly certain unk_5 is padding since I haven't found any references to it.

Then there is unk_2 (https://github.com/b-casey/OpenSMACX/blob/master/src/map.h#L145) that I'm having trouble coming up with a name for it. It's specifically land tiles that meet certain criteria. It's used by enemy_move() in a bunch of places to determine doing various actions (this is largest function, so hard to discern what's going on). The good news is the exact criteria can be viewed here (https://github.com/b-casey/OpenSMACX/blob/master/src/temp.cpp#L103). Essentially, it's a count of land tiles, that are rainy or moist, flat or rolling without fungus for a Continent. Not sure why that last check is thrown in there for sea fungus but it's never considered. I thought it might be something related to how easy to traverse or move through a particular region but I'm blanking on a good way to name it. Anyway, thought I would open it up for discussion.

Title: Re: Continent variable naming
Post by: EmpathCrawler on June 11, 2020, 03:38:24 AM
clear_terrain
unobstructed_terrain
open_terrain
Title: Re: Continent variable naming
Post by: Induktio on June 11, 2020, 06:51:57 PM
I think open_terrain is a good choice here. Supposedly it means any non-rocky, non-fungused tile where you need only 1 movement point to travel to it.

The fact that uint8_t unk_6[8] has 64 bits while ocean regions are assigned 64 different IDs also seems to line up pretty well. Maybe the bits are assigned in the same order than the table for facilities built in a base?
Title: Re: Continent variable naming
Post by: scient on June 11, 2020, 09:46:55 PM
I like open_terrain as well. Thanks for input! Will update my source with it. :)

It's likely used by AI to prioritize exploration for continents that have less movement penalties.

The fact that uint8_t unk_6[8] has 64 bits while ocean regions are assigned 64 different IDs also seems to line up pretty well. Maybe the bits are assigned in the same order than the table for facilities built in a base?
Yeah, it's using exact same method as base facilities table. It's set up here (https://github.com/b-casey/OpenSMACX/blob/master/src/path.cpp#L330). I was going to name it something like "oceanAccess" once I clean up code and make sure I'm understanding exactly what it's doing.
Title: Re: Continent variable naming
Post by: EmpathCrawler on June 12, 2020, 03:08:03 AM
I'm helping!  :o
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 31 - 840KB. (show)
Queries used: 15.

[Show Queries]