Inflation help! [for RoM-AND2]

Joined
Jun 7, 2008
Messages
6,149
Location
Just wonder...
Hi everyone,

as maybe someone of you already knows, there's been an attempt to restart "Rise of Mankind - A New Dawn 2" development. Right now, I'm trying to fix some bugs in AND2 (Afforess has given me SVN control for AND). At the moment, I'm trying to fix some inflation bugs and I'm here to ask advice from C2C gurus :)
It looks like in AND2 inflationoffset in gamespeedinfo.xml doesn't work. No matter what value I choose, inflation always starts at the same turn. I was wondering if inflation works correctly in C2C and if it's possible to get inflation code from C2C and import it in AND2.
As far as I've seen, inflation code is placed inside CvPlayer.cpp. Are there other places where inflation code is present? Would it suffice to insert the inflation code found in
http://caveman2cosmos.svn.sourcefor...ources/CvPlayer.cpp?revision=4152&view=markup
inside cvplayer.cpp of AND2 http://anewdawn.svn.sourceforge.net...Sources/CvPlayer.cpp?revision=586&view=markup ?

(I've simply looked inside C2C cvplayer.cpp to find where the word "inflation" occurs to understand which parts are connected to inflation: basically the code looks the same except in a small section).

From what I've seen, it should be an easy job to do, but I hope I'm not missing anything important. Any advice?
Thank you in advance :)
 
Koshling has changed the way inflation works somewhat in C2C. Instead of accumulating over the entire game it slowly moves towards an equilibrium depending on the current civics etc.

The code should be transferable to AND.

I wonder though if you are not better off to use the C2C DLL as a whole for RoM-AND2 (maybe also some of the Python). That way you get a lot of fixes and optimizations without having to manually apply them and while there are certainly some parts of the code behavior that should be switched off in AND it should be manageable.
 
Koshling has changed the way inflation works somewhat in C2C. Instead of accumulating over the entire game it slowly moves towards an equilibrium depending on the current civics etc.

The code should be transferable to AND.

I wonder though if you are not better off to use the C2C DLL as a whole for RoM-AND2 (maybe also some of the Python). That way you get a lot of fixes and optimizations without having to manually apply them and while there are certainly some parts of the code behavior that should be switched off in AND it should be manageable.

I was also thinking about it, but while merging inflation I know what I'm doing (more or less ;)), merging the whole dll could lead to unpredictable problems because I'm not sure of what parts of the code should be switched off. A couple of months ago jtanner28 merged some improvements from c2c dll, but I'm not sure what he did and since he's disappeared from the forum and I'm not a dll guru, I prefer to slowly add what I need. Anyway if/when I will feel comfortable enough for the big step of undertaking a larger merging, I will certainly do it. Thank you AIAndy :)
 
45°38'N-13°47'E;11950586 said:
I was also thinking about it, but while merging inflation I know what I'm doing (more or less ;)), merging the whole dll could lead to unpredictable problems because I'm not sure of what parts of the code should be switched off. A couple of months ago jtanner28 merged some improvements from c2c dll, but I'm not sure what he did and since he's disappeared from the forum and I'm not a dll guru, I prefer to slowly add what I need. Anyway if/when I will feel comfortable enough for the big step of undertaking a larger merging, I will certainly do it. Thank you AIAndy :)

You can access all our changes from our SVN, as I presume you know. The inflation ones were about 2 months ago as I recall - it should be in a version checkin comment. Let me know if you need specific help.
 
You can access all our changes from our SVN, as I presume you know. The inflation ones were about 2 months ago as I recall - it should be in a version checkin comment. Let me know if you need specific help.

Thank you Koshling; yes, I've seen the code and I'm merging it in AND2. It should cause no problem, I'll try it and I'll get back here if I need more help. Thank you very much! :)
 
@45*38'N,
Glad you came in and asked. :thumbsup:

JosEPh :)
 
@45*38'N,
Glad you came in and asked. :thumbsup:

JosEPh :)

I was trying to solve the problem by myself because I had a couple of ideas, but they didn't work. So coming here was the best solution; I visit C2C forum from time to time and I know how people are supportive here :)
 
So here I am again to ask for advice. I'm having problem in compiling cvgamecoredll.dll; I've followed asaf guide here http://forums.civfanatics.com/showthread.php?t=405444
but I still can't compile the dll.
I've tried compiling the original dll using original source files from BTS and it works; but when I try to compile AND dll or even C2C dll from the source files, I always get the same error:

