4 tiles per city is idiotic

warhead66

Warlord
Joined
Jan 2, 2008
Messages
127
This 4 tiles between each city is driving me crazy, does anyone know how to change this in the editor?




Moderator Action: question threads belong in the main C&C forum, not in the forums for completed work.
 
Code:
<GameData>
	<Defines>
		<Update>
			<Where Name="MIN_CITY_RANGE"/>
			<Set>
				<Value>2</Value>
			</Set>			
		</Update> 	
	</Defines>
</GameData>
 
Myself, I prefer to write it as:
Code:
<GameData>
	<Defines>
		<Update>
			<Set Value="2"/>
			<Where Name="MIN_CITY_RANGE"/>		
		</Update> 	
	</Defines>
</GameData>

Regardless, there's a problem with lowering the value. Having it at 4 is NOT idiotic. The AI's logic for determining how to grow a city runs into problems if you make the minimum range too low, because it doesn't adequately consider whether a tile is already being worked (or will EVENTUALLY be worked by an expanding city) before deciding whether a site is worth settling on.

Basically, the logic goes like so:
> Calculate the Value of each tile. This Value is a combination of the unimproved yields on that tile (X points per unit of food, Y per unit of production, etc.). Strategic resources add a bonus to this number.
> Take the six tiles adjacent to the prospective site. Add their values, then multiply by (I think) 12.
> Take the 12 tiles in the next ring. Add their values, then multiply by (I think) 6.
> Take the 18 tiles in the third ring. Add their values, then multiply by 2ish.
> Total all of the above up. This is the total tile score for each prospective site.
> This is the increased based on other factors, like +50% for being on a river or +25% for being on a coastline or something, and a few negatives as well (being too close to another empire, being too far from your capital, that sort of thing).
That gives you the final score for that site. Hexes with the highest score are the ones the game will suggest to you as sites, and they're where the AI will settle.

So this should illustrate why lowering the minimum range too far is bad. If the best tiles are where your capital is (usually true, since the game seeds resources around your starting site), then the sites with the best total score will be near your capital, despite the fact that most of the tiles in question will be worked by your capital, either now or down the road as population grows. Right now the only thing that really stops the AI from packing cities in as tightly as possible is this minimum range. (Down that road lies ICS.)

A minimum range of 4 means that the first two rings are unique, and can only ever be worked by that city, and even the third ring only slightly overlaps. If you set the range to 2, though, then city B's first ring would contain one second-ring and two third-ring tiles for city A (and it'd be sitting on another third-ring tile), while its second ring would contain one first-ring hex from A, two second-ring, and two third-ring hexes. The third ring would take even more (another two hexes from each ring.) That's a pretty big chunk out of A's area (15 out of 36 hexes being overlapped), and this horribly skews the value math I gave above.
Even the 3-hex range that was the original default was problematic for this. The second-rings would still overlap, barely, and the third rings were a bit worse.

Now, you can get around this somewhat by lowering the values for the third-ring tiles further, and/or increasing the first-ring values, so that the AI will be more motivated to move further away. But that's bad, because the players DO know that they'll eventually reach those third-ring hexes and so will consider a site to be a good long-term investment if it's got a bunch of useful resources in that third ring.
 
Spatz, you're awesome...I generally play with four hexes minimum between city sites but I could never rationalize it to myself why (besides just liking bigger cities). I would get mad when ai tried to squeeze cities too close together. It's good to know how ai value city sites and to get validation for my decisions
 
Glad the information is useful.

There's also another factor I forgot to mention: by default, Settlers will only consider hexes within 20 hexes of their current location. (I upped it to 30 in my mod; it just costs processor time, and my machine is above average.) This is a big part of why AIs are slow to colonize distant islands; the devs added a specific override into the code for "colonization" settlement in the later eras, but generally speaking the settlers will only bother with sites fairly near their empires. Obviously this is a smart thing, since it's effectively impossible to defend your empire if everyone's cities are mixed together, so proximity ends up being a natural outgrowth of this process. But it does screw up certain map types if you're not careful.

That's yet another reason not to set MIN_CITY_RANGE too low; if you set it low, then the AI will pack more cities into its land area, which means that when you reach Astronomy and are ready for the next phase of expansion, the AI empires will be so crippled with unhappiness that they'll never bother expanding overseas.
 
wow i must admit, that was quite awesome indeed.

I might just give it a shot again with the four tiles knowing this, it just drives me absolute nuts when playing on a real world map.. But thanks for the tips!
 
I might just give it a shot again with the four tiles knowing this, it just drives me absolute nuts when playing on a real world map.. But thanks for the tips!

Yeah, that's the unfortunate downside. With the 4-hex limit, the only way to make a real world map look even close to comprehensible is to make it HUGE.

Now, what I've said above has a caveat: you CAN make it so that cities can only work tiles 2 hexes away from the core instead of 3. (That value's set in GlobalDefines, i think.) Do that, and now a 2-3 hex spacing would work fine because the footprints wouldn't overlap nearly as much; look at the example I gave above, and ignore anything with "third ring" in it, and suddenly it starts looking a lot nicer.

The main downside to this is that with only 18 workable tiles instead of 36, it becomes a LOT harder for cities to grow beyond size 20ish. For a scenario, where cities aren't expected to grow at all, this isn't a big deal, so feel free to pack the european cities in for a WW2 scenario.

But for general play, it'd have a few problems; for one thing, you'd have to settle considerably more cities to get the same number of resources to fall into your borders, and more cities means more unhappiness (but more buildings, more trade income, more research...)

There are a couple other minor issues. Cities have an attack range of 2 (set in GlobalDefines, again); if you leave this as-is, and allow players to settle their cities close together, then any unit entering their territory is likely to be in the firing range of multiple cities, which makes it VERY hard to invade without losing units. (This favors the player.) You could reduce this range to 1, but now you run into the problem of standoff bombardment, with cannons and trebuchets (and naval units) knocking city defenses down to nothing without taking return fire.
 
Call me crazy, but I think MIN_CITY_RANGE is the range of tiles the city can work; might MIN_START_AREA_TILES be the new-city-foundation range?
 
Call me crazy, but I think MIN_CITY_RANGE is the range of tiles the city can work; might MIN_START_AREA_TILES be the new-city-foundation range?

No.

MIN_CITY_RANGE is the minimum distance between two cities. You can't found two cities too close to each other. A value of 3 means there have to be 3 unsettled tiles between each pair of cities.
MIN_START_AREA_TILES, and the variables in that block, are only used to set the starting locations for each civ on a randomly-generated map. The game picks the initial starting locations, then uses a complex evaluation system to find the best tile within a given area of that starting point. That's where your Settler will start, which is why it's usually in your best interest to found a city on whatever tile the Settler starts on; if it isn't obviously the best tile within that area, it's because there's some hidden strategic resource skewing the math. It's similar to the logic used to give suggestions for city sites when you select a Settler later in the game.
 
To deviate from the original question slightly would it be possible to change the value for a specific civilization. say that you wanted two new civilizations for a scenario, one with an increased range so no tiles overlap (as a minimalistic, tribal, approach) and another that was just a single space between cities (for a type of global city feel).
I realize this would probably create an imbalance but could be adjusted for.
 
would it be possible to change the value for a specific civilization

No.

There are a lot of variables in the game that are treated as globals, and this is one of them. Once we get the DLL it shouldn't be too bad to make this adjustable; I've personally wanted the ability to alter a single city's work range through buildings, but it's just not possible right now. But with the tools we've been given right now, there's no way to do anything like that. There aren't any Lua stubs related to that, so there's no way to work around this sort of limitation that way either.
 
Top Bottom