Combat stack limit

General Modding Information/Questions; support/discussion/questions

Moderator: thunderchero

Forum rules
:idea: Please search before starting new topic. :idea:
There is a good chance it has already been asked.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Combat stack limit

Post by thunderchero »

thunderchero wrote: Wed May 27, 2020 11:01 pm I took out the Klingons all empires gave up but I wanted to go after the Ferengi fleet, I got a new crash log on that combat. :shock:

Version Under Test: 72
File: stack.c, Line: 69, stack->bottom != NULL
Initialize State: 31
Player Empire: 4 Starting Seed: 1590353800
Galaxy shape: 2 Galaxy Size: 2
Turn State: 20
Turn Number: 194

I had 408 ships and Ferengi had 379 ships
As soon as I hit fight it crashed, auto combat I killed them all with very few loses. :shock:

Image

I wonder if there is any way to increase stack limit

note; after several tests 711 ships (total) will go into combat, but 712 will crash every time
I will ask again any way to increase stack limit?
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1926
Joined: Sun Apr 27, 2008 2:00 am

Re: Combat stack limit

Post by Spocks-cuddly-tribble »

thunderchero wrote: Sun Nov 13, 2022 10:26 pmFile: stack.c, Line: 69, stack->bottom != NULL

As soon as I hit fight it crashed, auto combat I killed them all with very few loses. :shock:

note; after several tests 711 ships (total) will go into combat, but 712 will crash every time

I will ask again any way to increase stack limit?
I still don't see any limit (no esp stacks as in palette + word register big enough for index), but it's the same code area responsible for the texture limit.

It shouldn't be number of ships but a bug with the total sfx slot index (5 + number of phaser shots per ship/station/monster).
So you might try to reduce phaser shots in shiplist.sst for some ships and test again for verification.

And for the love of god could you please un-hide all those dev topics (many e.g. 'keep main intel after conquest'). Who the hell wants to hide this stuff?
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Combat stack limit

Post by thunderchero »

Spocks-cuddly-tribble wrote: Mon Nov 14, 2022 4:55 pm It shouldn't be number of ships but a bug with the total sfx slot index (5 + number of phaser shots per ship/station/monster).
So you might try to reduce phaser shots in shiplist.sst for some ships and test again for verification.
that did allow combat to complete, any way to say double stack limit?
Spocks-cuddly-tribble wrote: Mon Nov 14, 2022 4:55 pm And for the love of god could you please un-hide all those dev topics (many e.g. 'keep main intel after conquest'). Who the hell wants to hide this stuff?
I don't know of any hidden topics, you have me confused
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1926
Joined: Sun Apr 27, 2008 2:00 am

Re: Combat stack limit

Post by Spocks-cuddly-tribble »

thunderchero wrote: Mon Nov 14, 2022 5:45 pmany way to say double stack limit?
No stack limit other than your system RAM & HD (SmartHeap grabs this via OS).
The error comes from an object index overflow (each ship/station/monster +5 + number of phaser + torpedo shots).
In theory 1000 ships with 25 phaser shots + 20 torpedo shots each: 1000 * (5+25+20=50) = 50000 max Objects to Render < 65535 word
But ItemDB.handleIndexSize doubles the object number for two byte object IDs, so max limit 32767 objects to render.

Try this, I hope it works for up to 65535 objects:

Code: Select all

NAME: Tactical Combat max Objects to Render ItemDB IndexSize Workaround

>> 0x00130244 66 a3 74 2b 60 00
>> 0x0013025c 72
>> 0x00130264 c1 f9 10
>> 0x00130285 72
>> 0x0013028c c1 f8 10
>> 0x00130369 72
>> 0x00130370 c1 f8 10
>> 0x0013041d 66 3b 05 74 2b 60 00 7d 75
>> 0x00130df4 66 3b 0d 74 2b 60 00 7d 3d
>> 0x00130ef8 66 3b 0d 74 2b 60 00 7d 42

