Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Technical: How is (embark) neighbor determined exactly?  (Read 7202 times)

PatrikLundell

  • Bay Watcher
    • View Profile
Technical: How is (embark) neighbor determined exactly?
« on: October 28, 2019, 04:57:35 am »

What I think I know:
- "Normal" civs have a 30 tile range.
- Kobolds and necro towers have a 10 tile range.
- Mountain and Ocean world tiles can only be passed through if there's a site on it.
- Range is measured from the closest settlement, not the capital.
- Range is calculated along the closest path, at the cost of 1 per tile, regardless of whether it is diagonal or perpendicular.
- Mid level tile information isn't used at all, i.e. an Ocean world tile that actually has a land bridge across is nevertheless not passable.
- A site on an impassable tile can be reached if a neighboring tile is passable, and makes the tile itself passable.

What I suspect:
- That Lake tiles are treated the same as Mountain and Ocean tiles, i.e. as impassable.
- A civ set to start in caves fail to expand to new sites and does not show up as a neighbor pre embark (according to tests with modded humans).
- Some unknown criteria can cause the neighbor indicator to be "NO TRADE". The wiki explains that the lack of pack animals causes "NO TRADE", and access to pullers does not negate the indication (but does allow for trade). I've just seen "NO TRADE" in a close to vanilla world (gobbos modified to start on glaciers), but won't investigate it further for the time being.

Known Unknowns:

- What are the exact criteria for determining what a civ's neighbor range is (or, even better, if there's a field somewhere that allows you to read what DF has decided, although knowing a controlling token would help modders)? Site type rather than civ type, as proposed by Fleeting Frames is a very reasonable possible alternative criterion. Humans modded to start in caves are hidden like kobolds, but are nevertheless sending a caravan to a fortress at a range of 16 (the range at which I tested it). Kobolds modded to start at mountainhomes have a normal range according to DF pre embark info, so my best guess is that the military range is restricted to 10 when starting in caves, even when the trade range is longer.
- Which sites are considered to be civ settlements from a neighbor range determination perspective? Caves can sometimes be settled by people belonging to a civ (and get linked economically to player fortresses), and there are e.g. refugee camps, but does it make them count?
- What makes a site dead? This is particularly relevant to necro towers, as I haven't found how to distinguish active ones from dud ones. DF does make a distinction for towers pre embark (it's hard to locate any test case that would test civ attached sites).

Unknown Unknowns:
- The things I've failed to realize will have to be taken into account as well.

Why care about the details: The practical use would e.g. be to allow a script to visualize civ/race ranges pre embark, and possibly to search for sites with certain kinds of neighbors. Besides the practical uses, it's DF info...

Edit: Updated the above based on Fleeting Frames feedback.
Edit 2: Further updates based on findings in this thread.
Edit 3: Updated the above. In particular, looking at DF's display shows "inexplicable" access to mountain tiles that can be explained by hidden LairShrines in adjacent tiles making those mountain tiles passable. Thus, "settlement" has been replaced with "site" when it comes to passability above. Note that the range of sites hasn't been explored, though.
« Last Edit: November 15, 2019, 12:37:49 pm by PatrikLundell »
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #1 on: October 28, 2019, 10:26:53 am »

Quote
- Does a path require perpendicular access, or are diagonal ones counted as well (and if perpendicular access is required, is a diagonal one at range 1 or 2 when a perpendicular one exists)?
Well, this one is easy *pulls up a world with tower or eighty*:

Five tower neighbours:

||

Six tower neighbours, showing diagonals count as 1 tile:

||

Five towers neighbours, showing the diagonals will zigzag but will still have reduced range when obstructed:

||


Quote
- What are the exact criteria for determining what a civ's neighbor range is (or, even better, if there's a field somewhere that allows you to read what DF has decided, although knowing a controlling token would help modders)?

I think site type; I guess caves had 10-tile range maybe? Not sure, and even more sure about sites outside of the main six.

Also, the claims map you can see in legends map mode is available in memory, though I'm not sure how you would make a good display for it within the limitations of DF's ui.

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #2 on: October 28, 2019, 12:06:33 pm »

Thanks for the useful feedback!

