1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Bug Reports and Discussion

Discussion in 'More Naval AI Modmod' started by Tholal, Jan 3, 2013.

  1. Terkhen

    Terkhen Chieftain

    Joined:
    Aug 1, 2011
    Messages:
    909
    Gender:
    Male
    Location:
    United Kingdom
    I also prefer to stay as a contributor. IMO we just need to know what method is preferred for sending the code (diff file, revision link, modified files) and for reporting it (issue at the tracker, new post here). Agreeing on these points should make the process more smooth :)
     
  2. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,061
    Location:
    Kael's head
    I'm getting errors like this in various scenarios:
    Code:
    Traceback (most recent call last):
      File "BugEventManager", line 361, in _handleDefaultEvent
      File "CvEventManager", line 1603, in onUnitKilled
      File "ScenarioFunctions", line 1911, in onUnitKilled
    RuntimeError: unidentifiable C++ exception
    
    It seems like pPlayer.setAlive(False) is the cause of the problem.

    It is used 14 times (if you include gc.getPlayer(iWorstPlayer).setAlive(false) and gc.getPlayer(iPlayer).setAlive(false) too) in ScenarioFunctions.py, but not in any other python file. You'd never come across the problem if you play only random games.
     
  3. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,676

    Thanks for the fix lgfr! If simply pointing me to the code changes is easiest for you, I can work with that as long as there aren't a dozen different files affected. It would be nice for me if everyone simply worked via my Sourceforge repository, but I also understand what a pain it is to try and extract a bit of code for someone else. Sourceforge does have the ability to flag issues for certain developers, and I'm willing to spend more time on management if need be. But either way, a free fix is a free fix, and I wont complain about any help I can get!
     
  4. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,676
    OK. Do you happen to have a savegame from right before this error appears (I can load up savegames from your mod if I need to). It would be a lot easier than trying to play a scenario myself to cause one of these calls to get triggered.
     
  5. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,061
    Location:
    Kael's head
    Triggering the call is quite easy. There doesn't really have to be any waiting involved.
    It seems to me like the simplest way for you to test this though would be to start a Gift of Kylorin game in MNAI, use world builder to place a powerful barbarian unit right next to your archmage, and then attack him immediately.


    I did find this one saved game from my modmod you could use if you prefer though. Just make the Auric unit attack the Archer defending the adjacent barbarian city. That should kill him and trigger the error.



    Edit: I just noticed that ScenarioFunctions.py has a bug in the code that causing terraforming when Auric Ascended enters the world in the Mulcarn Reborn scenario.

    CyPlot's VOID setTerrainType (TerrainType eNewValue, BOOL bRecalculate, BOOL bRebuildGraphics) requires 3 arguments, but this code gives only one.

    This seems to be a mistake that Kael made in Base FfH2, which no one has noticed since the AI does not prioritize Ascension very well. I would not have noticed it if I had not tried allowing the human to play as either team.

    Here is the simple fix. (Switching from if to elif statements is not necessary, but I tend to prefer it that way.)
    Spoiler :
    starting at line 1818
    Code:
    		if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_WB_MULCARN_REBORN):
    			if pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_AURIC_ASCENDED'):
    				for iPlayer in range(gc.getMAX_PLAYERS()):
    					pLoopPlayer = gc.getPlayer(iPlayer)
    					if pLoopPlayer.isAlive():
    						if pLoopPlayer.getTeam() != 0:
    							gc.getPlayer(iPlayer).changeDisableProduction(1000)
    				iDesert = gc.getInfoTypeForString('TERRAIN_DESERT')
    				iGrass = gc.getInfoTypeForString('TERRAIN_GRASS')
    				iPlains = gc.getInfoTypeForString('TERRAIN_PLAINS')
    				iSnow = gc.getInfoTypeForString('TERRAIN_SNOW')
    				iTundra = gc.getInfoTypeForString('TERRAIN_TUNDRA')
    				for i in range (CyMap().numPlots()):
    					pPlot = CyMap().plotByIndex(i)
    					if pPlot.getFeatureType() == -1:
    						if pPlot.getImprovementType() == -1:
    							if pPlot.isWater() == False:
    								iTerrain = pPlot.getTerrainType()
    [COLOR="Red"]##								if iTerrain == iTundra:
    ##									pPlot.setTerrainType(iSnow)
    ##								if iTerrain == iGrass:
    ##									pPlot.setTerrainType(iTundra)
    ##								if iTerrain == iPlains:
    ##									pPlot.setTerrainType(iTundra)
    ##								if iTerrain == iDesert:
    ##									pPlot.setTerrainType(iPlains)[/COLOR]
    
    	[COLOR="Blue"]							if iTerrain == iTundra:
    									pPlot.setTerrainType(iSnow, True, True)
    								elif iTerrain == iGrass:
    									pPlot.setTerrainType(iTundra, True, True)
    								elif iTerrain == iPlains:
    									pPlot.setTerrainType(iTundra, True, True)
    								elif iTerrain == iDesert:
    									pPlot.setTerrainType(iPlains, True, True)[/COLOR]
    				cf.addPopup(CyTranslator().getText("TXT_KEY_WB_MULCARN_REBORN_AURIC_ASCENDED",()),'art/interface/popups/Auric Ascended.dds')
    
    
     
  6. Terkhen

    Terkhen Chieftain

    Joined:
    Aug 1, 2011
    Messages:
    909
    Gender:
    Male
    Location:
    United Kingdom
    IMHO the simplest way to share code are diff/patch files. These files contain all the changes required in a somewhat readable format, are trivial to create for us in Mercurial against a specific MNAI revision (hg diff -r MNAI_rev -r rev_with_the_fix) and are also trivial to apply in the Subversion repository that MNAI uses following this tutorial. If you prefer it, I can post my contributions directly at the tracker instead of posting them here.

    EDIT: My contributions missing for inclusion are:

    http://forums.civfanatics.com/showpost.php?p=12244690&postcount=163
    http://forums.civfanatics.com/showpost.php?p=12176577&postcount=94

    I can create issues for them if you want.
     
  7. Doug Piranha

    Doug Piranha Chieftain

    Joined:
    Dec 19, 2008
    Messages:
    261
    Location:
    USA
    I've played several games now and I have to say I'm disappointed. I've enjoyed previous versions of MNAI, but this one seems like it's going in a direction I don't enjoy. Games seem to follow one of two paths (Immortal difficulty level):
    1) One or more AIs finds me early, and attacks with a huge stack. Either they kill me in the cradle, or I'm able to fight them off by producing a huge stack of my own, at great expense to expansion and tech.
    2) The AIs fail to track me down. I play a builder game in my little corner, and emerge to find the AIs busy warring with each other. Their tech and expansion is greatly ******** because they've poured so much of their effort into their armies.

    I'm not finding either of these outcomes very fun. I'm not saying it's not smart of the AI to attack me when its production advantages can have their greatest impact, but fighting against mobs of double-promoted warriors just doesn't appeal to me. And if I am lucky enough to survive long enough for the AIs to turn their armies on each other, it's a pretty easy win.
     
  8. Kiech

    Kiech Chieftain

    Joined:
    Oct 1, 2002
    Messages:
    987
    The AI does enjoy attacking from far away a little too much. If you are right next to them, then I expect a early warrior rush. However it seems that they are willing to toss away early expansion in favor of attacking someone who is very far away. Win or Lose, the AI isn't expanding, and the focus on mass military cripples them.
     
  9. [to_xp]Gekko

    [to_xp]Gekko QCT junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,942
    Location:
    Seyda Neen, Vvardenfell
    I'd recommend tweaking the increasing difficulty option and having it become the default behaviour, they do this in the VEM/GEM mod for civ5 and it works wonders. early advantages can be frustrating to play against as you noticed, while later on the AI really REALLY needs an handicap to stay competitive.
     
  10. Kiech

    Kiech Chieftain

    Joined:
    Oct 1, 2002
    Messages:
    987
    Clan related:
    If you break peace with the barbarians, and then try to cast your WS after completing Birthright Reclaimed, it doesn't work. The spell is just grayed out and won't let you cast it.
     
  11. lfgr

    lfgr Chieftain

    Joined:
    Feb 6, 2010
    Messages:
    673
    OK, I thought the bitbucket frontend would also let you download all changed files, but I realized that is not the case.

    The reason why I started this discussion was primary to stop attaching files here in the thread, so when the time comes and I have no more room for attachments, I don't have to search every thread and delete them. I just realized that there is a account page listing all attachments, so this is not a problem anymore. But I guess it is difficult for you to get all contributions here in the bug thread.

    I can both provide diff files and sets of changed files, that you could merge with a WinMerge or something. Just say what you prefer.
    (Terkhen, I made an utility sometime to compare to folders and copy only changed files (which was horribly slow, since it compared every file, though), so if you're working directly with MNAI repos when programming contributions it should be possible to get changed files automatically)

    So where to put it? Your sf project has a patches tracker, I tested it in an own project: everybody is allowed to add a patch with category, group, summary, description and attached file, the admin can change all other attributes like priority and status. It looks like a good system, whether with diffs or zips.

    btw, since you're doing this not just for you, but the whole community here, I think we should provide things to be merged easy for you, and thank you that WE don't have to do all the hosting stuff, not to mention all the work that's in this mod :)
    I'm just a bit afraid too many people using the SVN repo could mess it up, especially since I just contribute form time to time, and not only in a special scope, like I suppose Red-key does with super forts. Furthermore, I would not want to upload a fix for any issue if I am not sure if I really did it the way you want it.
    I think if you (and I, never worked with it before :)) get along with the diff files, it would be nearly as simple as if we directly committed to the sf repo: download patch, apply, test it if wanted, commit.
     
  12. Terkhen

    Terkhen Chieftain

    Joined:
    Aug 1, 2011
    Messages:
    909
    Gender:
    Male
    Location:
    United Kingdom
    Thanks, I was doing that by hand. Let's see what Tholal decides; if it is needed I would be quite helpful for me to have your tool :)

    I agree with this; the process should be made as easy for Tholal as possible. I suggested the diff/patch files because in my experience they are quite easy to review, apply and commit. A patch tracker would be great to store and discuss contributions if this way is considered.
     
  13. Folket

    Folket Chieftain

    Joined:
    Jan 7, 2010
    Messages:
    3,739
    Location:
    Sweden
    I notice that when I detach a great general the graphics of the general stays around.
     
  14. Terkhen

    Terkhen Chieftain

    Joined:
    Aug 1, 2011
    Messages:
    909
    Gender:
    Male
    Location:
    United Kingdom
    Tholal fixed that issue in the svn recently; it should be fixed in the next MNAI version :)
     
  15. Folket

    Folket Chieftain

    Joined:
    Jan 7, 2010
    Messages:
    3,739
    Location:
    Sweden
    Thanks. Good to know.
     
  16. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,676
    OK. Lets try using the patch tracker on Sourceforge and see how it goes.

    In regards to recent work,

    lfgr - I have your fix for the growth control display - will add it to the repository today

    Terken - I have your civyield changes as well, though I've been holding off on merging them since I have some old test saves that I still want to use. Merge will happen soon though.
    In regards to the Random player fix, did we ever figure out what caused this issue in the first place? My local dev copy has the <bAIplayable> variable set to 0 and that seems to be working. Was there some other issue that I missed?
     
  17. Terkhen

    Terkhen Chieftain

    Joined:
    Aug 1, 2011
    Messages:
    909
    Gender:
    Male
    Location:
    United Kingdom
    Okay, I'll post any further contributions at the tracker.

    Ok :)

    Both the old code and the new one used isAIPlayable for checking if a civilization should be chosen or not. Because of that, I assumed that it would work but it doesn't because CIVILIZATION_RANDOM has bAIPlayable set to 1. That was causing it to be selected in some cases, leading to the random leader bug. I don't understand why the issue was not present with the old code before your original Unrestricted Leaders change, though.

    If <bAIplayable> is set to 0, it is not possible to choose random alignment leaders for the AI in the custom game window. The code I posted here has a more complex logic for choosing which civilizations should be selected. It ignores all graphical only civilizations. Civilizations that are not playable by the AI are ignored if the player slot being chosen is destinated to an AI. Civilizations marked as not playable are always ignored.

    I don't remember anything else right now.
     
  18. Terkhen

    Terkhen Chieftain

    Joined:
    Aug 1, 2011
    Messages:
    909
    Gender:
    Male
    Location:
    United Kingdom
    With regard to the changes to animal spawning in r1389, from looking at the code it seems that if Wildlands is active it will always call createAnimals() instead of executing the big area loop that I assume is responsible for spawning barbarians.
     
  19. Tholal

    Tholal Chieftain

    Joined:
    May 19, 2009
    Messages:
    1,676
    Good catch. I'll have to just undo that change for now. Thanks!
     
  20. Calavente

    Calavente Richard's voice

    Joined:
    Jun 4, 2006
    Messages:
    2,771
    Location:
    France
    dunno if it's a bug but:
    I can't rename units in MNAI.
    I could do it in MoM and last RifE game I played.
    I don't know what else could have changed.

    oh, on balance.
    I got once a GC and a General.. on the same unit. so +2 str, +1xp+50%xp :D
    a bit too much IMO.
    at least there should be a way to forbid joing a general on a GC-equiped unit and disallow equipement of a GC if a general is joined.
     

Share This Page