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

Merging Better AI with BUG 3.5

Discussion in 'Civ4 - Better AI' started by Dresden, Oct 23, 2008.

  1. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    Glad you like it ^^

    All comments, hugs, w/e about Better BUG AI should from now on go to its thread in the Modpacks section: link
     
  2. _alphaBeta_

    _alphaBeta_ King

    Joined:
    Dec 28, 2005
    Messages:
    976
    Location:
    NJ, USA
    @Fuyu

    Did you find a way to show whether or not this option is active?


    This change in CvDLLWidgetData.cpp looks like it gets the job done, but there's no visual indicator (even if the advanced BUG scoreboard layout is disabled).


    Code:
    		if( gDLL->shiftKey() )
    		{
    			// Warning: use of this is not multiplayer compatible
    			if (GET_TEAM(GC.getGameINLINE().getActiveTeam()).canDeclareWar(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getTeam()))
    			{
    				if( GET_TEAM(GC.getGameINLINE().getActiveTeam()).AI_getWarPlan(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getTeam()) == WARPLAN_PREPARING_TOTAL) 
    				{
    					GET_TEAM(GC.getGameINLINE().getActiveTeam()).AI_setWarPlan(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getTeam(), NO_WARPLAN);
    				}
    				else
    				{
    					GET_TEAM(GC.getGameINLINE().getActiveTeam()).AI_setWarPlan(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getTeam(), WARPLAN_PREPARING_TOTAL);
    				}
    				gDLL->getInterfaceIFace()->setDirty(Score_DIRTY_BIT, true);
    			}
    		}
    
     
  3. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    It would be pretty easy to make that MP-compatible. Just broadcast the event and have the AI_setWarPlan() call happen in the Execute() method of the net message. Let me know if you want some help with that.
     
  4. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    You're right, there is no visual indicator. My problem is, I have no clue if there is one in BetterAI itself.
    It says that, I couldn't find any indication in the code that this (or any other warplan indication) is actually happening though.

    You should be able to see all warplans with cheat enabled when holding CTRL and hovering over your own line in the scoreboard, along with other info you shouldn't see though (unless cheating or AI debugging).
    To make it visible, I'd need to check for activeplayer's warplans in getAllRelationsString(), I'd need a new TXT_KEY to display it .. but that should be easy enough. "Preparing for War against A, B" for your own line and "You are preparing for War" for every player line you have a warplan against.

    @EF: What you say makes sense, I have no idea how to actually do that though. Help?
    Or rather, tell jdog how to do it, and I'll port it over when it's done :p . After all this isn't my own but a pure Better AI feature.
     
  5. _alphaBeta_

    _alphaBeta_ King

    Joined:
    Dec 28, 2005
    Messages:
    976
    Location:
    NJ, USA
    This sounds like the best implementation. One wouldn't have to worry about altered scoreboards from mods being a problem.

    Please let me know if you implement this. Sounds like a cool feature, but I don't want to cheat to be able to use it. I'm still digesting CvDLLWidgetData.cpp and the overlapping/conflicting changes that both BULL & BetterAI introduced into it. :crazyeye:
     
  6. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Okay, I'll try to remember to do that this weekend. I'm busy with Bad Company 2 at the moment. ;)
     
  7. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    I'm really wrestling with whether or not to introduce this feature into BULL. On the one hand, I really want to use it in my games and be able to display it in the BUG scoreboard nicely (different color crossed swords for planning). On the other, it's somewhat Altered Gameplay since it will change how the AI behaves even without Better AI. I suppose I could make it an optional BULL component. ;)
     
  8. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    @aB: I honestly don't quite see why this is important, it only affects your vassals, and I always play without since vassal stuff is a part from BTS and as such suffers from the same last-minute-hack syndrome that also plagues pretty much everything else that was new in that last addon.
    @EF: Telling your vassals what you are planning should be good even for UP imo. Yes it changes gameplay (for some people, not me) but it looks a lot like something that was overlooked or simply ignored because it looked so unimportant. (When a human wages war, small vassalized AIs helping or not rarely has any significance in the outcome since the AI isn't really a genius when it comes to warfare.)
     
  9. Caboose

    Caboose Another Drill IV defender

    Joined:
    May 1, 2008
    Messages:
    302
    Location:
    Norway
    I agree. Vassals do not work satisfyingly. I always play with it off too.
     
  10. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    @aB: The low level of difficulty of adding War Plan text to hover was just as expected, the time it took me until I got around to it not so much. In case you didn't write this tiny bit yourself by now, and if you are compiling your own dll, r53 and r55 might be of interest to you. Otherwise you'll have to wait a bit longer. I plan to put out another version before I merge in the last 7 revisions of Better AI.
     
  11. _alphaBeta_

    _alphaBeta_ King

    Joined:
    Dec 28, 2005
    Messages:
    976
    Location:
    NJ, USA
    Thanks! I actually forgot all about this. I'm giving it a whirl now, and everything looks good.
     
  12. Yxklyx

    Yxklyx King

    Joined:
    May 7, 2008
    Messages:
    869
    Does anyone know if the merge instructions in the OP would work with BUG 3.6?
     
  13. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    Very likely but why would you want such an old version of BUG?
     
  14. Yxklyx

    Yxklyx King

    Joined:
    May 7, 2008
    Messages:
    869
    After perusing the changelog, I didn't see anything that really interested me in the newer versions plus my own mod is built using some BUG 3.6 files and I'd have more work merging. BUG is great as is at 3.6!

    I hope Civ 5 will make it easier to merge different mods.
     
  15. razor436

    razor436 Chieftain

    Joined:
    Nov 18, 2005
    Messages:
    44
    (sorry, deleted post)
     
  16. travlake

    travlake Chieftain

    Joined:
    Apr 9, 2010
    Messages:
    52
    I have Bug 4.4 and Better BTS AI 1.01 installed.

    BUG is in the custom assets folder.
    Better BTS AI is installed as a mod.

    I followed the directions on the first page for this case (the third possibility listed on that page) but must have done something wrong because the following happens:

    1) I can load BTS fine by clicking on the BUG 4.4 link.
    2) I can load the Better BTS AI mod fine by going to advanced->load mod.
    3) When the game loads with the better ai mod and I start a game, the UI doesn't appear and I get the following error:

    "bug init - cannot find xml file for mod init"

    Any thoughts on where I went wrong?

    The only "nonstandard" thing is that a while ago when I just had BUG and not Better AI, I messed with some of the xml files in the custom assets folder to change some unit/building stats.

    Thanks!

    WORKAROUND:
    I got it working by installing both BUG and better ai into one mod as described by the first option in the first post.

    To get it working without error messages I had to run cIV as administrator in windows 7. Dunno if this will be true for everyone but you may want to make a note of it in the first post.
     
  17. SirDrake

    SirDrake Warlord

    Joined:
    Jan 2, 2008
    Messages:
    129
    Worked the first time. Thank you. My blessings upon you, your family, and your favorite sports team (so long as they aren't playing mine).

    -Jason
     

Share This Page