• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

MNAI-U: unofficial build & bugfixes

The event offer to buy a map to a dungeon triggered on a city tile, which made it impossible to purchase.
 
How is settler cost determined in FFH/MNAI? In the XML, cost is listed as 120 hammers, but in game settlers cost 220 hammers. Changing the cost to 100 hammers in the XML changes the cost of settlers in game to 200. Where is the extra hammer cost coming from? Also note that settler cost is not shown in the civlopedia.
 
How is settler cost determined in FFH/MNAI? In the XML, cost is listed as 120 hammers, but in game settlers cost 220 hammers. Changing the cost to 100 hammers in the XML changes the cost of settlers in game to 200. Where is the extra hammer cost coming from? Also note that settler cost is not shown in the civlopedia.
 
  • Like
Reactions: Set
Thanks, doesn't sound like there's an easy fix other than just dropping the cost in the XML file 100 hammers below what you want the settler to cost.
 
What's the problem? You think it's too cheap?
I didn't change it from vanilla FfH, just added the help text.
Ok. I just feel that it should be reported and if would be an interesting change to the game.

As Deaf Metal said, you should have been able to vote "NEVER". That is supposed to do what you want.
Votes force all members to do what the result is. The thing more like what you were describing is defy resolution.
Yes. I just wanted to suggest something that I believe would better the mod's gameplay. Thank you for your answers guys.
 
Hopefully my last question while I wrap my head around doing a little bit of DLL modmodding. I've added a little bit of code to the DLL to prevent the AIs from attempting to explore lairs until their units are level 3. Like so:
Spoiler :

