Page 1 of 1

Make stack_size writeable

Posted: Fri Nov 17, 2017 8:18 pm
by napu
Would it be possible to make the stack_size property on item_prototype a writeable property?
I could really use this in a mod I'm currently working on.

Re: Make stack_size writeable

Posted: Fri Nov 17, 2017 9:02 pm
by Rseding91
That's not likely to happen. If any property can be changed runtime it has to be saved in the save file regardless of it being used.

Re: Make stack_size writeable

Posted: Fri Nov 17, 2017 9:08 pm
by DaveMcW
Could you save only the differences compared to the data stage? That would only increase the size of saves that modify the property.

Re: Make stack_size writeable

Posted: Fri Nov 17, 2017 9:10 pm
by Rseding91
DaveMcW wrote:Could you save only the differences compared to the data stage? That would only increase the size of saves that modify the property.
When loading the game it has to know what to load from the input stream and the only way to do that is to always have something there. That means you can't conditionally save something unless something else signals it being conditionally saved.

Re: Make stack_size writeable

Posted: Fri Nov 17, 2017 9:25 pm
by DaveMcW
So include an array of stack_size_diferences in every save. It can be empty.

Re: Make stack_size writeable

Posted: Sat Nov 18, 2017 6:16 am
by napu
Rseding91 wrote:That's not likely to happen. If any property can be changed runtime it has to be saved in the save file regardless of it being used.
So you're currently not saving any data of the prototypes in the savegame files as is? Because a single property shouldn't change savegame filesize by much.


DaveMcW wrote:So include an array of stack_size_diferences in every save. It can be empty.
I think this would be a possibility.

Re: Make stack_size writeable

Posted: Sat Nov 18, 2017 3:25 pm
by Nexela
I can't be bothered to look up the max size of an item stack so we will assume 32bit...

4 bytes * 1,000,00 items = 4 megabytes of storage.
Add in peoples obsession with warehouses and
768 slots * 200 ore each slot = 1.5 additional megabytes PER angels warehouse.

That is a lot of data for something that can be stored in the item prototype at just 4 bytes per item TYPE. And changing the stack size of any item type can be done on an existing map with a mod it just requires a game reload to take effect.

Re: Make stack_size writeable

Posted: Sat Nov 18, 2017 3:41 pm
by napu
But what if one wants to make a research to increase stack sizes?

It wouldn't matter, if you just want a static stack size, there are loads of mods out there that change the stack size, but it would be cool if it was possible to change it runtime.

Re: Make stack_size writeable

Posted: Sun Nov 19, 2017 2:58 am
by Nexela
A technology modifier for stack size might be feasible , It would have drawbacks that it would affect the stack size of everything though.

Re: Make stack_size writeable

Posted: Sun Nov 19, 2017 6:37 am
by napu
I would go for DaveMcW's method instead and use an array.

That way it would be possible to create researches for just some items or even single items.