Managing Large Empires

rep1826

Chieftain
Joined
Nov 23, 2009
Messages
28
Hey guys.

So I finally survived to the modern era on Noble, and this was where my epic game settings would make things really interesting! I was playing on marathon speed, a huge terra world (the biggest) with 18 other civs...none of whom were dead.

But then it something unexpected happened.

It was boring as hell, and I stopped playing it.

There's a multitude of reasons why this happens, but a lot of it has to do with how hard it is to manage a large empire. The game's UI is actually missing a lot of important things, but usually empires are small so it doesn't matter. I think a lot of the changes could benefit games of any size though.

By the way, first let me say that I use BUG and thank you for making it! It's awesome. I probably couldn't play Civ IV at all without it now.

Anyway, I think there are 3 remaining problems with the Civ IV UI right now.

Opportunity costs

People make decisions at the margins, but a lot of this information is not directly available in the game. A perfect example would be switching from Hereditary Rule to Representation. HR gives me +1 happy for each military unit (a great bonus) whereas rep gives +6 happy in the largest cities. But what effect would switching have? To figure this out, I have to go to every city and do a lot of computations. What I really want to know is, if I switched right now, what would happen? Not in a global sense either, but to each city.

The UI focuses a lot on doing things. But this misses a big part of what Civ is about: making decisions. It would be nice if the UI focused on what will/might happen if you did something. You can figure this out yourself, but you need to get out Microsoft Excel or a calculator. But you're supposed to be the decision maker, not a bean counter! This gets exponentially worse as the number of cities grows because it gets really annoying, really fast.

