Shared AND/C2C Debug codes

I was under the impression dummy graphics were to reduce memory usage. Right now, each unit gets its own copy of a "graphics" object, which is what you see in-game. Dummy graphics attempts to reduce the number of graphics objects created, by re-using "dummy" graphics, one for each unit type currently around. This reduces the amount of graphic objects created, and thus the amount of video ram used.

At least, that is how I understood it. I have no idea if it was ever finished and if it works.
Yeah... um... I'm :dunno: on this subject but I think Koshling knew more about it and he'd probably respond to a PM on it.

IMO the two best tools are the BBAI logging (turn on in BUG settings, logging area) and just checking out the menus (like treasury). If the AI is at 0% science, check what it is spending gold on. Units? Shift-Alt-Control combos and hover over cities/terrain. It will list desired defenders & floating defender units the AI wants. I don't about C2C, but perhaps something is making the AI feel it needs much more defense than it really does.
In my experience, it appears the AI vastly UNDERstaffs its defenses and attack forces. It's spending a lot on property control though but probably not much more than I do when playing. From what I can tell, some of the AIs are really just too excited to grow and don't do so with enough care. Then when they get in a panic about their economic situation they start building research and such and it's a total waste of time as they aren't investing into their nation's potential but rather end up grasping for the immediate needs. Since they stop the long term investing, even though it won't solve their problems within a few rounds, they hit that wall and fall behind and get more and more nervous about being behind in tech and trying to make up with it by building research which puts them yet further behind.

What bugs me about this is I haven't been able to figure out how they can build research while they have other things they can do... the construction selection routine doesn't seem to allow it until the last evaluation which I find very odd since they are seen doing this when they clearly would have better things to do!
 
In my experience, it appears the AI vastly UNDERstaffs its defenses and attack forces. It's spending a lot on property control though but probably not much more than I do when playing. From what I can tell, some of the AIs are really just too excited to grow and don't do so with enough care. Then when they get in a panic about their economic situation they start building research and such and it's a total waste of time as they aren't investing into their nation's potential but rather end up grasping for the immediate needs. Since they stop the long term investing, even though it won't solve their problems within a few rounds, they hit that wall and fall behind and get more and more nervous about being behind in tech and trying to make up with it by building research which puts them yet further behind.

What bugs me about this is I haven't been able to figure out how they can build research while they have other things they can do... the construction selection routine doesn't seem to allow it until the last evaluation which I find very odd since they are seen doing this when they clearly would have better things to do!

Sounds like C2C specific features are probably out of balance with the rest of the AI priorities. The AI in RAND is not better than in BTS, but is acceptably good. Probably just 1 difficulty weaker.
 
Sounds like C2C specific features are probably out of balance with the rest of the AI priorities. The AI in RAND is not better than in BTS, but is acceptably good. Probably just 1 difficulty weaker.

There might also be some C2C specific features without proper code for the AI to handle them and others are out of balance or not complete. RAND is simpler and that is a good thing in terms of AI, performance.....
 
Wait, can you explain more about the AI? Your AI reduces science all the way down to 10% on the slider!? That is rather extreme. I never saw the AI go below 30%, and that was rare.

I've seen it to 0% in AND, while pushing 100% culture, usually in modern era for many consecutive turns. I don't think it has anything to do with units production, possibly is caused by AI trying to keep up in terms of culture when Mastery Victory is active because of the points you get for legendary cities. I haven't tried with Mastery off anyway.

Edit: I've checked it with autoplay
 
45°38'N-13°47'E;13240416 said:
I've seen it to 0% in AND, while pushing 100% culture, usually in modern era for many consecutive turns. I don't think it has anything to do with units production, possibly is caused by AI trying to keep up in terms of culture when Mastery Victory is active because of the points you get for legendary cities. I haven't tried with Mastery off anyway.

Edit: I've checked it with autoplay

That's another story - the AI's economy is fine, it's just going for victory.
 
I recommend you guys take a look at a few of the AI fixes I know alberts2 was interested.

I had a question about the dummy graphics system C2C added. RAND has it disabled by default - is it enabled by default for C2C? What are the advantages/disadvantages of using it?

I've been tracking down a strange CTD related the unit graphic setup, and comparing the C2C code to the BTS code, the disabled dummy graphics doesn't quite line up with the default BTS code. I am specifically looking at reloadEntity in CvUnit.

It's used to reduce memory footprint. It disables the creation of entities that are off-screen, and dynamically loads/unloads them as different regions become visible. The upside is a significant memory reduction. The downside is some rendering lag as you scroll around. The main problem i that the EXE doesn't inform the DLL what the visible region is, so it has to try to dead-reckon it on each timeslice.
 
It's used to reduce memory footprint. It disables the creation of entities that are off-screen, and dynamically loads/unloads them as different regions become visible. The upside is a significant memory reduction. The downside is some rendering lag as you scroll around. The main problem i that the EXE doesn't inform the DLL what the visible region is, so it has to try to dead-reckon it on each timeslice.

