Advanced Civ

Thanks for attempting a fix so quick Keldath!

Sadly it looks like there might still be some issues, particularly with the interface. This is what's happening to us now:
  • As soon as we start the game, all non-host players get out of synch. In some cases the game crashes but not always.
  • Vision works correctly now though, as each team can see their own team's untis and cities.
  • We can leave the game and re-join to get around the out of synch issue.
  • At this point, however, we can't interact with our own cities through the city interface. We can't see what it's building or how far left before population grows. We can move units though.
  • We can sort of work around this by choosing city production through the City Summary screen (F1), although obviously this is not ideal, and we can't choose what tiles to work at all.
We have some more screenshots from different POVs to share as well as the log files from my end, which can be found in the .rar file, in case you are still up for trying to solve this issue.

I know it's not your mod Keldath so it's really impressive what you've already accomplished, it would be understandable if you aren't willing to work further on it, but thanks a lot anyway :) .
 

Attachments

  • AdvCiv team game error logs 2023.11.05.rar
    63.5 KB · Views: 5
  • AdvCiv team game error screenshots 2023.11.05.rar
    9 MB · Views: 6
Hey,
I figured it wont be enough :).
completed the whole revere fix -> there were multiple places where the team code was altered.
I tested LAN game over my end over many auto play games ( i also fixed none mp something in my mod as a result of these tests .

Link for the full fix : https://mega.nz/file/e3ZmGDhA#isJNswfs6AVq8_oVpq7cFNrCLVEmU5QYzUKumWfQ_Ho

Also,
Note that all players MUST delete the cache folder ->C:\Users\User\AppData\Local\My Games\Beyond the Sword
I know for a fact it causes OOS.
DO that for all players before each time you start a new MP game.
Trust me on that.
 
Last edited:
Sorry to just disappear entirely for a couple of months. Sometimes paying almost zero attention to a matter just isn't little enough. Glad that @keldath – and then perhaps also everyone else – drew the right conclusion:
f1rpo is probably is a bit off of moddingfor now (i hope he will come back soon).
Also great that only one major bug has cropped up and that keldath was even so good to create a hotfix – rather than let @tomael's detailed bug report go to waste. I've fixed that issue more properly in v1.10; at least it works for me when connecting to localhost. And the rather few small changes from last year. Hardly anything done this winter. Haven't been able to reproduce this one either:
in case in the future you come back and see this,
there is a crash after saving a game end then exit to main menu:

CvPlot::~CvPlot()
..
..
.
if (m_pRiverSymbol != NULL)
gDLL->getRiverIFace()->destroy(m_pRiverSymbol);
I've started a couple of games, but, even after a break of several months, I can still play in my sleep and it's not really fun anymore. Maybe some enjoyment will eventually return, but it's also fine if not. Just not a great place to be in when modding the game. So I intend to do only a bit of maintenance now and then. (Not that anyone really asked me to do more - or even that much.)
 
@SantaFlagship:
Some miscellaneous: [...] You're right, as long as I'm doing my math right! Exact calculation yields a 2-nuke survival odds of 81 / 490 ~= 16.531%. [...]
Thanks for the help with those numbers. I'l add them to the bowels of the manual. Sorry also to have flaked out of this friendly conversation.
Speaking of nukes, what are your thoughts on the Manhattan Project unlocking nukes for all players? I've always found it a little jarring that such an expensive project essentially is given for free to every other player (without compensating the one finishing the project at all). I suppose keeping such a thing secret is impossible: In real life the USSR was aware of the project, if I remember correctly. Still, it took them till 1949 to complete their own first successful trial.

Changing it, i.e to a National Project, is obviously a big gameplay change (I'd guess far outside the scope and spirit of the mod); it's by no means something I'm advocating for. I've just been thinking, from time to time, about whether it could be changed for the better in some way, and if so, how. I'm curious what you (and anyone else here) think of the Manhattan Project in this game.
I suppose the designers liked the mechanism – unlocking a powerful resource for everyone at once, but it does seem quite uncalled for from a scientific angle. Maybe if the Manhattan Project were a Team Project and the AI would generally avoid undertaking it until a threatening rival does so first, the resulting strategic considerations could be similar. Or there could be a path to outlawing nukes through a diplo vote before any nuclear program has been launched.
I noticed a tiny tooltip issue. If the garrison in an occupied city is weak enough that the revolt chance is > 0% after occupation period ends, the name of the key:
TXT_KEY_REVOLT_CHANCE_AFTER_OCCUPATION
is displayed in the tooltip instead of the value this key refers to (see screenshot).
This is also fixed in v1.10; thanks.

@Jorunkun:
After I moved my capital in the mid-game, my city count for maintenance went up to 205 cities (I suspect all the cities in the world), when in fact I only had 27. Attaching a save, in case anyone want to take a look.
Thanks, looks to me like number-of-cities maintenance is only based on the 27, but colony maintenance is through the roof because none of your cities are on the same continent as your capital anymore. Stupid mechanism.
I'm also giving vassalage a try ...
If you're not used to playing with colony maintenance, then that would explain it. Disabling vassals also disables colony maintenance.
Not the whole thing out of the box. Parts of it are probably easy to adopt.

@schargiel:
Hello. Is there a merge of advanced ai and next war mode?
I would love it.
No. I see you've already found the 2015 thread about a K-Mod merge; so, yeah, not a trivial task. There is a merge of Final Frontier and K-Mod, but I don't suppose FF and NW really scratch the same itch.
 
@f1rpo Glad to have you back here. You've changed the trading system, but I'm wondering why the AI refuses a win-win for it? I would understand if it had one unit of a given resource, but when it has two. I realize he may have a health point reserve, and the AI may not be interested in the deal, but it still seems a bit illogical. In general, I've noticed that resource-for-resource exchange situations have significantly decreased, mostly either asking for another resource in addition, or gold. And I wonder how the calculation of how much gold the AI will demand for a resource is done.

 
If there's a savegame that I can load, I could check the debugger for a breakdown of the evaluation of this particular deal. The logic (CvPlayerAI::AI_bonusTradeVal) is a bit involved, even when the evaluation of the economic benefit of each side is accepted as a given. My general stance is that, if a deal benefits one side significantly more than the other, then the other should ask for something in addition, especially once gold trading is unlocked. It might be that the AI is too concerned about small differences in value. It is true that a 1-for-1 trade has some objective sense of fairness to it while the AI evaluation is imposed by one side. The particular case is also a bit dubious because Cow is usually a weaker resource than Corn because of Granaries. Though, unless it turns out that something is clearly not working as intended, I've got to say I'm reluctant to make any significant change here because it might turn into laborious fine-tuning. I remember the conditions for deal cancellation – as the utility values change over time – as somewhat fragile, and making the AI accept square deals more readily could cause problems there. edit: missing word
 
Last edited:
I can't tell from your vid on what his attitude towards you is. AI attitude will also affect trades depending on relationship with you.
 
greeting and salutations dear @f1rpo :)
i missed hearing from you .

hope you and yours are all good.

great to see you updated the latest stuff.
happy i could lay a hand and assist as always.

im also took time off and not actively modding or playing civ....
but now...gotta update :)

