Real Strategy (AI) 2.0

Making AI better. One bit at a time.

  1. MightyJannissary

    MightyJannissary Chieftain

    Joined:
    Jun 7, 2021
    Messages:
    7
    Gender:
    Male
    Hi Infixo, I need your help. Errors 1919,1945,962 from realstrategy.lua, my lua log is filled with them. I added a custom policy through sql and implemented it in your code, is that the issue here? Policy is named LAND_PROD_1, you can find how I implemented the policy to your code in the params.sql that I uploaded with logs. It gives 50% production toward siege and cavalry units. Looking at the realstrategy.lua these seem to be about naval strategies, I didn't notice problems in game as I was playing with Mongolia. https://easyupload.io/h84i4y , I uploaded my database, modding and lua logs along with the edited params.sql from your mod. Standard size Terra map with standard settings, deity difficulty. Barbarian Clans and Dramatic Ages enabled. Persia, Eleanor France, Mongolia, Pericles Greece, Poland, Georgia, Gran Colombia, Byzantium was in the game. Hope it helps.
     
    Last edited: Jul 2, 2021
  2. MightyJannissary

    MightyJannissary Chieftain

    Joined:
    Jun 7, 2021
    Messages:
    7
    Gender:
    Male
    Played another game but this time only mod enabled was real strategy and it still produced lua callstack error for 1919 1945th lines.
     
  3. Infixo

    Infixo Deity

    Joined:
    Jan 9, 2016
    Messages:
    3,830
    Gender:
    Male
    Location:
    Warsaw
    @MightyJannissary What kind of game were you playing? Was it a domination and you started killing off all civs? The issue comes from the fact that the game calls strategies for non-existent players, probably killed civs. If this is true then I will have to add some sort of countermeasure for that.
     
  4. MightyJannissary

    MightyJannissary Chieftain

    Joined:
    Jun 7, 2021
    Messages:
    7
    Gender:
    Male
    Yes, in both games AI and I killed other civs.
     
  5. k.electron

    k.electron Chieftain

    Joined:
    Jul 3, 2021
    Messages:
    1
  6. King Phaedron

    King Phaedron Warlord

    Joined:
    Oct 9, 2017
    Messages:
    109
    Gender:
    Male
    Hi I have added real strategy mod to the mod folder and unzipped it. It says enabled but when I try to start a game it does not show up in the list of mods in use.

    I use slower tech by era and removable districts and not so unique improvements mods.

    I cannot disable the above mods because I have custom maps that depend on them.

    Edit I can remove mod dependencies by deleting them and saving for export. But I cannot add real strategy even creating a new map based on old one won't load.

    I can use it when starting a new game but I need to be able to use with maps I've made.

    I downloaded an sqlite but I don't know how to use it. What file an I loading and is it a project database or import? I just want to add real strategy to the mod dependencies for my maps.

    Currently I can open the map file and select mod dependencies there is title and I'd buy no list of actual mod dependencies yo be found.
     
    Last edited: Jul 22, 2021
  7. King Phaedron

    King Phaedron Warlord

    Joined:
    Oct 9, 2017
    Messages:
    109
    Gender:
    Male
    This mod is there when I start a game xnd then unlisted on the save. After that it's back when I load it. Checking the maps.

    New empty map select my map the real strategy does indeed appear then it is gone on the save. When I reload the map it is.... Gone. And when I go to play the map first it reverts most leaders in my save config to random. Leaders like germany and half others become unselectsble and the game will not load at all.

    When I reload a new empty map it is... Gone. Even worse it wipes out half the leaders and I can't select any new frontier civs. Maybe version 1.8 might be more compatible but it looks like:

    THIS MOD CANNOT BE USED WITH CUSTOM MAPS AT ALL NOT EVEN NEW ONES.

    So yeah it looks like it's totally incompatible with world maker maps. What a shamr ad I liked your approach but alas I shall have to look elsewhere for improving ai.
     
  8. King Phaedron

    King Phaedron Warlord

    Joined:
    Oct 9, 2017
    Messages:
    109
    Gender:
    Male
    Trying version 1.8 although I can play 2.0 just fine on regular maps which is definitely something.

    I have been playing offline as my desktop is currently without internet access and my most recent version was the 3 new civs and 2 game modes from last year.

    I downloaded sqlite spy and changed the not do unique improvements to real strategy and then changed the I'd as well... Loading the map it says real strategy but starting a game... It reverts back to not unique.

    Attempt 2 new map created based on old one. Did not work.

    Attempt 3 new map set to non mod, then original msp deleted (I keep backups) then reload the map and reselect package as mod. I mean if this option and new I'd aren't intended to change the dependencies what the heck good are they?

    This does load correctly but just becomes unselectsble and half the leaders vanish yet again.

    Attempt 4: brand new map. I selected continents instead of empty. Once again RS is there in active mods but gone once I save the msp. It seems to be there and work correctly with newly created maps. Then again I didn't actually change anything.

    But I just made a map and I can't be bothered yo remake it from scratch. Any way I can export and import the msp data into a new map without taking the stupid mod dependencies with me?

    Why is this like this to begin with? All regular maps are stand alone and can be played with any mods. I would have to remake all my maps. No thx.


    I'm assuming based on it not showing up in mods on use and save games. It also is not found in sq lite editor so I'm reasonably sure it is not working and not hidden.

    I guess it'll have to wait till next mfp I make but I gotta tell you. I'm really burned out on the lack of ai. It's a full time job just making sure they don't commit suicide settling their capital poorly and believe me they are committed to losing.

    Then some of them sit on settlers others make cities but there's always someone who gets horsemen very early usually scythia. As a result the barbarians destroy most of the ai civs cities, sparing only the capitals.

    (Side note the word capital cap it all etymology from caput meaning death. The barbs know they are dead anyway. Why not give barbarians cities? At least then id have to defend myself.)

    Doesn't matter how much you buff the ai it just makes them spawn powerful barbs. Nothing can fix the fact that civ 5 needed no mods and civ 6 was designed to be cheap disgusting garbage catered to moms and only fun in multiplayer after the first couple games.

    If I play the game with no barbarians it's even worse as they can actually be challenging at times. I played civ 5 for years and never had a complaint about the ai.

    So I think I will just go back to making maps for civ 5. At least there I could name enemy capitals and city states whatever I wanted. I don't think it's possible in civ 6 editor.

    I'm committed to playing the map I just made and my games tend to be huge epics that start in ancient era.

    Edit: heh. They promoted me to Warlord Dyer making this post.
     
    Last edited: Jul 22, 2021
  9. akamal

    akamal Chieftain

    Joined:
    Apr 17, 2006
    Messages:
    65
    I've been trying this mod out after I learning about the 'AI only cares about science' craziness, and have been seeing the same nil reference errors at line 1919 of RealStrategy.lua, in RefreshNavalData. As I was trying to make the AI better any sort exceptions here were concerning, so did a bit of investigation. I've not disproved the theory that they're caused by the game making strategy calls for dead civs, but not what's caused the ones I've seen. Quite the opposite in fact!

    I added a bit of logging to the function in question and that, combined with the logging from a couple of my mods, revealed what is happening. The problem seems to be new civs coming to life after the game has started: specifically a barbarian camp converting to a city states with the Barbarian Clans gamemode enabled.

    See lua.log here: https://pastebin.com/qsyFwvF1 , theres a lot of clutter in there from other mods I'm afraid, but the sequence of events is fairly clear:
    • Line 6: Load of saved game initiated from main menu (autosave from the end of turn 117/start of turn 118)
    • Line 23: RealStrategy setups tdata for each of the 27 'players' in the game (IDs 0-24, 62 and 63)
    • Line 557: In onLoadComplete tdata is populated for all players
    • Line 653: onLoadScreenClose events are fired
    • Line 768: LocalPlayer turn activated for turn 118
    • Line 778: LocalPlayer turn end for turn turn 118
    • Lines 783 - 890: ActiveStrategyNaval called successfully multiple times for each player in turn for IDs 1-24
    So far, so boring! But now, the interesting bit:
    • Line 891: A city is added to the map by playerID 25!
    • Line 1161-1175: ActiveStrategyNaval gets called for playerID 25, and a nil reference would have been thrown in RefreshNavalData (RealStrategy.lua:1919) had I not added a nil check. This repeats three times.
    • Line 1176-1183: ActiveStrategyNaval called successfully for playerID 0, eight times
    • Line 1184: LocalPlayer turn activated for turn 119

    So, how did playerID 25 manage to found a city on turn 118, if there was no player 25 on turn 117!?
    The answer is, I think, in the fact that the CivilizationTypeName of the mysterious player 25 is CIVILIZATION_MUSCAT, a city-state, and as I was playing with Barbarian Clans mode it evolved from a camp on turn 118.

    The ActiveStrategyNaval calls then fail for player 25 every turn thereafter. But, if I save and reload the game, on load RST will initialise tdata for all 28 players that now exist, and the ActiveStrategyNaval calls are all successful from then on.

    I guess a similar situation could arise if a player were to be killed off, the game saved and reloaded while they were dead, in that case they would be missing when tdata was initialised. If they were then resurrected, by one of their cities being liberated, any strategy calls for them would fail - until the next save/reload.

    The case of resurrected players could be easily covered by using GetWasEverAliveIDs instead of GetAliveIDs when initialising tdata. But the completely new civs joining the game would seem to need a nil check on every access to tdata, so the new player can be added to tdata when they come into being. Unless there's an onPlayerAdded or similiar event that fires when a civ is spawned?

    Anyway, hope that helps in fixing the bug, and thanks for all your excellent Civ6 mods! Looking through that log has reminded me just how much of my Civ6 experience is actually down to you, not to mention the amount I've learnt about Civ6 from reading your code! :goodjob:
     
    goatdeer and Infixo like this.
  10. SilverFoxG

    SilverFoxG Chieftain

    Joined:
    Mar 27, 2019
    Messages:
    13
    Gender:
    Male
    Location:
    Scotland
    Hey Infixo, I was Wondering if I could get your permission to use parts of your code and edit it for my own AI project I am working on, it will mostly be the SQL since my own understanding of LUA is limited so i don't want to edit something I don't understand fully and I don't want to directly take what you have done.
    I understand if you do not wish for me to do this and will respect your wishes. and if you are looking for some help with bug testing and what not i'm happy to help if you need it.

    Thanks for your amazing mods.
     
    Last edited: Sep 9, 2021
  11. Infixo

    Infixo Deity

    Joined:
    Jan 9, 2016
    Messages:
    3,830
    Gender:
    Male
    Location:
    Warsaw
  12. SilverFoxG

    SilverFoxG Chieftain

    Joined:
    Mar 27, 2019
    Messages:
    13
    Gender:
    Male
    Location:
    Scotland
    It was stuff about the Plot Evaluation From RS_Main and a few minor things from Tactics like the Bombers being set to Siege and Giving Warrior Monks Unit AI, I already have an idea on how to AIFavoured Items which is the main focus of the mod so i haven't really been looking at that.
    I would love to be able to understand the LUA you have made to make something similar to your strategies but probably more simpler but that requires me to get better at LUA which i'm having to put on the back burner since i'll be back at college soon and isn't the point of this convo so sorry for rambling.
     

Share This Page