<< 0x00130244 a3 74 2b 60 00 90
<< 0x0013025c 74
<< 0x00130264 90 90 90
<< 0x00130285 74
<< 0x0013028c 90 90 90
<< 0x00130369 74
<< 0x00130370 90 90 90
<< 0x0013041d 90 90 90 90 90 90 90 90 90
<< 0x00130df4 90 90 90 90 90 90 90 90 90
<< 0x00130ef8 90 90 90 90 90 90 90 90 90
► Show Spoiler
thunderchero wrote: Mon Nov 14, 2022 5:45 pmI don't know of any hidden topics
'Hidden' topics = you need to login and/or join certain user groups to open links.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Combat stack limit

Post by thunderchero »

Spocks-cuddly-tribble wrote: Mon Nov 14, 2022 11:09 pm In theory 1000 ships with 25 phaser shots + 20 torpedo shots each: 1000 * (5+25+20=50) = 50000 max Objects to Render < 65535 word

Try this, I hope it works for up to 65535 objects:
game loaded, but had strange map effects ships icons in wrong sector but ships displayed when correct sector selected with no ship icon?

joining player crashed at turn process, host player crashed shortly later.
Spocks-cuddly-tribble wrote: Mon Nov 14, 2022 11:09 pm 'Hidden' topics = you need to login and/or join certain user groups to open links.
did not know we had any other than the 3 hidden sections (staff, modder, Supremacy development)
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1926
Joined: Sun Apr 27, 2008 2:00 am

Re: Combat stack limit

Post by Spocks-cuddly-tribble »