Spoiler :
1>------ Inizio compilazione: Progetto: C2C, Configurazione: Release Win32 ------
1>
1> Microsoft (R) Program Maintenance Utility versione 10.00.30319.01
1> Copyright (C) Microsoft Corporation. Tutti i diritti riservati.
1>
1> "C:\Giochi\Civ4Dev\Microsoft Visual C++ Toolkit 2003\bin\cl.exe" /nologo /MD /O2 /Oy /Oi /G7 /DNDEBUG /DFINAL_RELEASE /Fp"Release\CvGameCoreDLL.pch" /GR /Gy /W3 /EHsc /Gd /Gm- /DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /Yu"CvGameCoreDLL.h" /IBoost-1.32.0/include /IPython24/include /I"C:\Giochi\Civ4Dev\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Giochi\Civ4Dev\WindowsSDK/Include" /I"C:\Giochi\Civ4Dev\WindowsSDK/Include/mfc" /I"C:\Giochi\Civ4\Beyond the Sword\CvGameCoreDLL\Boost-1.32.0/include" /I"C:\Giochi\Civ4\Beyond the Sword\CvGameCoreDLL\Python24/include" /FoRelease\CvCity.obj /c CvCity.cpp
1> CvCity.cpp
1>CvCity.cpp(25017): error C3861: 'calculateTradeProfitTimes100': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(25051): error C3861: 'calculateTradeProfitTimes100': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(25061): error C3861: 'calculateTradeProfitTimes100': identifier not found, even with argument-dependent lookup
1>NMAKE : fatal error U1077: '"C:\Giochi\Civ4Dev\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : codice restituito '0x2'
1> Stop.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: uscita dal comando "nmake Release" con codice 2.
========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========


(Sorry, there's some italian word because I'm using italian version of VS but I think it's understandable). By the way, I've tried both with VS2008 and VS2010, both italian and english version, and I always get the same error, both for AND and C2C. But again, I can compile the original dll with every version of VS. I thought it was something related to the latest svn build so I used the last svn build of AND that was used to compile the dll we're using now, but I still had no luck in compiling the dll. Anybody can give me an advice please?
 
45°38'N-13°47'E;11954169 said:
So here I am again to ask for advice. I'm having problem in compiling cvgamecoredll.dll; I've followed asaf guide here http://forums.civfanatics.com/showthread.php?t=405444
but I still can't compile the dll.
I've tried compiling the original dll using original source files from BTS and it works; but when I try to compile AND dll or even C2C dll from the source files, I always get the same error:

Spoiler :
1>------ Inizio compilazione: Progetto: C2C, Configurazione: Release Win32 ------
1>
1> Microsoft (R) Program Maintenance Utility versione 10.00.30319.01
1> Copyright (C) Microsoft Corporation. Tutti i diritti riservati.
1>
1> "C:\Giochi\Civ4Dev\Microsoft Visual C++ Toolkit 2003\bin\cl.exe" /nologo /MD /O2 /Oy /Oi /G7 /DNDEBUG /DFINAL_RELEASE /Fp"Release\CvGameCoreDLL.pch" /GR /Gy /W3 /EHsc /Gd /Gm- /DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /Yu"CvGameCoreDLL.h" /IBoost-1.32.0/include /IPython24/include /I"C:\Giochi\Civ4Dev\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Giochi\Civ4Dev\WindowsSDK/Include" /I"C:\Giochi\Civ4Dev\WindowsSDK/Include/mfc" /I"C:\Giochi\Civ4\Beyond the Sword\CvGameCoreDLL\Boost-1.32.0/include" /I"C:\Giochi\Civ4\Beyond the Sword\CvGameCoreDLL\Python24/include" /FoRelease\CvCity.obj /c CvCity.cpp
1> CvCity.cpp
1>CvCity.cpp(25017): error C3861: 'calculateTradeProfitTimes100': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(25051): error C3861: 'calculateTradeProfitTimes100': identifier not found, even with argument-dependent lookup
1>CvCity.cpp(25061): error C3861: 'calculateTradeProfitTimes100': identifier not found, even with argument-dependent lookup
1>NMAKE : fatal error U1077: '"C:\Giochi\Civ4Dev\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : codice restituito '0x2'
1> Stop.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: uscita dal comando "nmake Release" con codice 2.
========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========


(Sorry, there's some italian word because I'm using italian version of VS but I think it's understandable). By the way, I've tried both with VS2008 and VS2010, both italian and english version, and I always get the same error, both for AND and C2C. But again, I can compile the original dll with every version of VS. I thought it was something related to the latest svn build so I used the last svn build of AND that was used to compile the dll we're using now, but I still had no luck in compiling the dll. Anybody can give me an advice please?

If you look at the definition in CvCity.cpp you'll see that it is only conditionally compiled if MOF_FRACTRADE is defined:

Code:
// BUG - Fractional Trade Routes - start
#ifdef _MOD_FRACTRADE

I assume you're build is without the fractional trade routes mod enabled? If so (since that's a part of BUG, and AND derives from BUG) you're probably building it wrong. The defines should be set up in the makefile, but I assume you're using the AND makefile (not the one from original BTS). The C2C makefile has:

Code:
Debug_GLOBAL_CFLAGS= /D_MOD_SENTRY [B]/D_MOD_FRACTRADE [/B]/D_MOD_GOVWORKERS /DQC_MASTERY_VICTORY /DLOG_AI /D_MOD_GWARM /D_MOD_SHAM_SPOILER /DFP_PROFILE_ENABLE /DC2C_BUILD /DMULTI_FEATURE_MOD /DUSE_INTERNAL_PROFILER
Final_Release_GLOBAL_CFLAGS= /D_MOD_SENTRY [B]/D_MOD_FRACTRADE [/B]/D_MOD_GOVWORKERS /DQC_MASTERY_VICTORY /DLOG_AI /D_MOD_GWARM /D_MOD_SHAM_SPOILER /DC2C_BUILD /DMULTI_FEATURE_MOD
Release_GLOBAL_CFLAGS= /D_MOD_SENTRY [B]/D_MOD_FRACTRADE [/B]/D_MOD_GOVWORKERS /DQC_MASTERY_VICTORY /DLOG_AI /DFP_PROFILE_ENABLE /D_MOD_GWARM /D_MOD_SHAM_SPOILER /DC2C_BUILD /DMULTI_FEATURE_MOD /DUSE_INTERNAL_PROFILER
 
You were right Koshling, I was building it wrong. I changed a bit the makefile merging it with mine to reflect my personal folder set, but I accidentaly changed defines also. So now it works, at least I can complile the dll.
Now I only have to test if everything works in the game. Thank you very much for your help. :)
 
