Freeciv
Advertisement

A more flexible borders system, where territory can be gained without capturing cities. It flows depending on terrain type and roading as well, diminishing in strength the further from cities it gets.

Curvy borders

Mock up of curvy borders to help sell the idea. Blue thickness with more fading would look best I think.

Basics[]

Borders are still generated by cities (and occupied fortresses), but only on the city tile itself.

The amount generated at a city center is modified most importantly by it's size, but also units present, palace, buildings, wonders, government, happiness, terrain etc.

The next turns border state is found by blurring all non-city border tiles currently belonging to that civilization and tiles neighboring it's border tiles. (Current tile strength) = (decay rate of tile) X (average of the 2 highest surrounding tile's border strength. Might have to modify this for hex, 2/6 - 33% and 2/8 - 25%.

The decay rate should be based on terrain type: ie 0.85 for grassland & plains,0.6 for hills, 0.5 for mountains, tundra and sea, 0.25 - 0 for deep ocean and glacier. Some of this can be negated by the presence of roads, rivers and rail on that tile, penalty reduced 50% for roads, 75% for rails.

Should only need 1 or 2 blur passes a turn, depends on cpu use I suppose and how fast the borders need to grow.

A stopping threshold will have to be established or else your borders will grow forever outwards. If it fades to below a certain strength, the value is stored, but the tile remains borderless and neighboring tiles are not evaluated.

If two borders intersect the one with the most strength gains the tile, if equal current owner retains.

Drawbacks[]

  • More server CPU / end of turn calculation
  • More server Memory
  • More savegame space
  • Might be difficult for new players to understand
  • Will take lots of play testing to find the right balances between generation / decay rates / stopping threshold / blur iterations / percentage of surrounding tiles averaged

Additional Possibilities[]

Borders can / can't grown into unknown territory ?

Decay rate increases if the tile is already owned by another player's border to help maintain border stability. This could vary depending on diplomatic state.

All territory within your borders is visible to make them more important. Perhaps even 1 tile outside your borders, or just tiles surrounded by 3 or more border tiles. So then you can keep track of units disrupting your borders. Could even be made variable ruleset effect, so you can only see around cities like in freeciv 2.1 or up to 2 or 3 tiles past your borders.

Early Game[]

Possibly negate some of the decay rate for tiles that are worked by a city. Then have a production penalty for those tiles outside your borders at the start of the game instead of corruption, with your capital growing bigger borders.

This'll make building roads to specials 2 tiles away from your city more important for gathering so your borders can envelop them.

Would make it extremely difficult to use fish and whales effectively too without Map Making / Seafaring to lessen the border decay rate on ocean tiles.

Would weaken the advantage that 1 pop cities get by having twice the # tiles worked, whereas size 2 only get 1.5, 3 gets 1.25 etc. Basically limiting a size 1 city to a single special.

Units[]

Military units should also strengthen your borders, but no where near as much as a city. And less than if they're stationed in a city / fortress. Perhaps based on (Strength + Defense) X Hitpoints or shield cost so you can't have a massive mob of warriors, but later units will be able to keep up with mega cities.

They can only augment an existing border, so you'll need to build / capture a city or make a fortress deep within enemy territory.

Your military units should also increase the decay rate of enemy borders when within non friendly territory.

These unit effects should taper off the more units you have on a tile. Something like 100% for 1, +80% for 2nd, +60% for 3rd etc. So you can't have a massive immovable stack sitting on a mountain screwing up an enemies borders too much.

Diplomacy[]

An option to settle border disputes when at peace, where your two borders will not interact when they encounter each other, and will settle on their natural equilibrium.

Tech leakage, rate could be increased depending on how many border tiles you have intersecting with a player. Stationing units at your border would reduce this and government choice as well.

External culture influence could be calculated from border proximity and government / building effects.

Ruleset Configurable[]

  • City population strength generation
  • City building, wonder etc modifiers
  • Fortress strength generation
  • Unit City/Fortress Strength addition
  • Unit border strength addition
  • Unit enemy border decay increase
  • Terrain types decay rate
  • Road/Rail/river decay reduction
  • Border stopping threshold
  • Number blur iterations / turn
  • Percentage of surrounding tiles to average

Effect Examples[]

  1. Increases you border generation +XX% but also increases the stopping threshold by +XX%, Making it more difficult for enemy units / borders to manipulate your borders without changing their range significantly.
  2. Increase capital generation +300% under monarchy while reducing it in all other cities you control by 50%.
  3. Courthouse +50% to city
  4. Reduce ocean decay if harbor / port within X squares or discovery of improved ship technology.
  5. Reduce terrain decay on discovery of flight.

Coding[]