There are some claim structures in DF that I've failed completely to understand how they work (bits in bit maps allocated to civs mapping to something unspecified using an unspecified coordinate system and resolution that doesn't make any sense in any of the [obviously incorrect] ways I've tried to interpret it). Regardless of that, looking at Legends claim maps it seems that these cover only terrain suitable for the race, i.e. they're blocked by passable terrain such as deserts and unsuitable Evilness (and probably Savagery as well). The areas claimed are also a lot smaller than a 30 tile range, but can grow from year 10 to year 20, and so are not limited by suitable terrain, but rather (probably) grows through new settlements. The claim range looks to be something like 5 tiles or so.
Logged

Shonai_Dweller

  • Bay Watcher
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #3 on: October 30, 2019, 02:04:25 am »

So, here's an unknown unknown for you (hopefully).

I have a civ which has wagon pullers but no pack animals which I think is the cause of this feature.
It reveals that there are seperate criteria for "visiting" neighbours and "trading" neighbours. If you move too far away from them on the embark screen, they're still in the list, but a "no trade" message appears so you don't get their merchants.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #4 on: October 30, 2019, 04:31:21 am »

What do you mean with a "no trade message"? Is it something that appears on the embark screen already?
Do you know how much shorter this range is compared to the "neighbor" range?

It's certainly not something I would have expected, and haven't seen anything about human caravans showing up with animals only for any reasons except missing caravan access to the trade depot (which would be a logical result if wagons had a shorter range than pack animals).

Do you know if you get diplomats from those "no trade" civs?
Logged

Shonai_Dweller

  • Bay Watcher
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #5 on: October 30, 2019, 06:16:40 am »

What do you mean with a "no trade message"? Is it something that appears on the embark screen already?
Do you know how much shorter this range is compared to the "neighbor" range?

It's certainly not something I would have expected, and haven't seen anything about human caravans showing up with animals only for any reasons except missing caravan access to the trade depot (which would be a logical result if wagons had a shorter range than pack animals).

Do you know if you get diplomats from those "no trade" civs?
Hi, it says "no trade" where it normally says "war" or dotted lines (or blank). Move the cursor around and it comes and goes.
Behavior I've asked about in the past but no-one seems to understand. I certainly don't. Was hoping someone who actually looks at mechanics in detail (um, like you for example) would be able to explain it.

Hold up I'll try and work out the screenshot thing.

--edit
Here's the embark map. Note the Hobbits, friends of Dorfs and good trading partners. (Ignore the Wildmen, they're friendly, but don't trade or do diplomacy).


Now we move two squares North to similar terrain, no obvious blocks to traders (and there's only one Hobbit civ).
Hobbits are no longer valid traders for some reason.


« Last Edit: October 30, 2019, 07:19:39 am by Shonai_Dweller »
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #6 on: October 30, 2019, 07:41:37 am »

The screenshots weren't necessary, as the clarification was clear enough, but nice nevertheless.

The distinction between a trade range and another (diplomacy/war?) range is new to me as of this thread. Your assumption that it may be due to the non availability of pack animals sounds reasonable (although it makes little sense in realism terms that the presence of pack animals in a caravan would encourage draft animals to go further). Furthermore, it's curious that DF is both implementing it and displaying it, as I don't think it appears with vanilla raws.

How about others playing the same/similar mod(s)? Personally I've done very little in the terms of modding (more along the lines of minor adjustments than modding).

I was hoping that someone had already figured out the mechanisms involved in detail, as I'm more interested in the application end than the mechanics themselves...
Logged

Shonai_Dweller

  • Bay Watcher
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #7 on: October 30, 2019, 07:56:01 am »

The screenshots weren't necessary, as the clarification was clear enough, but nice nevertheless.

The distinction between a trade range and another (diplomacy/war?) range is new to me as of this thread. Your assumption that it may be due to the non availability of pack animals sounds reasonable (although it makes little sense in realism terms that the presence of pack animals in a caravan would encourage draft animals to go further). Furthermore, it's curious that DF is both implementing it and displaying it, as I don't think it appears with vanilla raws.

How about others playing the same/similar mod(s)? Personally I've done very little in the terms of modding (more along the lines of minor adjustments than modding).

I was hoping that someone had already figured out the mechanisms involved in detail, as I'm more interested in the application end than the mechanics themselves...
The only other possible explanation is that the wagon pullers in question (saltwater crocodiles) are limited in how far they can travel. It's a fun thing to find out. Bet Toady doesn't even remember what's going on here. :)
Incidentally, hobbits sell everything much cheaper than anyone else with some things going for free. I can't recall what I did to make that happen. Just nice guys in general I guess.
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #8 on: October 30, 2019, 10:51:02 am »

Ugh! The last time I heard "That's the only possible way Toady could have implemented it" that bullshitter was completely wrong, as revealed by unrelated events that had Toady explain how it was actually done.

To make things clear, I'm NOT equating your report with the inventions of that character, only that "only possible explanation" should only be invoked when completely certain.

If I'm not mistaken, crocs are amphibious and cold blooded (should result in limited stamina due to a lower metabolic level when used for pulling things), neither of which probably has anything to do with it, but I wouldn't relegate it to the realm of impossibility before testing it (and one test might be to make them pack animals as well).

Edit: If I'm going to be able to investigate this aspect I'll need support with modding
"   [COMMON_DOMESTIC_PACK]
   [COMMON_DOMESTIC_PULL]"
into specifications to use specific creatures for each of the tasks.

Edit 2:
Changing humans to have the same starting site token as Kobolds (CAVE) caused them to become hidden with a single site. This persists even if CITY is added to the LIKES list and the TOLERATES list is contains everything, including CAVE). Given the 5 year history of the worlds, I can't tell if they're able to expand through conquest.
Anyway, the starting site type obviously carries hidden properties with it. At least caves causes the civ to be hidden and fail to expand on its own.
I tried to embark first right next to a "cave" human civ (changing the caravan criteria to allow for them to arrive in the first summer), and a caravan did indeed show up. I then embarked again (same save, as killing DF hadn't "polluted" it with the first embark, although I did have a copy), about 20 tiles away, receiving a dwarven caravan in autumn, but no human caravan during the summer (but a migrant wave). That's not a proof, as caravans can go missing for various reasons, but it's still an indication that the cave starting site indeed restricts the interaction range to 10 tiles (I'd guess a provocation would override that, as it does for "normal" civs).

