Page 1 of 1

Game crashes every 12 turns because of continental blockade event

Posted: Mon Sep 11, 2023 7:24 pm
by agsu
I don't know if this is a known problem, but at least in my game, playing the grand campaign august scenario as the French, once the continental system event has taken place, and the success / failure check events start triggering, it causes the game to crash every time.

Specifically the event evt_nam_GBR_ContinentalBlockadeFailure_Check crashes while evaluating the following line:

Code: Select all

EvalStrucCount = $SmuggleArea_Coastal;FriendAndSelf;STRUCFAM $sfmHarbor;>=;0


Error message given (essentially a null pointer error):

18.16.01 [Critical ] TScriptEngine.Parse Exception caught: Violation d'accès à l'adresse 0082BFF7 dans le module 'NGC.exe'. Lecture de l'adresse 0000022C while parsing line 42371 : EvalStrucCount


The game can be continued after the crash, because everything is saved correctly, but the events / scripts following that one do not get completed. Any ideas what might be causing this?

Re: Game crashes every 12 turns because of continental blockade event

Posted: Wed Sep 13, 2023 1:05 pm
by Nikel
Do you manage with the code?

In the links below the relevant commands are explained, just in case:

https://www.leqg.org/doc/age/www.ageod. ... Count.html

https://www.leqg.org/doc/age/www.ageod. ... Struc.html


Should it be STRUCKIND $stuHarbor instead of STRUCFAM $sfmHarbor?

Re: Game crashes every 12 turns because of continental blockade event

Posted: Wed Sep 13, 2023 4:40 pm
by agsu
That is the original event script in the game, update 1.03, I have not modified it at all. I would be surprised if it is incorrect, and would have expected that someone had noticed it already. Also, in the script report log file, the last line is:

Line 42371: EvalStrucCount Registry 1 used, adding 125 to it, for an end value of 125


Which would indicate that it gets a correct result, or atleast a result, so not a problem in script syntax. It just crashes the game :)

I know this game is not really maintained any more, and the bug is unlikely to be fixed, but was wondering if someone had ran in to this problem, and found a workaround.

Re: Game crashes every 12 turns because of continental blockade event

Posted: Thu Sep 14, 2023 1:13 pm
by Nikel
If the code is right, the crash could be random.

2 workarounds that could work in your case posted by Pocus himself.

viewtopic.php?f=374&t=43539


By the way, perhaps you noticed a delay in your posts, it is an antispam feature, I think you need at least 5 post to do it normally.

Re: Game crashes every 12 turns because of continental blockade event

Posted: Thu Sep 14, 2023 6:22 pm
by agsu
Yeah unfortunately it is not random. I tried adding a custom event that has just that specific line of code to a smaller scenario, to test if it was something specific to my save, and no, it crashes there as well.

At least I can continue the game. Maybe I will simply move the event that causes the issue to the end of the scripts file, so that the crash does not stop the rest of the events from firing.

Appreciate the help though :hat:

Re: Game crashes every 12 turns because of continental blockade event

Posted: Fri Sep 15, 2023 1:45 am
by Bohémond
The EvalStrucCount ScriptCommand is not working for WON/WSS.
It generates a error when used in events.

Are you playing with LogError ON ? If so try to set it off.

You can also set the event occurences to 0 to solve the issue.

Let me know if you need guidance.

Regards

Re: Game crashes every 12 turns because of continental blockade event

Posted: Fri Sep 15, 2023 8:34 am
by agsu
Bohémond wrote:The EvalStrucCount ScriptCommand is not working for WON/WSS.
It generates a error when used in events.

Are you playing with LogError ON ? If so try to set it off.

You can also set the event occurences to 0 to solve the issue.

Let me know if you need guidance.

Regards


Not playing with errors on. And yeah, I figured that it was broken. Disabling the event of course fixes the crashing, but also means that the continental blockade related events and their effects on VP, morale, money and regional decisions won't work.

Re: Game crashes every 12 turns because of continental blockade event