cheers my good friend.
 
@keldath: Yes, all good, sounds like you're also holding up well, glad to hear it. :)

@Drakarska: Attitude generally does not affect the balance of AI deals, as far as I recall; only whether the AI is willing to trade an item at all (refusal threshold) and how much gold in total is made available for trade. I had been considering to change that, but I think it still mostly works like that in the mod.
 
Do you have Ruthless AI on? I waited 250 turns on autoplay after getting to Renaissanse and not a single civ crossed a 3-4 tile gulf between 2 Pangeas, my own AI couldn't even supply garrison grom mainland to a city conquered by copters.

@keldath: Yes, all good, sounds like you're also holding up well, glad to hear it. :)

@Drakarska: Attitude generally does not affect the balance of AI deals, as far as I recall; only whether the AI is willing to trade an item at all (refusal threshold) and how much gold in total is made available for trade. I had been considering to change that, but I think it still mostly works like that in the mod.
Huh. Odd then. I've had the same AI ( Inca) at "annoyed" with me, trying to extort uneven trade deals. Then later at "pleased", will do 1 to 1 resource trades.
No biggy. Lol, I just go with the flow.
 
I tried to use AdvCiv to create a proof of concept of switching to the MSVC 2022 toolset a few months ago. The compilation errors caused by the EnumMap templates are what lead me to use Realism Invictus instead.