The AI is probably doing a lot of these calculations for itself (I've looked briefly at the SDK source code), but it won't share them with a player. Or sometimes it does, but it won't tell you why. For example, sometimes it suggests I improve certain tiles. How come/what's the rationale? The advanced combat statistics, by the way, is an excellent step in this direction: it gives you great idea of what might happen if you did something. This is one of the only places it happens though.

Here's a neat idea for a feature: what if in the city screen, you could enter a mode you place any improvement on any tile instantly. This wouldn't actually do it of course, but it would preview what effect it would have if you did it. It would replace a whole lot of tedious math.

Empire-wide Management

This would be the hardest to implement, but for managing a large empire it would be the best thing ever. I would even finish my game if it existed.

The problem is that when an empire gets bigger, you can't take a larger view of production than individual cities. It would be cool if there was such a thing as empie-wide production. Here's an example of what I'm thinking: suppose I want to produce 4 pillaging stacks, each one has 1 tank, 1 SAM infantry, 1 anti-tank, 1 marine, or whatever. It would be cool if you explain what I want to do, where I want everything to move, and what cities should be involved in doing the production. The computer will then figure out the best way to build everything and move everything where it needs to go so that it finishes in the best number of turns, without you going to each city and setting way-points, setting up build queues, etc. It doesn't matter how incredibly complicated it is to use; it's worth learning it just once to not be bothered with the details every single turn. Oh, and every unit would fortify/sleep until the entire "project" is done. The point is not to bother the player until the plan is ready to go.

Performance

Out of curiosity, why does the game slow down so much as it goes on? Is it in the engine or the game logic DLL where all that time is being spent? If it's game logic, then technically the community could fix it by rewriting a lot of the algorithms to be more efficient, although it would be a huge undertaking.
 
Oh I forgot another idea that I had (although I'm sure other people have had this one): there's a lot lacking terms of grouping. It'd be nice to see the grouping system grow dramatically, with groups that can be named like units can, a quick list (where did I put that group?), a search function or something like that.

Especially as the game grows larger, you have all these resources but an increasingly less clear picture of where they all are, what they're supposed to be doing, and how they could be allocated into new groups to perform new functions.
 
for mid-late game performance, i would turn off PLE enhancements in BUG. I keep it off by default.

It's a nice feature, but until they fix all the icon overdraw that is happeneing.. it's just way too sluggish when you get alot of troops together.
 
Opportunity costs

People make decisions at the margins, but a lot of this information is not directly available in the game. A perfect example would be switching from Hereditary Rule to Representation. HR gives me +1 happy for each military unit (a great bonus) whereas rep gives +6 happy in the largest cities. But what effect would switching have? To figure this out, I have to go to every city and do a lot of computations. What I really want to know is, if I switched right now, what would happen? Not in a global sense either, but to each city.

While I understand your question is general and applies to examples outside the one you mentioned, I thought I would share my methods for determining Hereditary rule vs. Representation. A lot of your types of questions can be answered by customizing the domestic advisor. I usually put the garrisoned units count next to the current happiness along with population. You can easily see where there isn't enough happiness to keep a positive value if the troops stop counting towards it. While this information is probably scattered in the default, you can make a custom screen just for this question, and others like it.

Performance

Out of curiosity, why does the game slow down so much as it goes on? Is it in the engine or the game logic DLL where all that time is being spent? If it's game logic, then technically the community could fix it by rewriting a lot of the algorithms to be more efficient, although it would be a huge undertaking.

If you hit the windows key or ALT+TAB out of the game, wait a sec and then go back in, you'll find performance will improve. This game, like many others, has the occasion memory leak.
 
There's a multitude of reasons why this happens, but a lot of it has to do with how hard it is to manage a large empire. The game's UI is actually missing a lot of important things, but usually empires are small so it doesn't matter. I think a lot of the changes could benefit games of any size though.

I find this hard too. Sometimes, when you get 20+ cities, I start letting the smaller ones run themselves. It helps a great deal, and I can always intervene if the situation changes.

Opportunity costs

People make decisions at the margins, but a lot of this information is not directly available in the game. A perfect example would be switching from Hereditary Rule to Representation. HR gives me +1 happy for each military unit (a great bonus) whereas rep gives +6 happy in the largest cities. But what effect would switching have? To figure this out, I have to go to every city and do a lot of computations. What I really want to know is, if I switched right now, what would happen? Not in a global sense either, but to each city.

I would really love to see the civic actual effects as well. But EmperorFool told me that there are two major choke points here. First off, there aren't any calculations done for the differences between each civic, so they would all need to be added, a large undertaking. Also, how on earth does one display those changes? Where on the civic screen?

Out of curiosity, why does the game slow down so much as it goes on? Is it in the engine or the game logic DLL where all that time is being spent? If it's game logic, then technically the community could fix it by rewriting a lot of the algorithms to be more efficient, although it would be a huge undertaking.

Certain mods slow down the game down, usually because of inefficient code, but BTS vanilla runs very fast, IMHO. I never get more than 5 sec turn times, with the largest maps. I've already asked if the code could be re-written or multi-threaded, but alas, I do not think it will ever happen. It's a 2004 game engine, and it's starting to show it's age.
 
As has been said, there's a lot you can do by customizing the domestic advisor. Use the military advisor and hotkeyed unit groups (ctrl+# as in any RTS) to manage stacks. You can also use ctrl+# to save a build queue while in the city screen, then select multiple cities in the domestic advisor and hit that number to assign the queue.
 
... then select multiple cities in the domestic advisor ...
how do you select multiple cities in the domestic advisor. (I can do it from the main interface).
 
how do you select multiple cities in the domestic advisor. (I can do it from the main interface).

It works just like normal Windows lists do:

  • CTRL + CLICK to toggle that row into/out of the selction
  • SHIFT + CLICK to select all rows from the previous row you clicked to the new row
 
Performance

Out of curiosity, why does the game slow down so much as it goes on? Is it in the engine or the game logic DLL where all that time is being spent? If it's game logic, then technically the community could fix it by rewriting a lot of the algorithms to be more efficient, although it would be a huge undertaking.

the CoreDll source code seems to be optimized for beeing very flexible, python compatible and modding friendly but not for preformance. just having a fast look on most it seems one could gain a lot by inlining many functions. but then i suppose what takes most time is the decison making and pathfinding algorithms for so many different units. i didn't have a deep look so far but i guess if both algorithms are located in the core dll and not the exe there is much potential to fasten up the code... though it would make further moding more difficult and bug sensitve.
 
the code source code seems to be optimized for beeing very flexible, python compatible and modding friendly but not for preformance. just having a fast look on most it seems one could gain a lot by inlining many functions. but then i suppose what takes most time is the decison making and pathfinding algorithms for so many different units. i didn't have a deep look so far but i guess if both algorithms are located in the core dll and not the exe there is much potential to fasten up the code... though it would make further moding more difficult and bug sensitve.

Inlining the code seems impractical with a 200k+ codebase. I find that removing python callbacks, and avoiding really really long loops help.
 
Inlining the code seems impractical with a 200k+ codebase. I find that removing python callbacks, and avoiding really really long loops help.

you're right. inlining is a measure you can do when everything else is already optimized to get peak preformance (though the many get & change calls could be inlined). there are other areas where a lot of preformance can be squeezed out.
 
Keep in mind that the compiler will inline some of the functions itself. The gains you will see in such micro-optimizing are probably 0.001% of the runtime. This is hardly worth spending human-time on.

This is why you need to profile the code to find the hotspots where time is spent in complicated algorithms. The CAR mod released by the History of Three Kingdoms team cached some values that are accessed a lot in the game. I have been holding off on merging that into BULL until I see a lot more play testing. Caching can be tricky, and the codebase is large. If values aren't cleared appropriately, you'll have AIs making decisions based on stale data, and players will start to see different results with and without the mod. That would not be good for SGs where only some players use BULL.
 
on the interface side of things, I have found that high usage of panels slows you down. This is probably why they built the tech screen on game start up and then just show / hide it. All other screens appear to be build from ground up as required.
 
Back
Top Bottom