Posted: Fri Sep 15, 2023 9:14 am
by Nikel
Thanks Bohemond. Searched the databases.

It is used 2 times in WoN databases, both in the continental blockade.

And 1 in WSS, shipyards events.

Re: Game crashes every 12 turns because of continental blockade event

Posted: Sat Sep 16, 2023 11:39 am
by agsu
FYI, I managed to patch the executable so that it does not crash the game, and EvalStrucCount works correctly. You just need to change five bytes in the executable with a hex editor. Starting at 0x002D09D9 replace the next five bytes with 90 90 90 90 90.

Alternatively, if that sounds too complicated, you can just download my patched executable: https://www.dropbox.com/scl/fi/av5o67cn ... 5r14w&dl=0

If you want the continental blockade events to show correctly, you also need to add the following lines to your LocalStrings csv-file:

Code: Select all

evt_nam_GBR_ContinentalBlockadeFailure_Check;Continental Blockade Not Successful;;;;;;;;
evt_nam_FRA_ContinentalBlockadeSucess_Check;Continental Blockade Successful;;;;;;;;
evt_txt_GBR_ContinentalBlockadeFailure_Check;This quarter, more ports were free of French Empire or its allies' control than expected, leading to a failure of the Continental Blockade. More trade comes into British coffers and the nation's morale is improving.;;;;;;;;
evt_txt_FRA_ContinentalBlockadeSucess_Check;This quarter, more ports were under French Empire or its allies' control than expected, leading to a success of the Continental Blockade. More confiscated goods are sold and come into French coffers, and the nation's morale is slightly improving.;;;;;;;;


For whatever reason these are missing in the game, altough they are in the database excel files.

If you are curious about what causes the crashes, I believe it is simply to do with logging. The game tries to convert the faction tag to a longer name, and when you use something else, i.e. FACALL, FriendAndSelf etc. it causes a crash. The patch simply stops a call to function which tries to map the faction tag to a longer name.

Re: Game crashes every 12 turns because of continental blockade event

Posted: Sat Sep 16, 2023 6:50 pm
by Nikel
Really did you fix the executable?


Well, then I suppose Ageod code was not problem at all for you :mdr:


Regarding the missing texts, the game was left unfinished and buggy, not sure what was the cause, perhaps poor sales. A pity indeed. Other games had more patches and even more scenarios, but it did not happen with WoN.


Are you able to add a function to an exe?

Re: Game crashes every 12 turns because of continental blockade event

Posted: Sun Sep 17, 2023 10:32 am
by agsu
Nikel wrote:Really did you fix the executable?


Yes :)

Nikel wrote:Regarding the missing texts, the game was left unfinished and buggy, not sure what was the cause, perhaps poor sales. A pity indeed. Other games had more patches and even more scenarios, but it did not happen with WoN.


Yeah, a bit sad. And maybe a bit of a mistake on my part trying this one for my firs AGEod game.

Nikel wrote:Are you able to add a function to an exe?


Technically this might be possible, but practically, at least for me, too difficult.

Re: Game crashes every 12 turns because of continental blockade event

Posted: Sun Sep 17, 2023 8:03 pm
by Nikel
You know a lot for your first Ageod game :)

May you post a save where the bug you fixed is shown?

In fact if the Continental blockade is broken, the game is broken, been one of the more important events, if not the most in the Napoleonic wars, for this reason N invaded Portugal (and so was entangled in the Iberian Peninsula) and Russia.


Regarding the function or bug, I was referring to this one, displayed in this case in EAW, assuming it is also present in WoN.


viewtopic.php?f=364&t=53985&p=407801#p407801

Re: Game crashes every 12 turns because of continental blockade event

Posted: Sun Sep 17, 2023 8:36 pm
by Aqua-Something
agsu wrote:FYI, I managed to patch the executable so that it does not crash the game, and EvalStrucCount works correctly. You just need to change five bytes in the executable with a hex editor. Starting at 0x002D09D9 replace the next five bytes with 90 90 90 90 90.

