- Artillery and their escorting units disregard the damage and would keep on pushing to their target even if they health is reduced to 1 HP. Is it possible to make them retreat to safety using the same algorithm as for normal units?
- Fighter may now perform more than one interception per turn which may result in it's premature destruction. On one hand it is more realistic (an interceptor was defeated by the large group of enemies), on the other hand it does not help limited Air Force to defend itself;
- Probably. I can't say for sure since I'm not familiar with how retreating works for escorters vs other units. One of the problems with the unit AI is that it can't cover retreating units well. I'd be wary about making it retreat more since the retreating units might get picked off easily. It might be a better idea to keep everything in one large stack.
- Unfortunately it's difficult to change this due to how the air combat logic is structured. It's not like ground combat where there's a process for selecting the preferred defender (which can be edited), instead the game picks the first available fighter to intercept.
I don't think 12-13% is disappointing. Remember, it is 13% out of everything the AI needs to calculate for the entire turn. For example, if the AI spends 30% of the turn computing the city related stuff, then that would mean the time taken for those particular operations is near halved. Which is quite significant. If I were to take a guess, I suspect the majority of the time spent would go into moving units, their planning, pathfinding, combat etc., since there could easily be 10 times more of them than the number of cities, and their interactions are complex.
That's true, and the improvement loop optimization is pretty simple & was quick to implement so it's 12-13% for almost free. Still I think I can do significantly better. I collected some data using a performance profiler and found, for example running that Monstrosity save, that more than half of the interturn time was spent in the pathfinder, and that the large majority of the pathfinder's time was spent computing trade networks not unit movement. Even though there are many more units than cities, I believe this is more than balanced out by two things: (1) Units mostly generate only short paths in a small area of the map whereas cities might generate sea trade connections across the entire map. (2) Each city can have its trade network recomputed multiple times per turn depending on what players do.
Meanwhile, I got distracted from working on speeding up the trade net calculations to instead look into a problem the game has when running on Linux using Wine. (This isn't really relevant for most of you but I'm going to talk about it anyway.) The problem is that any game screen that draws a line, including the map and foreign advisor, gets blacked out. It's caused by the fact that the game uses OpenGL to draw lines but Windows GDI to draw everything else. When it initializes OpenGL it assumes the system will copy over everything it has already drawn through Win GDI so it can simply draw lines on top of that. That's what happens on Windows, but on Wine the system discards the previous canvas and creates a new completely black one.
To solve the problem I reimplemented the OpenGL line drawing code (there isn't much of it) using Windows GDI+ instead. The old non-plus GDI won't do since it can't draw partially transparent lines, and that must be why the original developers used OpenGL in the first place. The reason they didn't use GDI+ in the first place is that it was only introduced in Windows XP. Civ 3 was released around the same time as XP but supports Windows as old as 98.
The GDI+ lines aren't exactly the same as OpenGL. Here's a comparison:
Notice the lines drawn by OpenGL are fuzzier. This is especially apparent in the "Treaties" box. I'm not sure why that is, actually. Here's another comparison:
Here I think the fuzziness makes it look a bit better (look at the borders around the city boxes), unlike on the foreign advisor screen.
Anyway, this was a fun little diversion and it solves the black screen issue with Civ 3 on Wine. You'll be able to use the GDI+ version on Windows too if you want to. BTW, I tested the C3X mod itself on Linux and found that it works. Both the install & run batch files work flawlessly when run through Wine. Pretty cool.