Code:
bool CvUnitAI::AI_exploreLair(int iRange)
{

    if (GET_TEAM(getTeam()).isBarbarianAlly())
    {
        return false;
    }
//Set Code Begin. Makes AI not try to explore lairs unless a unit is level 3
    if (getLevel() < 3)
    {
        return false;
    }
//Set Code End
    if (GET_PLAYER(getOwnerINLINE()).getNumCities() == 0)
    {
        return false;
    }

The code builds fine and works great. But turns are now unbearably slowly. Almost unplayably so. I don't think this is anything to do with my change. Both because I don't see why it would cause this issue (it should speed up turns if anything!) but also because removing it doesn't seem to fix the problem. However, substituting the DLL from base MNAI does cause the problem to go away. I assume this is a pretty normal and expected part of working with the DLL that I'm just not familiar with but maybe it's a weird problem?
 
Yes, that's the problem. Up and ready to go with the DLL now. Thank you for your patience :)
 
I got another unexplained crash with a dump file I cannot make much sense of.

Spoiler :

Microsoft (R) Windows Debugger Version 10.0.25200.1003 X86
Copyright (c) Microsoft Corporation. All rights reserved.


Loading Dump File [C:\Users\jonmi\AppData\Local\Temp\Civ4BeyondSword.exe.dmp]
User Mini Dump File with Full Memory: Only application data is available


************* Path validation summary **************
Response Time (ms) Location
Deferred srv*
Symbol search path is: srv*
Executable search path is:
Windows 8 Version 9200 MP (16 procs) Free x86 compatible
Product: WinNt, suite: SingleUserTS Personal
Machine Name:
Debug session time: Sat May 20 21:26:57.000 2023 (UTC - 4:00)
System Uptime: 2 days 11:55:18.369
Process Uptime: 0 days 0:47:36.000
................................................................
.............................................
Loading unloaded module list
.................................
This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(34f0.7740): Access violation - code c0000005 (first/second chance not available)
For analysis of this file, run !analyze -v
eax=00000000 ebx=61359018 ecx=80000001 edx=03c858c8 esi=61358ff0 edi=61359048
eip=77d470ac esp=0019ea10 ebp=0019ea1c iopl=0 nv up ei pl nz ac po nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000212
ntdll!NtGetContextThread+0xc:
77d470ac c20800 ret 8
0:000> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************


KEY_VALUES_STRING: 1

Key : AV.Dereference
Value: NullClassPtr

Key : AV.Fault
Value: Read

Key : Analysis.CPU.mSec
Value: 828

Key : Analysis.DebugAnalysisManager
Value: Create

Key : Analysis.Elapsed.mSec
Value: 12552

Key : Analysis.IO.Other.Mb
Value: 3

Key : Analysis.IO.Read.Mb
Value: 0

Key : Analysis.IO.Write.Mb
Value: 30

Key : Analysis.Init.CPU.mSec
Value: 46

Key : Analysis.Init.Elapsed.mSec
Value: 5279

Key : Analysis.Memory.CommitPeak.Mb
Value: 60

Key : Timeline.OS.Boot.DeltaSec
Value: 215718

Key : Timeline.Process.Start.DeltaSec
Value: 2856

Key : WER.Process.Version
Value: 3.1.9.0


FILE_IN_CAB: Civ4BeyondSword.exe.dmp

NTGLOBALFLAG: 0

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS: 0

CONTEXT: (.ecxr)
eax=00000000 ebx=00000008 ecx=80000001 edx=03c858c8 esi=46309c78 edi=00000078
eip=0481b85e esp=0019fb54 ebp=00000000 iopl=0 nv up ei pl zr na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010246
CvGameCoreDLL!CvUnit::NotifyEntity+0x11b5e:
0481b85e 807837ff cmp byte ptr [eax+37h],0FFh ds:002b:00000037=??
Resetting default scope

EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 0481b85e (CvGameCoreDLL!CvUnit::NotifyEntity+0x00011b5e)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000000
Parameter[1]: 00000037
Attempt to read from address 00000037

PROCESS_NAME: Civ4BeyondSword.exe

READ_ADDRESS: 00000037

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.

EXCEPTION_CODE_STR: c0000005

EXCEPTION_PARAMETER1: 00000000

EXCEPTION_PARAMETER2: 00000037

STACK_TEXT:
00000000 00000000 00000000 00000000 00000000 CvGameCoreDLL!CvUnit::NotifyEntity+0x11b5e


STACK_COMMAND: ~0s; .ecxr ; kb

SYMBOL_NAME: CvGameCoreDLL+11b5e

MODULE_NAME: CvGameCoreDLL

IMAGE_NAME: CvGameCoreDLL.dll

FAILURE_BUCKET_ID: NULL_CLASS_PTR_READ_c0000005_CvGameCoreDLL.dll!Unknown

OSPLATFORM_TYPE: x86

OSNAME: Windows 8

FAILURE_ID_HASH: {06651709-9ed0-5fcb-2f42-ce0a4a332891}

Followup: MachineOwner
---------



Unrelated, but how does the game determine what units to give the player when starting in later eras? In my modmod I find that in a Medieval start most players get a Sapere (priest of the Laeran Cord), but the Khazad get a couple Firebrands (priests of the Ember Legion) and the Svartalar get some Flurries. It might be nice if they could each get a more lore appropriate priest or other units.



Could you swap the colors for production bonuses when they are negative? I gave a bunch of units a positive production bonus for one mana type and a negative bonus for the opposing sphere, and think it looks odd for that to show up as green when you have the bonus and red when you don't whether having it makes unit production faster or slower.
 
Last edited:
Where is the lair spawning (generating skeletons on barrows, Lizards on ruins etc.) code stored in MNAI?
 
any chance of merging PBmod into this/EMM for ease of pitboss multiplayer gaming? Dunno if there's an existing history or anything I just started bashing my head against this myself lol
 
I cannot either. I'd need a full dump produced with a debug DLL.
I just got my first crash after switching to the debug dll and opted for a full dump.

I still don't know how to make sense of it.

When I tried uploading a zip of the dump file the forum says "The uploaded file is too large for the server to process." The original dump file is 1.94 GB while the zip is 596 MB.

Spoiler :

Microsoft (R) Windows Debugger Version 10.0.25200.1003 X86
Copyright (c) Microsoft Corporation. All rights reserved.


Loading Dump File [C:\Users\jonmi\AppData\Local\Temp\Civ4BeyondSword.exe.dmp]
User Mini Dump File with Full Memory: Only application data is available


************* Path validation summary **************
Response Time (ms) Location
Deferred srv*
Symbol search path is: srv*
Executable search path is:
Windows 8 Version 9200 MP (16 procs) Free x86 compatible
Product: WinNt, suite: SingleUserTS Personal
Machine Name:
Debug session time: Tue May 30 00:00:08.000 2023 (UTC - 4:00)
System Uptime: 11 days 14:28:18.086
Process Uptime: 0 days 0:08:21.000
................................................................
..............................................
Loading unloaded module list
.................................
This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(89d0.3b20): Access violation - code c0000005 (first/second chance not available)
For analysis of this file, run !analyze -v
eax=00000000 ebx=7ef53c18 ecx=80000001 edx=04238408 esi=7ef53bf0 edi=7ef53c48
eip=77d470ac esp=0019ea30 ebp=0019ea3c iopl=0 nv up ei pl nz ac pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000216
ntdll!NtGetContextThread+0xc:
77d470ac c20800 ret 8
0:000> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************


KEY_VALUES_STRING: 1

Key : AV.Dereference
Value: NullClassPtr

Key : AV.Fault
Value: Read

Key : Analysis.CPU.mSec
Value: 640

Key : Analysis.DebugAnalysisManager
Value: Create

Key : Analysis.Elapsed.mSec
Value: 1535

Key : Analysis.IO.Other.Mb
Value: 0

Key : Analysis.IO.Read.Mb
Value: 0

Key : Analysis.IO.Write.Mb
Value: 0

Key : Analysis.Init.CPU.mSec
Value: 46

Key : Analysis.Init.Elapsed.mSec
Value: 11806

Key : Analysis.Memory.CommitPeak.Mb
Value: 75

Key : Timeline.OS.Boot.DeltaSec
Value: 1002498

Key : Timeline.Process.Start.DeltaSec
Value: 501

Key : WER.Process.Version
Value: 3.1.9.0


FILE_IN_CAB: Civ4BeyondSword.exe.dmp

NTGLOBALFLAG: 0

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS: 0

CONTEXT: (.ecxr)
eax=00000000 ebx=00000008 ecx=80000001 edx=04238408 esi=0000003c edi=45f01d18
eip=047f6dd9 esp=0019fb74 ebp=00000000 iopl=0 nv up ei pl zr na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010246
CvGameCoreDLL!CvUnit::NotifyEntity+0x123a9:
047f6dd9 807837ff cmp byte ptr [eax+37h],0FFh ds:002b:00000037=??
Resetting default scope

EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 047f6dd9 (CvGameCoreDLL!CvUnit::NotifyEntity+0x000123a9)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000000
Parameter[1]: 00000037
Attempt to read from address 00000037

PROCESS_NAME: Civ4BeyondSword.exe

READ_ADDRESS: 00000037

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.

EXCEPTION_CODE_STR: c0000005

EXCEPTION_PARAMETER1: 00000000

EXCEPTION_PARAMETER2: 00000037

STACK_TEXT:
00000000 00000000 00000000 00000000 00000000 CvGameCoreDLL!CvUnit::NotifyEntity+0x123a9


STACK_COMMAND: ~0s; .ecxr ; kb

SYMBOL_NAME: CvGameCoreDLL+123a9

MODULE_NAME: CvGameCoreDLL

IMAGE_NAME: CvGameCoreDLL.dll

FAILURE_BUCKET_ID: NULL_CLASS_PTR_READ_c0000005_CvGameCoreDLL.dll!Unknown

OSPLATFORM_TYPE: x86

OSNAME: Windows 8

FAILURE_ID_HASH: {06651709-9ed0-5fcb-2f42-ce0a4a332891}

Followup: MachineOwner
---------
 
any chance of merging PBmod into this/EMM for ease of pitboss multiplayer gaming? Dunno if there's an existing history or anything I just started bashing my head against this myself lol
You mean this? https://github.com/civ4-mp/pbmod

I can put it on the list, but no promises.
I still don't know how to make sense of it.
Opening it with Visual Studio will give you a snapshot of the BtS process when it crashed. If the crash happened in the DLL code, the (immediate) problem should be easy to spot. Otherwise, it's in the exe, but the stack trace may reveal something.
 
You mean this? https://github.com/civ4-mp/pbmod

I can put it on the list, but no promises.

Opening it with Visual Studio will give you a snapshot of the BtS process when it crashed. If the crash happened in the DLL code, the (immediate) problem should be easy to spot. Otherwise, it's in the exe, but the stack trace may reveal something.
yeah all that stuff, I don't understand the nuts and bolts of it myself just that some functionality seems to be necessary to allow for pitboss style games in the modern day lol
 
Any idea when the next MNAI update may be out? I'm getting close to ready to release another minor update of my modmod (just a few python bug fixes mostly pedia/mouseover additions to better explain what will effect a priest's odds of miscasting), but would rather have a new DLL to include if it would cut down on crashes.