Ok, I'm doing some quick AIautoplay test and it looks like it works. But is it normal that in the first turns inflation is negative? I've seen -1%, -2%, -3% and then it raised above 1% and more. I've checked the 2 months old thread about inflation and I've seen no info about it. So is it right to have negative inflation or is there something wrong with my merging attempt?
 
45°38'N-13°47'E;11954571 said:
Ok, I'm doing some quick AIautoplay test and it looks like it works. But is it normal that in the first turns inflation is negative? I've seen -1%, -2%, -3% and then it raised above 1% and more. I've checked the 2 months old thread about inflation and I've seen no info about it. So is it right to have negative inflation or is there something wrong with my merging attempt?

Not sure TBH. The inflation rate should always move from what it was the turn before towards the equilibrium rate implied by the sum of rates from:
  • Game speed
  • Difficulty
  • Era modifiers

With the 'advanced economy' option on the following also play into the equilibrium rate:

  • Buildings
  • Hurry history
  • Civics
  • Projects
  • Modifiers from techs
If none of these are negative then winding up with a negative quantity is a bug.

The thing to do is load a save game where it displays as negative into the DEBUG version and put a breakpoint on CvPlayer::getCurrentInflationPerTurnTimes10000() and see what element in it is giving a negative value.
 
Not sure TBH. The inflation rate should always move from what it was the turn before towards the equilibrium rate implied by the sum of rates from:
  • Game speed
  • Difficulty
  • Era modifiers

With the 'advanced economy' option on the following also play into the equilibrium rate:

  • Buildings
  • Hurry history
  • Civics
  • Projects
  • Modifiers from techs
If none of these are negative then winding up with a negative quantity is a bug.

The thing to do is load a save game where it displays as negative into the DEBUG version and put a breakpoint on CvPlayer::getCurrentInflationPerTurnTimes10000() and see what element in it is giving a negative value.

