my mod has a bug somewhere

zhongguo

Chieftain
Joined
Apr 15, 2013
Messages
19
Hello folks,

since some weeks I can't stop to mod. In August we have a plan for a Civ4 LAN party in this town. However, I guess at some point I created a bug causing a unknown software exception.

The mod is based on the K-MOD. I did xml changes only. No Python.

In the attachment you will find the mod plus two save games. The save game AD-1868 crashes the game after the next turn with the message:

"The exception unkown software exception (0xc0000094) occurred in the application at location 0x02282bce"

Playing with or without random events doesn't make it better.

Is someone able and would be so kind to check out what could be the cause of the problem?

Download
 
The problem might be in the art files. You say that you did XML changes only, but did you add Leaders, Buildings or Units...?

Another option, since your mod is based on K-Mod, you could ask him to provide you with a debug dll. A debug dll is bigger thant the normal one, slows down the game considerably, but gives you error/warning messages that might help you to locate the problem, especially before the crash.

If you don't understand the messages (they are related to the code so you should know C++ to understand them), you could then post them here for other people to help you.
 
thank you isenchine. I was sure you would reply here.

The xml changes include new buildings, units and leaders. But everything is provided by BTS material. No new content was added.

Let's see if karadoc will be willing to help out.
 
I changed the upload location, now it should work. Thanks for the notice @Dancing Hoskuld
 
I might have found the problem!

One of the units had unitai_attack and a notunitai unitai_attack. Probably this issue caused the crash.
 
I'm glad for you! :)

Good to learn an error to avoid!
 
error still there :(
But while playing without barbarians it didn't happen. So this time played with them again and bang. So some turns before the crash I used the worldbuilder to delete all barbarian cities. Guess what? No crash. What could be the reason?

Instead of deleting the cities I once took them over by adding territory with the worldbuilder. No crash.

By the way, where it is set when animals and barbarians appear and disappear?

Learned so much doing all the modding and don't want to give up just because of this crash.
Thanks to the community here and http://modiki.civfanatics.com/
 
I don't know. You should know what changes you made for the barbarians!

Barbarians appearance are ruled by the following tags in the EraInfos file (GameInfo folder): <bNoAnimals>, <bNoBarbUnits> & <bNoBarbCities>.

Their numbers come rather from tags in the HandicapInfos file.

Sorry, but I don't have time this week to download your mod and have a look at it.
 
zhongguo, have you found anything new in the meantime?

I have downloaded your mod and have started to look into it. I don't want to give you false hope though.

Replacing your units by the BtS ones allowed me to continue with both of your saves (via a WorldBuilder save) for a few turns without crashes. So the culprit might be there...
 
I can tell you it happens with the INVISIBLE_BANDIT2 unit.

So far, what I did: added progressively all new units to BtS file. Last one to add was INVISIBLE_BANDIT2 + all the corresponding entries to the other units re SeeInvisible: INVISIBLE_BANDIT2 => crash.

Two things I noticed (although the crash is still there after):

1) Bear is <Invisible>INVISIBLE_BANDIT2</Invisible> and <SeeInvisible>NONE</SeeInvisible> contrary to other animals

2) the INVISIBLE_BANDIT2 unit cannot see its peers (<SeeInvisible>NONE</SeeInvisible>)

But as I said, the crash still happens then.

I will continue a bit to see if I can find something else.

EDIT: RECTIFICATION: when I added the INVISIBLE_BANDIT2, I also added the UNITCLASS_BANDIT in the CvUnitClassInfos file. There is no corresponding unit in the UnitInfos file. Deleting this entry enabled me to continue both saves.

EDIT 2: still there is or there are problems int Unit files but I'll continue tomorrow.
 
I'm enclosing herewith what I have done so far for you to continue.

4 files:

1-UnitClassInfos without the entry UNITCLASS_BANDIT (I thought it didn't matter if you don't have a corresponding entry in the Unit file but I got a crash with it and no crash without it - maybe a coincidence)

2-UnitInfos (this is the BtS in which I progressively incorporated all of your new units + many other changes: so far this file does not crash)

3+4-Two WorldBuilder saves which correspond to your two saved files with crash. It is needed to proceed like that when you make changes in the number of Units or of Unit Classes.

What is left for you is to check all remaining differences between the two UnitInfos file: yours and mine. There are not so many changes left. Have a particular look at the new building capacities of your (Great) Engineer. Proceed one by one and then check with the two WB files. Play at least 10 turns each time to have some assurance that the new modifications don't crash the game.

Two or three other things I noticed:

- there is a CIV4ArtDefines_Building in your Buildings folder.

- your Caravel has a <DefaultUnitAI>UNITAI_SETTLER_SEA and a <SpecialCargo>NONE which could be a source of conflict.

- your Carrier has a <NotUnitAIs>: UNITAI_EXPLORE instead of EXPLORE_SEA which could be a source of conflict.

I hope you will be able to resume playing your Mod without crashes. Good luck! :)
 
hey hey hey isenchine. It is fascinating how you are able to analye all these things, pure magic to me. Many many thanks! for your efforts to repair my humble modification.

In the meantime I already continued changing the game and still had a crash sometime but was able to continue after reloading. The AI is not allowed anymore to build cities although it would be nice to give them the right to.

