We also know how to disagree well.
Well, perhaps we can have more agreement on something like, higher adjacency is better than low adjacency! In regards to machine learning I just meant that we know already
how to place districts well, we don't need to datamine it.
Plus there's so many more factors at play here too. For example, if you're next to Roraima, you can easily get a +4 holy site or even a +6 one. But for that +4 holy site you're giving up a tile that has +2 faith and +2 science. Do you build the campus in the best spot for the campus, even if that is where your ideal aqueduct spot happens to be?
Never mind the basic planning - do you slot in each district one by one? Do you plan what you will want assuming the city grows to size 4? 7? 10? 20? +4 campus spot is great, but what if that's my only mine tile? Or do I really want to build the campus next to the Volcano, maybe I would be better to get a lower yield elsewhere.
But it is exactly working through these questions to find a "one size fits most" solution that would be such a benefit. I carefully did not say the AI should have an optimal placement strategy. Just a decent one.
Part of working out something better than what we have is exactly figuring out how to set planning portion to balance complexity vs yield.
But I'd bet that if we dug down into AI decision making, they'd get a lot better by revisiting other areas
I know, but we fanatics have infinite bandwidth for low priority discussion!
Trying to teach the AI to place districts more effectively is a noble cause, but if successful would make the game harder for new players who haven't learned how to balance district placement with improvements, etc. In this (and many other) ways I'd simplify the game for the AI and beginners. If effective district placement is a skill developed by players over time, it could be mimicked by giving the AI +1 adjacency bonus per district at Emperor, +2 at Immortal, and +3 at Deity. That would force the player to be more efficient in their own district placement to keep up when playing at higher difficult levels, without putting more pressure on those playing at lower difficulty levels.
This was something I had thought about to make the AI properly capable of scaling into the midgame, and it's what inspired me to make this discussion. Since allocating citizens to tiles is the same routine for human and AI unless we manually intervene, it's really just districts producing the economic gap. The AI can certainly have more cities and improvements and units out than you can. The balance of course can be toning back the AI's other general bonuses to growth and production if ti's too overwhelming. Although on sub-prince I doubt it will really have the exponential effect that emperor+ bonuses would have. It's a great backup option that i think would introduce a lot more
realistic challenge to the game than the current production boosts.
One of the killers off the bat I can think of is... I do not have that tile, will I expand to that tile soon, shall I buy that tile, how much gold do I have to spend, what else do I need to spend gold on and should I slot the 20% card. You do not have to account for all those decisions in the first edition but you know it is questions we answer without thinking once we have played a bit and require and understanding of the terrain around for a variety of reasons. One really good example of this is an early encampment is an option and the aggressive AI does build them early. You first expansion into 2nd ring tiles are onto resources and we do not really want to place them there. Do you expand to an empty tile that is a potential 3 farm triangle? Do I build it on a hill? Do I place it where a threat is coming from? What are my priorities, especially as I have already built 2 in pother cities.
I like these questions. You get it. I'll get to it later but in my head, the AI's strategic level goals should dictate districts more than the other way around, because if we keep them separate then they can be improved in a modular way. You never want to introduce a circular dependency when you can avoid it. [Strat defines districts defines strat defines...]
From what I have designed and implemented in the past the best approach is to start simple and get simple running before leaping toward predicting power plants.
You understand exactly what I am getting at. No one reading this should think that you can deploy a full, 'takes everything into account,' right away and expect it to work. Like most software the first thing is to have something you can describe clearly in "psuedocode." That is, the core functional steps that have to happen. I think there's so much room for potential improvement, that even getting something tweaked but partway to the goal would be a big improvement. Useful if they ever make a Vox Populi for civ6.
I do think the AI would often do well having a few different recipes for what combination of Districts to build, and then basically just building those in a triangle with the city centre eg CC-CH-H, CC-C-TD, CC-A-IZ.
See, theaters and IZs are really hard because they have such a dependency see on other things you have to build. But you cannot wait around forever to put them up. I do think having mini "plans" would be the abstract next step beyond anything that just says "place district in best currently available spot."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
But it is the right approach, something simple that can be built on and would garner an understanding of what actually is required even for a simple decision.
anyone volunteering a verbal algorithm for a starter?
Here's a rough first start:
At the top level we have a District Unit Queue. Per city, this is a list of "district units" that the city will try to build. A district unit is something to allow this algorithm to handle both standalone districts and multiple of them. Most districts will be a single unit, but some cases will be more than one; for example, how to implement things like Harbor and CH, or IZ and AQ. Unique districts can have their own definitions under this scheme.
The order of this queue is inherited from the Civ's Strategic Focus. In my head this means any specific Victory Condition would have a predefined order of priority to build stuff in. For example, Science Victory would have Campus at the top of the list. How long is it? I think we can start our list at 3 District Units. That usually going to be 7 pop, so I think it's okay.
Now each city has a District Unit Queue informed by the civ's strategic focus. When a city is settled, it can evaluate the terrain around it for the District Placement Plan. This step is perhaps the meat, but the legwork needs to be done in order to make this practical.
We start by going to our District Unit Queue and defining all the individual districts that need to be constructed (because a District Unit may require more than one district.) Once we have that, we can place them on the map.
Valid locations on the map are any tile that city could normally place in that does not already have a district planned for it. So this would require a piece of data that it essentially an array representing each tile on the map, with the data entry either being blank or specifying what district is planned on it and by which city.
The order of
planning is set by some preset ranking of the districts. Again, this could be informed by VC, or maybe there's just a general one. IDK. But the city goes through that list of all the districts it wants, and first it places the most prioritized district in the highest yield valid location for it, then the next, then the next, etc, until each district has a
planned location on the map. If there is no way to place part of a larger District Unit, then the District Unit is cancelled.* Extra note: the district evaluation counts previously Planned Districts as if they exist already. I recognize this is a slight modification of the Best Location rule but it would be handy. If we don't have it we would need to change a lot of stuff.
Now, the city needs to build these things. I don't know how the AI manages its production queue but when it goes to build a district, now it will instead try to place the District Unit on the top of the District Unit Queue, in their planned locations according to the District Placement Plan.
This is where the complication is. What to do if the tile isn't owned needs to be determined. For a basic first cut, I would suggest if the tile isn't owned, defer and go to the next item in the District Unit Queue.
To tie it all off with a bow, several cases need to be handled, like what happens when the queue is empty and the city can build another district. This is where I would add a "defacto" case where the city can just build non-queued districts in accordance to the "best place open right now rule" and whatever priority it already has. Longer term fix would be working out something extremely simply for buying tiles. (Like if it's the most important district type to you, buy the tile.)
*We could have a simple table that says If you cannot place part of this district unit, do this instead. IE if you cannot place an AQ, build the district unit that only contains the IZ. Single districts have no replacement, and so they get cancelled altogether.
As some simple example, imagine a science victory pursuing civ. They might have a District Unit Queue defined as:
- Science Unit
- Production Unit
- Culture Unit
The science and Culture units are both just single districts. The production in this case would be Aq+IZ. For these scenarios, it would be helpful to establish an unconditional order to them. The AQ is more restricted, so should be built first. So the ordered list for the "district placement plan" might look like this:
Plan the placements in order...
- Campus
- Aqueduct
- Industrial Zone
- Theater Square
Suppose the Aqueduct could not be placed. Then the Production Unit would be checked in some kind of table to see if the entire thing should be dropped, or replaced with something simpler. Perhaps in this case it comes back as "place IZ unit" which only contains the IZ. Then the District Placement Plan would only have 3 districts in it instead of 4. This entire routine is to prevent failures when the city is on an island or if the city has little usable terrain.
When it gets to checking land availability, it's possible another civ may have taken the tile, or the tile has popped a strategic resource, or something. In this case it will just be deferred forever and effectively removed from the DU queue.
The defacto case is something that is how cities could build beyond their DU queue, and is probably currently informed by what the civ needs. In fact, one could assign Defacto case decisions to be their own item in the city production decision tree, in order to fill in when the empire needs something in particular, like an EC or a spaceport.
Here's a quick graphic showing some of the basic logic:
The computational overheard is analyzing the city's terrain on founding, once per city; storing the District Placement Plan array, and maintaining the District Unit Queue for each city. The downside is it requires some kind of set of strategic plans to exist. It's entirely allowable for the plan to change over time, since the computation of the placement is when the city is founded. But the DU queue can't be changed if the VC goal changes. And AIs may not have a VC goal to pursue. So I suppose one could always have a Default strategic plan too to cover that.
Land Availability is something that could be greatly extended on, but oh well.