Alternatively, if that sounds too complicated, you can just download my patched executable: https://www.dropbox.com/scl/fi/av5o67cn ... 5r14w&dl=0

If you want the continental blockade events to show correctly, you also need to add the following lines to your LocalStrings csv-file:

Code: Select all

evt_nam_GBR_ContinentalBlockadeFailure_Check;Continental Blockade Not Successful;;;;;;;;
evt_nam_FRA_ContinentalBlockadeSucess_Check;Continental Blockade Successful;;;;;;;;
evt_txt_GBR_ContinentalBlockadeFailure_Check;This quarter, more ports were free of French Empire or its allies' control than expected, leading to a failure of the Continental Blockade. More trade comes into British coffers and the nation's morale is improving.;;;;;;;;
evt_txt_FRA_ContinentalBlockadeSucess_Check;This quarter, more ports were under French Empire or its allies' control than expected, leading to a success of the Continental Blockade. More confiscated goods are sold and come into French coffers, and the nation's morale is slightly improving.;;;;;;;;


For whatever reason these are missing in the game, altough they are in the database excel files.

If you are curious about what causes the crashes, I believe it is simply to do with logging. The game tries to convert the faction tag to a longer name, and when you use something else, i.e. FACALL, FriendAndSelf etc. it causes a crash. The patch simply stops a call to function which tries to map the faction tag to a longer name.


Hey agsu, thanks a lot for your work! I'm currently trying to replicate your fix for use in an ongoing PBEM game (blockade events should kick off soon).

I was able to modify the executable like you mentioned, but I'm not sure exactly where to input the lines in the LocalStrings file since I don't have the database file. Is there a public database somewhere with WON files?

Re: Game crashes every 12 turns because of continental blockade event

Posted: Sun Sep 17, 2023 9:44 pm
by Nikel
The ftp link to download the databases for WoN and other Ageod games. Only The games developed by HQs are missing (España 1936, Thirty Years War and the English Civil War).

But just noticed that the last beta patch for WoN was from February 2017 and the database files are from 2016, so they are not the last version?

http://ftp.ageod.com/pub/DB/

Re: Game crashes every 12 turns because of continental blockade event

Posted: Mon Sep 18, 2023 8:04 am
by agsu
Aqua-Something wrote:I was able to modify the executable like you mentioned, but I'm not sure exactly where to input the lines in the LocalStrings file since I don't have the database file. Is there a public database somewhere with WON files?


You can just open the LocalStrings_NGC.csv in Settings folder with notepad, and add those lines to the end of the file.

Re: Game crashes every 12 turns because of continental blockade event

Posted: Fri Oct 20, 2023 9:36 pm
by wrlertola
Hi agsu,

Thanks for your work on this.
I tried the dropbox link but it seems the file has been deleted.
Could you please repost it or post it here on the forum?

Thank you!
Will

Re: Game crashes every 12 turns because of continental blockade event

Posted: Fri Oct 20, 2023 9:49 pm
by Nikel
Here is agsu file, credits to him.

Remember to backup the original first.

Re: Game crashes every 12 turns because of continental blockade event

Posted: Sat Oct 21, 2023 3:15 am
by wrlertola
Amazing!

Thank you once again. :-)
Agsu steps up aaaaaaaaaaaaand knocks it out of the park! :D

Re: Game crashes every 12 turns because of continental blockade event

Posted: Mon Nov 06, 2023 1:10 pm
by andrzej
agsu wrote:FYI, I managed to patch the executable so that it does not crash the game, and EvalStrucCount works correctly. You just need to change five bytes in the executable with a hex editor. Starting at 0x002D09D9 replace the next five bytes with 90 90 90 90 90.

Thank you for this fix, I added it to my game.
I myself am trying a little to fix and modernize Ageod exe files, but my knowledge is limited - I can only change the values of individual bytes of code so far. . How well do you understand the code? Do you know how to change and transfer commands in the EXE code? Do you know how to work with the IDA Pro program (and similar ones) for decoding and reverse exe?