Since this will be a multiplayer mod it is not absolutely necessary that the AI understands ever new implemented aspect. There are already more units implemented which are invisible using additional invisible tags. For example a (Great) Merchant called Traveller who is invisible but can be detected by military units, he can transport the specialunit_mercenary, who are intended to sneak into enemy territority. The Traveller was used by the AI, but for sure not in the proper way.


1) the bear was not intended to be invisible, already changed that some days ago.
2) the INVISIBLE_BANDIT2 unit cannot see its peers (<SeeInvisible>NONE</SeeInvisible>)
--> Is this necessary?
3) Have a particular look at the new building capacities of your (Great) Engineer
--> Hmm, okay, will do although no clue.
4) CIV4ArtDefines_Building in your Buildings folder
--> deleted now
5) Caravel has a <DefaultUnitAI>UNITAI_SETTLER_SEA and a <SpecialCargo>NONE
--> This ship is able to transport any unit to the colonies since I don't want anyone to land there with too many forces at once. So far I didn't see the AI using this ship for founding cities in the new world. Need to have more playtesting. But if there is still no founding maybe SETTLER_SEA needs to have room for a defending land unit on the ship in order to execute?
6) Carrier has a <NotUnitAIs>: UNITAI_EXPLORE instead of EXPLORE_SEA
--> was already corrected
7) Will have a close look what you have done with the two files you send me. Probably don't have the best programs to do that. Using Notepad++


Notice to anyone:

First: Using NotUnitAI UNITAI_EXPLORE is great if you don't want to get in contact with other nations. There might be still artificial exploration by using UNITAI_ATTACK though.

Second: Praise isenchine :king:
 
It's not pure magic, it's just systematic tedious job... :D

2) the INVISIBLE_BANDIT2 unit cannot see its peers (<SeeInvisible>NONE</SeeInvisible>)
--> Is this necessary?: I don't know, probably not. It's just that I've always seen it like that. If it's intentional and does not cause a crash, then it's fine!

3) Have a particular look at the new building capacities of your (Great) Engineer
--> Hmm, okay, will do although no clue: the two new buildings did not seem to be correctly enclosed in tags.

5) Caravel has a <DefaultUnitAI>UNITAI_SETTLER_SEA and a <SpecialCargo>NONE: I was wrong, it is in my mod that a Settler is a SPECIALUNIT_PEOPLE, not in BtS!

7) Will have a close look what you have done with the two files you send me. Using Notepad++: Using Notepad++ as well. The remaining differences could be problematic, so it's interesting for you to test them one by one with the two WB files. Although sometimes it's difficult to be sure since you really need 1) to be in a position to train the unit or 2) to see the unit in action to experience a crash.

Keep us informed.
 
Why bother to define a new invisible type if you don't intend any unit to see it.
Just set it like a spy
 
@ platyping: it's OK, some units can see them, they just can't see themselves :crazyeye:

@ zhongguo: quote: "The AI is not allowed anymore to build cities although it would be nice to give them the right to".

This looked problematic for me, your Barbarian Praetorian-Settler. In BtS, Barbarians are not allowed to have Settlers but they build cities anyway. In my mod, I've allowed them Settlers but have never seen one actually, only captured ones (my mod: capture a Settler = a Settler) and it doesn't make a difference. Just some thoughts.
 
"The AI is not allowed anymore to build cities although it would be nice to give them the right to"
To avoid confusion, I mean the Barbarians can't build (because of EraInfos) and the normal AI still can.

@platyping: The hidden unit is the only unit in the game cabable of pillaging. Not having any counter-unit would be quite dramatic ;)

Today I checked the other new implemention, the previous mentioned Traveller who can be detected by military units. He has cargo space for six Mercenaries (Praetorians :scan: ). The Traveller and the Mercenaries appear to every other nation as barbaric, hostile, so you can use them to attack without declaring war (Privateer like). Thought it would be an interesting game aspect for multiplayer when you have no damn idea who is attacking you there.
Well, back to the test. This Traveller found a pretty undefended city so the Mercenaries had been unloaded and prepared themselve for a bloody city rush. But when they marched towards it, nobody defended the city. I could just enter it without harm, even heal inside. When one of my units left the city they got attacked, but when inside nothing happened. How strange is that?
 
Because there are invisible defenders who cannot defend since you cannot see them.
Just like stealth destroyers or subs.
Moving a battleship into a plot occupied by a stealth destroyer will not trigger a battle since you cannot see it.
So moving a unit into a city heavily defended by invisible defenders is as good as no defenders.
They didn't bother to attack you when you approach probably because they aren't there yet or unit ai given.
 
I am the bad guy using invisible units trying to attack a city. But I gave all military units the power to see these units. So outside a city they attack me but why can I enter a defended city without fight?

EDIT: Wrong wrong, it is even more strange because these Mercenaries aren't invisible at all. Just appear barbarian to any other nation. <bRivalTerritory>1</bRivalTerritory>
<bHiddenNationality>1</bHiddenNationality>
<bAlwaysHostile>1</bAlwaysHostile>

But still, why they can enter a city without a fight? Maybe because of open borders? Will check that tomorrow. Midnight here now
 
Solution: If you are not in war with the other nation you can enter the city without a fight. Doesn't matter if open borders or not.
 
Back
Top Bottom