Ok, I will try it. I've started a new game (without adv economy) and inflation goes from 0 to -5% then returns to 0 in about 140 turns, then starts rising above 0%. It happens with different values of inflationoffset and inflationpercent (in gamespeedinfo.xml); I'll have a deeper look at this problem. I'll try it in C2C as well, in order to understand if it's a code problem or a merging problem. :)
 
45°38'N-13°47'E;11954978 said:
Ok, I will try it. I've started a new game (without adv economy) and inflation goes from 0 to -5% then returns to 0 in about 140 turns, then starts rising above 0%. It happens with different values of inflationoffset and inflationpercent (in gamespeedinfo.xml); I'll have a deeper look at this problem. I'll try it in C2C as well, in order to understand if it's a code problem or a merging problem. :)

Ok thanks - let me know if it's an algorithm problem since we'll need the fix also.
 
Ok thanks - let me know if it's an algorithm problem since we'll need the fix also.

Well, it's surely an algorithm problem because it happens in C2C too; I've downloaded and tried the latest C2C SVN, started a game with Blitz gamespeed and after 6-7 turns (with AI autoplay), I already have -1% of inflation. Actually, it's not a big problem because after the first 100-130 turns inflation grows above 0 and since inflation it's supposed to stay 0 for the first about 100 turns, it's not significant (especially because you don't earn so much in the first 100 turns and hence effect of inflation is almost 0). But it looks like it's caused by the code and not by my merge in AND. :)
 
45°38'N-13°47'E;11955660 said:
Well, it's surely an algorithm problem because it happens in C2C too; I've downloaded and tried the latest C2C SVN, started a game with Blitz gamespeed and after 6-7 turns (with AI autoplay), I already have -1% of inflation. Actually, it's not a big problem because after the first 100-130 turns inflation grows above 0 and since inflation it's supposed to stay 0 for the first about 100 turns, it's not significant (especially because you don't earn so much in the first 100 turns and hence effect of inflation is almost 0). But it looks like it's caused by the code and not by my merge in AND. :)

If I have time to look at it tomorrow after I deal with the pathing in ZOCs issue, I will since V27 is released Saturday. Thanks for doing the diagnosis thus far and getting a simple recipe.
 
If I have time to look at it tomorrow after I deal with the pathing in ZOCs issue, I will since V27 is released Saturday. Thanks for doing the diagnosis thus far and getting a simple recipe.

If I'm able, I'll also try what you suggested to see if I can give more help to understand what element is causing the problem. I don't know if I'm able to fix it, but at least I can point out the cause. :)
 
45°38'N-13°47'E;11955718 said:
If I'm able, I'll also try what you suggested to see if I can give more help to understand what element is causing the problem. I don't know if I'm able to fix it, but at least I can point out the cause. :)

Wonderful. Thanks again.
 
Well, it looks like I'm not able to put a breakpoint on CvPlayer::getCurrentInflationPerTurnTimes10000() and see what element in it is giving a negative value; tbh, I'm not sure if I'm doing it correctly; this is what I've done: I've set a breakpoint at the line of CvPlayer where "getCurrentInflationPerTurnTimes10000()" is; compiled the dll as "debug", loaded a savegame where I had a negative value of inflation; but I don't have any clue on what's causing the negative value. Sorry if I can't give more help. :(

Edit: All I can do is to attach here a savegame where you can see negative inflation, rev should be 4181 I think.
 

Attachments

45°38'N-13°47'E;11957656 said:
Well, it looks like I'm not able to put a breakpoint on CvPlayer::getCurrentInflationPerTurnTimes10000() and see what element in it is giving a negative value; tbh, I'm not sure if I'm doing it correctly; this is what I've done: I've set a breakpoint at the line of CvPlayer where "getCurrentInflationPerTurnTimes10000()" is; compiled the dll as "debug", loaded a savegame where I had a negative value of inflation; but I don't have any clue on what's causing the negative value. Sorry if I can't give more help. :(

Edit: All I can do is to attach here a savegame where you can see negative inflation, rev should be 4181 I think.

Ok, simple bug. Fix will be pushed to the C23C SVN shortly (check in an hour or so). The window used to compound current inflation over to calculate the equilibrium level didn't cope with being before the start of the current speed setting's inflation start turn. You'll just need the two line change in CvPlayer::getEquilibriumInflationCostModifier() for porting across.
 
Back
Top Bottom