Edit 3: No. received a caravan from the cave dwelling humies at a range of 16.
« Last Edit: October 31, 2019, 06:42:49 am by PatrikLundell »
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #9 on: October 30, 2019, 04:03:39 pm »

No trade doesn't require mods to see in-game. It happens when any part of your embark overlaps tundra/glacier:

||

I'm not certain (was years ago), but I think I could get elven caravan to show up nonetheless in such situation? I'd want to retest to be sure though.

Also, obviously the above embark isn't on tundra/glacier so that doesn't apply.

Shonai_Dweller

  • Bay Watcher
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #10 on: October 30, 2019, 04:47:59 pm »

Ha, yeah, I meant to say, it's the only other reason I can think of right now. It could be anything. No river link to the site (for crocs to swim down) would be just as reasonable to assume.

--edit
Ha, and I just found a region square which is OK for hobbits to trade in, but the squares to the top, bottom, left and right are all No Trade. All five square are in the same kind of terrain, nothing unusual.

--
Oh wait, in the square to the North, hobbits can actually trade into a small patch of land at the very South of the local square, everywhere else is no trade. And that patch of land is coincidentally the only bit at 0 elevation (the rest are 1).

Elevation isn't a consistent factor though, there are other elevated areas they can trade into in different region squares.
« Last Edit: October 30, 2019, 05:08:53 pm by Shonai_Dweller »
Logged

Salmeuk

  • Bay Watcher
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #11 on: October 30, 2019, 07:08:25 pm »

Spoiler (click to show/hide)

parasitic question here, what color scheme are you using to take those screenshots? I like it!
Logged

Shonai_Dweller

  • Bay Watcher
    • View Profile
Logged

vjek

  • Bay Watcher
  • If it didn't work, change the world so it does.
    • View Profile
Re: Technical: How is (embark) neighbor determined exactly?
« Reply #14 on: October 31, 2019, 10:43:32 am »

Not sure if it helps or hinders, but the "No Trade" status can be replicated with extreme temperatures in either direction.  If it's too hot or too cold (for either insects or wandering wild animals, I can't recall which) then you'll see that "No Trade" status for neighbor civs. (-1000 or +1000 will do it, quick-n-dirty)
Having just typed that, I think sometimes.. it doesn't actually stop them?  At least under some conditions, I've had caravans show up, after the No Trade status, and instantly die due to melting or frostbite damage.
I'm sure you're capable of testing it yourselves, but if you want some help nailing down some of the temperature related realities, let me know.
Pages: [1] 2