Is it also the bit causing the problems with Event Signs on the map? They sometimes appear and sometimes don't.
 
Is it also the bit causing the problems with Event Signs on the map? They sometimes appear and sometimes don't.

Possibly, but I always thought that was viewports (do you have them turned on?). However, they do have some code in common - the issue is that signs are handled somewhat outside of the DLL and the coordinate remapping seems to get confused sometimes because the EXE has no concept of it, so the DLL is basically trying to fool it all the time (and not always getting it right/able to do so in some residual cases it seems)
 
No viewports. My testing to replicate the problem was when I tried to set up a picture of the alternate terrains. I went into WorldBuilder to place the terrains then back to game to add event signs on each terrain. I figured that once I did that I could then just switch the terrain sets to show them side by side but only need to do the labeling once.

There are two different sets of signs. The personalised map signs are done in the dll while the event signs are done in python.
 
I found a classic copy&paste error in CvCultureLinkInterface.py causing the civ with the id 0 to fail all the time.

Example:
Code:
if (gc.getInfoTypeForStringWithHiddenAssert("CIVILIZATION_ABORIGINES") > 0)
must be > -1
Code:
if (gc.getInfoTypeForStringWithHiddenAssert("CIVILIZATION_ABORIGINES") > -1)
 

Attachments

I added new diplomacy trade options and fixed some bugs with old advanced diplo features, in case you are interested:

Revision 726

  • Turn on old BTS path finding
  • Add new diplomacy trade option: Cease Relations With (Player)
  • Add new diplomacy trade option: Pay War Reparations
  • Fixed Embassy diplomacy trade option to only use 1 line instead of 2 on trade screen
  • Track war mongering by players, have it influence attitude
  • Minor diplomacy AI improvements & bug fixes

Diff View
 
I like it too but i don't have plans to merge it because of time issues. If you do it you should also merge their trading for war allies CONTACT_TRADE_BUY_WAR.
 
Alright... I think we should probably wait til after the release anyhow so it gets some playtesting before the next release anyhow. I trust Afforess but just to make sure the release is solid and stable... it IS a freeze at the moment (and I'm almost done with all freeze tasks.)

But I'll get it when I can and if you do the same one of us will get it in soon.
 
Why did you go back to the old PathGenerator?

Issues with crashes due to stack overflows with Koshlings. I don't have the familiarity with C++, or time and energy to debug the CvPathGenerator code.
 
Is it also the bit causing the problems with Event Signs on the map? They sometimes appear and sometimes don't.

Possibly, but I always thought that was viewports (do you have them turned on?). However, they do have some code in common - the issue is that signs are handled somewhat outside of the DLL and the coordinate remapping seems to get confused sometimes because the EXE has no concept of it, so the DLL is basically trying to fool it all the time (and not always getting it right/able to do so in some residual cases it seems)

No viewports. My testing to replicate the problem was when I tried to set up a picture of the alternate terrains. I went into WorldBuilder to place the terrains then back to game to add event signs on each terrain. I figured that once I did that I could then just switch the terrain sets to show them side by side but only need to do the labeling once.

There are two different sets of signs. The personalised map signs are done in the dll while the event signs are done in python.

In this thread I there is some info on the sign issue, along with a partial fix. The fix covers every sign done via the Python, which should be everything except player added signs.

As mentioned in that thread, the underlying cause of the signs going away is that the code that should restore them after they are cleared (which is done when a viewport moves or an autosave is made, and probably some other places).

An addition to the fix given it is probably possible to fix the user placed signs as well by moving them over to be Python based signs. You don't necessarily have to replace the current sign placement system, just do the transfer whenever the signs would be cleared. The method could be similar to the fix in that thread, which restores all the signs to the map when the sign adding python is called with specific arguments (NULL plot, NO_PLAYER player, and 0 length text). Before actually clearing the signs it could call the add sign python with a specific set of arguments that are defined to mean "copy any sign the game knows about that you don't already have in your list". Setting it up to also delete any sign that has been deleted could also be a good thing since those are often not intended to hang around forever. As far as I can recall the only signs that ever get removed are player placed signs and the ones from the "personalized map" option on features that are removed, like chopping down a named forest should removed the name sign.
 
Thanks, I'll amend and test our code.

Edit changed the code, the sign stayed for awhile then disappeared. reloading the game did not bring it back.
 
Thanks, I'll amend and test our code.

Edit changed the code, the sign stayed for awhile then disappeared. reloading the game did not bring it back.

Not sure what changes you made but...

The change I suggest would not be just a Python change where the above fix is. That happens after the signs are already cleared in order to show them again (so the player signs are already gone). It needs a DLL change in the function used to clear the signs to call the add sign Python with some identifiable and not normally useful set of arguments (like maybe NULL plot, player -2, and 0 length text) to trigger the "update user signs" Python.
 
Back
Top Bottom