This is a pesky code like the palette limit. With above changes you can try to add/overwrite (but I don't think it will work):

Code: Select all

00530E3C           nop nop

00530E64           add   ecx, ecx

00530E8C           add   eax, eax

00530F70           add   eax, eax
:!: Warning :!: This might allocate more than 4 GB of memory :shock:
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Combat stack limit

Post by thunderchero »

I think for now this should be put on back burner. We really don't need larger battles with the horrible combat turn processing.

and nothing is even getting close.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1926
Joined: Sun Apr 27, 2008 2:00 am

Re: Combat stack limit

Post by Spocks-cuddly-tribble »

thunderchero wrote: Tue Nov 15, 2022 5:19 pmI think for now this should be put on back burner. We really don't need larger battles with the horrible combat turn processing.
Yes, same as palette limit.

Just for the lulz I tested this patch with promising results (faster):

Code: Select all

NAME: Tactical Combat Excessive Memory Usage Fix

>> 0x00130291 0f af d8
<< 0x00130291 03 d8 90

#00530E91     03D8           ADD EBX,EAX
#00530E93     90             NOP
In event of issues we can increase memory with:

Code: Select all

00530E91     8D1C58         LEA EBX, [EAX+EBX*2]

I noticed vanilla 'playback mode' display error when fighting more than one battle (message text not removed). Not related to this patch. :wink:
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Combat stack limit

Post by thunderchero »

Spocks-cuddly-tribble wrote: Tue Nov 15, 2022 7:14 pm Just for the lulz I tested this patch with promising results (faster):

Code: Select all

NAME: Tactical Combat Excessive Memory Usage Fix

>> 0x00130291 0f af d8
<< 0x00130291 03 d8 90

#00530E91     03D8           ADD EBX,EAX
#00530E93     90             NOP
In event of issues we can increase memory with:

Code: Select all

00530E91     8D1C58         LEA EBX, [EAX+EBX*2]
Ok you have me intrigued, is this only code change needed?
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1926
Joined: Sun Apr 27, 2008 2:00 am

Re: Combat stack limit

Post by Spocks-cuddly-tribble »

thunderchero wrote: Tue Nov 15, 2022 8:10 pmis this only code change needed?
Yes, but note very limited testing on my part!

Also I would avoid F-11 cheat when testing since Flocke said it creates extra tac files in combat (IIRC?), so more slowdown?

If it works for you there is a 'small' chance a combo with one of the above codes might solve render objects index overflow issue for memory allocation.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Combat stack limit

Post by thunderchero »

Spocks-cuddly-tribble wrote: Tue Nov 15, 2022 8:22 pm If it works for you there is a 'small' chance a combo with one of the above codes might solve render objects index overflow issue for memory allocation.
with all above patches any combo I get new crash log
Tactical Combat max Objects to Render ItemDB IndexSize Workaround
add/overwrite
Tactical Combat Excessive Memory Usage Fix *2

Code: Select all

Version Under Test: 72
File: i3ddb.cpp, Line: 402, handle >= 0
Initialize State: 31
Player Empire: 0	Starting Seed: 1666574975
Galaxy shape: 0	Galaxy Size: 2
Turn State: 20
Turn Number: 282
no patch alone will get this log
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1926
Joined: Sun Apr 27, 2008 2:00 am

Re: Combat stack limit

Post by Spocks-cuddly-tribble »

thunderchero wrote: Tue Nov 15, 2022 10:33 pmFile: i3ddb.cpp, Line: 402, handle >= 0
This is a redundant error check if more than 32767 objects (confirms my analysis).
thunderchero wrote: Tue Nov 15, 2022 10:33 pmno patch alone will get this log
Does this mean above limit (712 ships for you), only with memory patch?

We need to know: Only with memory fix, but below limit (711 ships for you) will this work with no issues?

If yes, then we can double the limit by removing/fixing unneeded error checks (I missed some of them).

Plus there is hope to optimize AI combat lag code (easier than AI turn lag code).
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Combat stack limit

Post by thunderchero »

Spocks-cuddly-tribble wrote: Tue Nov 15, 2022 11:48 pm
thunderchero wrote: Tue Nov 15, 2022 10:33 pmFile: i3ddb.cpp, Line: 402, handle >= 0
This is a redundant error check if more than 32767 objects (confirms my analysis).
thunderchero wrote: Tue Nov 15, 2022 10:33 pmno patch alone will get this log
Does this mean above limit (712 ships for you), only with memory patch?

We need to know: Only with memory fix, but below limit (711 ships for you) will this work with no issues?

If yes, then we can double the limit by removing/fixing unneeded error checks (I missed some of them).

Plus there is hope to optimize AI combat lag code (easier than AI turn lag code).
with all combos of patches it crashes when above stack limit. just getting different crash logs

the way I look at patches is there are 2 patch each patch has deviation.

Tactical Combat max Objects to Render ItemDB IndexSize Workaround
Tactical Combat max Objects to Render ItemDB IndexSize Workaround W add/overwrite

Tactical Combat Excessive Memory Usage Fix
Tactical Combat Excessive Memory Usage Fix w *2

applying any of the 4 patches alone will get stack
applying 1 of each together gets i3ddb.cpp

that was hard to explain for some reason :???:

edit;
so far in new game on MUM I have Tactical Combat Excessive Memory Usage Fix and had only a couple small combats but no issues so far.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1926
Joined: Sun Apr 27, 2008 2:00 am

Re: Combat stack limit

Post by Spocks-cuddly-tribble »

Your big battle could answer few important questions. :arrow: use max 711 ships to allow tactical combat :!: -> save new slot for prepared OK combat tests

- any changes with 'Tactical Combat Excessive Memory Usage Fix' only (issues/faster)?

- greater lag with 'AI solo commands' patch (expect small random deviations)? viewtopic.php?p=52751#p52751

- automatic battle (no 3D combat) uses the same code for AI commands -> lag with your fleet? (it would appear as part of map turn lag :idea: )

EDIT: You can disable AI map code to skip turn processing before combat tests: viewtopic.php?p=47530#p47530 :wink:
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7933
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Combat stack limit

Post by thunderchero »

Spocks-cuddly-tribble wrote: Wed Nov 16, 2022 2:38 pm Your big battle could answer few important questions. :arrow: use max 711 ships to allow tactical combat :!: -> save new slot for prepared OK combat tests
in current test it is less than 600 ships = fail
I was able to do combat if I lowered how many phasers each ship has.
Spocks-cuddly-tribble wrote: Wed Nov 16, 2022 2:38 pm - any changes with 'Tactical Combat Excessive Memory Usage Fix' only (issues/faster)?
no issues so far, as for if it is faster is hard to tell since no large combat yet (I only have 50 heavy cruisers)
but last 36 vs 45 went very quick. :wink:
Post Reply

Return to “General Modding Information/Questions”