forge icon indicating copy to clipboard operation
forge copied to clipboard

Would it be reasonable to allow larger values in `GameEntityCounterTable`?

Open blerg-rush opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. When using a counter-doubling ability (CountersMultiplyEffect), the game hangs when you reach a certain number of counters--which looks like it's around the maximum size of Integer. There's no solution besides forcing the game closed when this happens.

Describe the solution you'd like Would there be other undesirable side effects to using a larger number type for the counter values in a GameEntityCounterTable; like Map<CounterType, Long> instead of Map<CounterType, Integer>?

Describe alternatives you've considered Possibly just setting an arbitrary limit, lower than the Integer limit, to the number of counters on a GameEntityCounterTable.

Additional context GameEntityCounterTable source

blerg-rush avatar Jun 10 '24 00:06 blerg-rush

It isn't just the CounterTable

because the Limit needs to be updated for all functions around too

Hanmac avatar Jun 10 '24 07:06 Hanmac

Of course, there'll be a bit of a ripple effect in type changes, but my question is whether that might functionally cause issues.

blerg-rush avatar Jun 10 '24 12:06 blerg-rush

This issue has not been updated in a while and has now been marked as stale. Stale messages will be auto closed.

github-actions[bot] avatar Jul 11 '24 09:07 github-actions[bot]

I think the moment your counters would overflow over Integer values, it probably wouldn't take that long for them to overflow over Long values too

Hanmac avatar Jul 11 '24 11:07 Hanmac

Someday it'd be nice to allow arbitrarily large numbers but the ripple from that would be very far-reaching. It'd at minimum hit player life, mana pools, power and toughness, any other card effects that look at the aforementioned values, and quantity of tokens created (which is already problematic). And yeah, it wouldn't be enough to go to Long values since that's just kicking the can down the road. BigInts can go as high as you want but I suspect simply swapping them in everywhere would have a substantial impact on performance, and would be very awkward to write code around since they don't use the standard operators.

In the short term, capping it to keep it from causing problems might be a more appropriate solution. If the number of counters (or any other of those number values for that matter) would go past a million or some other high bar, just clamp it there. Less accurate, but avoids the instability and works in most cases.

Jetz72 avatar Jul 11 '24 15:07 Jetz72

This issue has not been updated in a while and has now been marked as stale. Stale messages will be auto closed.

github-actions[bot] avatar Aug 11 '24 09:08 github-actions[bot]