I haven't been able to make sense of the crash dump files myself. I'd like to share them to see if you have more luck, but the forum won't let me share files that are about 2 GB.

I could post saved games from shortly before a crash, but the game doesn't generally crash at the same point when I load from a saved game. Sometimes it will play fine for another 5, 10, or 20 turns.
 
Last edited:
This is a save from immediately before a repeatable crash in my current game with my modmod.

(I have made a few minor changes since the last release, but nothing that ought to break saved games or that I can imagine would be relevant to this crash.)

I'm still not sure how to make sense of the dump file, and that file is still too large to easily share in this forum, but I suspect you can easily get this saved game to crash and generate a dump file on your own machine for you to analyze.

I have a Djinn located one tile due west of the Lanun city of The Sunken Mire, and one tile north east of an neutral Amurite Galleon containing a worker. When I use the Djinn to cast Snowfall, the BBAI log shows this and then the game crashes.
Code:
     Djinn (9789772) casting Snowfall (plot 49, 7)
    Killing Galleon (delayed) -- received deadly damage (Unit 4399126 - plot: 48, 6)
    Killing Worker -- Transporting unit killed (Unit 4071529 - plot: 48, 6)
    Worker Slain! (Unit 4071529 - plot: 48, 6)
    Galleon Slain! (Unit 4399126 - plot: 48, 6)
    Killing Galleon (delayed) -- received deadly damage from attacker in doDamage() (Unit 4399126 - plot: 48, 6)
    Galleon Slain! (Unit 4399126 - plot: 48, 6)

When I used worldbuilder to move the Djinn to the other side of the Sunken Mire to attack the city with Snowfall but not effect the Amurite's Galleon, it caused no problems.

Maybe the problem is related to the spell causing a declaration of war for dealing damage to a neutral unit?



Edit: I've had several more crashes, not always reproducible from loading a save, but it seems like the common factor is that the BBAI log always shows a worker Slain.
 

Attachments

Last edited:
Back
Top Bottom