I haven't looked deeply into fixing the c++ standard compatability issues and they can probably be fixed. The current version of these templates in WTP can be compiled with never compilers maybe it would be worth updating them.

But i'am wondering about what advantages do these templates provide over c-arrays besides automatic memory management?
 
As I wrote in your thread in the SDK subforum, it's amazing that a switch to a newer compiler is becoming feasible after all this time.

Doesn't surprise me that those templates don't readily compile. They seemed to stretch the boundaries of MSVC03 meta-programming; had to use some trial and error to work around apparent compiler bugs (crashes).

The enum map data structures in WtP and AdvCiv are tied to the systems for global enum types and to code for XML loading, serialization and loop constructs throughout the code. All this has diverged in both mods, and I estimate that adopting the current WtP framework would take me at least several weeks' spare time. WtP has come to rely on a Perl script for generating part of the C++ code. I did not like adding Perl to the dependencies/ tool chain for compiling the DLL and did not want to force XML modders to recompile the DLL. I also feel that the old compiler/ preprocessor alone can do the job (albeit barely) and that making all enum values available to the compiler (as WtP does through hardcoded enumerators) is not likely to acomplish great gains in performance. In BtS, that is; for Colonization, specifically WtP with it's large number of yield types, I tend to trust @Nightinggale's assessent that his approach has significant performance benefits. Bearing in mind also WtP plans for further rewrites of Vanilla code and for novel features.
But i'am wondering about what advantages do these templates provide over c-arrays besides automatic memory management?
I have some free-form design documentation in the appendix of the AdvCiv manual. I knew better what I was saying at the time of writing that (two years ago) than I do now, so I'll just copy the basic rationale: "Memory optimization (for improved CPU cache performance); improved code readability, extensibility. Well, the enum map and traits code is highly reliant on templates and as such far from being easy to read; but the code that employs enum maps replaces a great volume of error-prone boilerplate dealing with naked arrays." I can of course expand on that, but I'm not sure what specific rationale you're missing – if any; perhaps "automatic memory management" already puts it neatly in a nutshell. Though the memory gets very tightly optimized to suit the characteristics of the data. (How essential that really is, is a different question.) If you want to skim through the existing documentation, it starts at the bottom of page 97 and continues to the end of page 101. Regarding the use of template parameters specifically, I think ease of use – less error-prone, more readable code – is the more important upside to me than compactness, e.g. storing the values of an enum-to-enum map in the smallest possible integer type internally.

For me at least, as the person most familiar with the AdvCiv enum-related code, modernizing the templates as much as necessary would seem like the less laborious and more desirable approach than adopting the current WtP code. That said, I'm not sure how easily I could set up the development environment, and I do have some reticence to put effort into porting AdvCiv to a modern version of C++ because a lot of things could clearly be done so much better in that environment. (Proper ranged-based loops that really make those clumsy int-enum casts and get...Info calls disappear are the first thing that comes to mind.) Feels like turning something that did its best under the circumstances into overtly cumbersome, inefficient legacy code. This is not a particularly rational stance, of course.
 
Huh. Odd then. I've had the same AI ( Inca) at "annoyed" with me, trying to extort uneven trade deals. Then later at "pleased", will do 1 to 1 resource trades.
No biggy. Lol, I just go with the flow.
Unsearchable are the judgments of AI Capac, and His ways past finding out. :please:

Upon re-reading the trade evaluation code, I've come to think, perhaps I'll at least enable a bit of code more broadly that makes the AI more tolerant of trade value differences in the early game when gold trading isn't yet available. If that leniency works OK until Currency, it can't do too much harm beyond that. I think this will only make a difference of 1, maybe 2 gold per turn, but, who knows, perhaps that'll go some way.
 