for each player { // can be done concurrently for multiproccesors as each is independant

  1. Add city / fortress / unit generation to previous turns borders
  2. Blur
    1. get current border tile
    2. average the highest X% of surrounding tiles border values (careful for edge of map)
    3. take note of tiles that have no border, to evaluate for border growth later in the blur, will need a set container as they'll be added more than once.
    4. evaluate each tile for terrain, enemy units, roads, rails to calculate diminishing on this tile
    5. multiply
    6. store in different border container than the one it's evaluating
    7. take note of unowned tiles that have changed, ones that are now below stopping threshold and ones that overlap with other players borders for later evaluation (another set as there will be duplicates when other players are evaluated).
  3. swap out and make current players border strength

}

Evaluate changed unowned, dropped below threshold and overlapping tiles for change of ownership and send changed tiles to players.

Problems[]

Store border strength as a int, don't think a single char will be big enough, have an upper limit of 999 or something. Don't think there would be enough storage for it to work properly in a single character, might be able to get away with 99.

Need custom code for city capture, or your new city will be stuck with only the city center for several turns. Perhaps cities generate borders on more than the center, like a + or 9 square grid, this can then be used to emulate the previous absolute border style with no blur. Or run a few blur iterations on the tiles surrounding the city.

River Generation[]

Just occurred to me observing a gen 2 game this could also be used for extremely good river generation with hardly any modification.

Just set deep ocean to generate with no decay and fade towards the center of landmass on all other land and shallow ocean. The river then heads towards the center.

Another blur would be needed generated by mountains and hills, with more decay on hills. The river will also head towards this, but also use it to avoid them when near the sea. Perhaps adding up the wetness of it's tiles as it goes along, getting negatives for plains and deserts, deciding how desperate it is to seek out mountains or just scoop up a few more jungles and swamps. Might need a separate blur for wetness as well.

Then yet another once a river is created, generate on the new river tiles and blur all the tiles around it 5 or 6 times to prevent other rivers heading towards it or being created near it.

Then maybe another one for fresh water lakes, but only ocean mouthed rivers will head towards those.

Rivers would look better than the current code that just takes it a tile at a time and tries to head uphill (or just avoid ocean and other rivers in the island gen). Whereas this will take the destination into account and whether there are other rivers already around. Avoiding hills and mountains initially and even crossing deserts (gen2 avoids them) to head towards a motherload of mountains.

Will take lots of CPU to generate, but it's only done once per game and so is worth doing properly.

Art[]

Curvy borders, done the same way as the fog. Each border is centered above the corners where 4 tiles meet. 14 images. ~6 for hex

Mini pie charts / bar graphs overlay to show relative tile border strength and ownership. Bigger the circle / wider the graph, stronger the borders there, then split into percentages of claim. Mostly for debugging.

You Have My Vote[]

This is something in Civ3 that i feel is preferable to how we do it now. To describe it again, each city pushes the border out with a force equal to how 'cultured' the city is; i.e. not just population but literacy, happiness, buildings, wonders, palace, etc. Anyway, like gravity, this force falls off rapidly over distance. However, a strong enough force will not only push back an enemy border. When the force overpowers the force emitted by a nearby enemy city [enough that your force is stronger in the city center than the enemy's] the entire city will 'defect' to you. I find this more satisfying than reducing enemy cities a person at a time [through migration].

Speaking of migration, there needs to be some careful thought as to how [or whether] these two overlapping topics combine.

Given the wide variety of devices that Freeciv is available on, i think it best if border recalculation is done in such a way as to minimize CPU load. Perhaps one iteration per turn, but store the results in an array for use as a starting point next turn? In any case, the commercial version was tolerably slow on a 500 MHz processor...

As to whether players will understand the details of how this works, i'm not convinced that most players understand how the current border system works now. As long as the player is suitably informed when some 'interesting' action happens, then i don't think it will be an issue. Put a plain language version of the algorithm up on the wiki for the curious, and the really curious can look at the source.

I don't feel as though military units can add much to value of a city. Where they would be worth counting is where they are in a fortress. Even then, no unit should be worth as much as a city. Once we figure out a scaling value for that, the 'best' [highest shield value] unit is the basis for the force. This is added to by the decreasing value of each additional unit.

City capture: I think it best that there is a turn or two in which the border fully envelopes an enemy city before it is captured. This gives the opposing player a chance to build it up [if they think there's a chance to keep it] or sell the improvements if they don't feel confident.

I am intrigued by the possibility of using the algorithm to generate rivers. I caution that a 'fully developed' river generation routine will have significant differences from a 'fully developed' border finding routine. In any case, the developers prefer each patch to address a single topic, so in practice this would be multiple tickets anyway.

Is new art really needed? Both the old and the new borders will still either fully own [or not own] any given tile.

Yautja, do you have a patch for people to try out? Also, since discussion is a little tricky in the wiki, have you posted any of this to the forum?? --Dentrassi BBQ 09:05, July 13, 2011 (UTC)

Advertisement