But i'am wondering about what advantages do these templates provide over c-arrays besides automatic memory management?
Type correctness and knowledge of xml lengths. If there is an EnumMap of length say UnitTypes, then indexing is UnitTypes and the length is GC.getNumUnitTypes(). Trying to give it a UnitClassTypes to get a specific index will cause a compile time error. It also has benefits for savegame code. I can't recall if it is in the avdciv version, but the current WTP version is able to reduce the savegame data compared to the vanilla approach on how to save arrays.

Also the index given is tested with asserts, so it will cause an assert failure if somebody tries to get whatever is stored at index NO_UNIT. A C style array will just crash unless each call adds an assert before calling (that won't happen).

Doesn't surprise me that those templates don't readily compile. They seemed to stretch the boundaries of MSVC03 meta-programming; had to use some trial and error to work around apparent compiler bugs (crashes).
The current version in WTP is technically not possible within C++03 and it relies on MSVC extensions. Automated code quality testing really doesn't like the implementation and I'm actually wondering if I should replace all of it with a script, which generates each case explicitly rather than relying on the template handling of the compiler.

I tend to trust @Nightinggale's assessent that his approach has significant performance benefits.
Keep in mind that WTP releases tend to NOT make use of known enums when building releases. For the time being it is an aid to debugger output and it might be used for releases in the future if we ever measure a significant performance difference.
 
That said, I'm not sure how easily I could set up the development environment, and I do have some reticence to put effort into porting AdvCiv to a modern version of C++ because a lot of things could clearly be done so much better in that environment. (Proper ranged-based loops that really make those clumsy int-enum casts and get...Info calls disappear are the first thing that comes to mind.) Feels like turning something that did its best under the circumstances into overtly cumbersome, inefficient legacy code. This is not a particularly rational stance, of course.
AdvCiv had alot of work done to optimize things and it works just fine as it is no need to redo things just for the sake of redoing them. That is also why i stopped switching Caveman2Cosmos to the newer C++ toolset, it's just to much work to redo things that work fine but are incompatible with newer C++ standards.
 
I can't recall if it is in the avdciv version, but the current WTP version is able to reduce the savegame data compared to the vanilla approach on how to save arrays.
Reduce the size, yes, AdvCiv saves the enum maps pretty much as they look internally (i.e. collapsed or as lists of key-value pairs), but your, say, annotated format with improved compatibility and ease of use is something else still. The WtP improvements to the software design and coding standards are just a good deal more extensive than in AdvCiv – and still being improved on; so being able to stay up to date with that would be a significant upside of adopting as much of the WtP fundamentals as possible, in theory.
The current version in WTP is technically not possible within C++03 and it relies on MSVC extensions. Automated code quality testing really doesn't like the implementation and I'm actually wondering if I should replace all of it with a script, which generates each case explicitly rather than relying on the template handling of the compiler.
Interesting. Once a code generating script is involved, giving certain nonstandard (or just awkward) templates and preprocessor functions the boot does sound worth considering.
Keep in mind that WTP releases tend to NOT make use of known enums when building releases. For the time being it is an aid to debugger output and it might be used for releases in the future if we ever measure a significant performance difference.
Oh, right, I see (and maybe half-remember).
AdvCiv had alot of work done to optimize things and it works just fine as it is no need to redo things just for the sake of redoing them. That is also why i stopped switching Caveman2Cosmos to the newer C++ toolset, it's just to much work to redo things that work fine but are incompatible with newer C++ standards.
If it were fairly easy to do in AdvCiv, then it would be nice to clear those obstacles just in case that someone will yet want to do serious modding with a modern compiler and use AdvCiv as their starting point. Ah, well.
 
If it were fairly easy to do in AdvCiv, then it would be nice to clear those obstacles
Regarding the AdvCiv specific issues.

If the EnumMap templates themselves don't have alot of dependencies to other parts of the code. Creating a self contained project to develop a C++ standard compatible version should be possible.

The other obstacle is the xml parser. The parsing functions of the exe use msxml3 which can lead to memory related problems at runtime.

Besides that the other issues preventing compilation should be easy to fix. Additionally there might be some hidden bugs in the code that lead to crashes at runtime or other undefined behavior but that should be fixable as well.
 
Last edited:
Top Bottom