Difference between revisions of "Talk:Managing the Item Limit"

From UFOpaedia
Jump to navigation Jump to search
m
Line 18: Line 18:
  
 
[[User:Zaimoni|Zaimoni]] 13:27, 20 January 2007 (CST)
 
[[User:Zaimoni|Zaimoni]] 13:27, 20 January 2007 (CST)
 +
 +
----
 +
 +
Some of the arrays do seem to vary in size - The map being one of them, by memory. However, the game simply overwrites the contents of each file with each new save, so the only time a file size changes is if it needs to be extended.
 +
 +
As for the 64K limit, none of the save files come close. The item table is a constant 170 records of 16 bytes each (2720 bytes total). Even the largest map file I've ever seen is only 40K.
 +
 +
In order to extend this, a number of things would need to be done:
 +
 +
- Find out where the array size is defined. My bet is there is a single location in both the geoscape and the tactical engines. Tactical uses it for battle, geoscape uses it for working out what items have been recovered at end of combat.
 +
 +
- Find the bit that deals with the save files (again, in both the geoscape and tactical engines) and force them to read/write the updated amount of data.
 +
 +
- Find the bit that limits your item count to 80 and extend it. This is only in the geoscape engine.
 +
 +
On the other hand...
 +
 +
What are the limits for alien gear? What's the largest amount of kit they've been known to bring into battle? They typically bring a max of four objects per unit, typically three (again, by memory). I don't think raising the 80 item limit alone is going to flood the item table, so it may just be that the third item on my list is the only one that needs tweaking.
 +
 +
- [[User:Bomb Bloke|Bomb Bloke]] 20:42, 20 January 2007 (PST)

Revision as of 04:42, 21 January 2007

Does anyone know if modding the .exe to raise the 80-item limit is feasible? The 80-item limit is the most "dated" thing about the game... that, and the limit on alien containment capacity.


It's not possible as of now. (We do not know the location of this limit). Even if we could "up" the limit for X-COM agents, it would cut into the aliens item limit and some alien units would probably get "shorted" on weapons since there are only so many items which can be placed on the battlescape map. A real pickle this is, but a necessary evil. --Zombie 19:53, 19 January 2007 (PST)


Well, I should have said, raise the overall limit as well... since memory isn't an issue now. Eric 10:30, 20 January 2007 (PST)


Memory is always an issue in 16-bit DOS binaries. It is not possible for a single DOS pointer, in 16-bit mode, to address more than 64K of memory.

The simplest way to implement the savefile format is that each file corresponds to one array of C structs. PROJECT.DAT is the exception, but even that may be a single C struct internally. Then each file in the savefile is simply dumping/loading the array using the relevant functions from stdio.h...very fast, somewhat clean.

Good programming practice would be to either dynamically allocate the relevant arrays on tactical/battlescape start, or statically allocate them. Since none of the save files vary in length or have explicit record counts, I'd conjecture that the intended sizes of the arrays are compile-time constants, either #define'd or (for statically allocated arrays) computed using the sizeof(array)/sizeof(array_element) paradigm.

Note that there is a total limit of 64K on static data in all 16-bit DOS memory models. So the larger save files (e.g, map.dat and soldier.dat) have to be dynamically allocated.

In any case, there is plausibly no single "location" for these limits -- such a mod would have to not only locate and adjust the storage (and all later storage, in the case of statically allocated array), but also locate and adjust the compile-time constants everywhere they were used.

Zaimoni 13:27, 20 January 2007 (CST)


Some of the arrays do seem to vary in size - The map being one of them, by memory. However, the game simply overwrites the contents of each file with each new save, so the only time a file size changes is if it needs to be extended.

As for the 64K limit, none of the save files come close. The item table is a constant 170 records of 16 bytes each (2720 bytes total). Even the largest map file I've ever seen is only 40K.

In order to extend this, a number of things would need to be done:

- Find out where the array size is defined. My bet is there is a single location in both the geoscape and the tactical engines. Tactical uses it for battle, geoscape uses it for working out what items have been recovered at end of combat.

- Find the bit that deals with the save files (again, in both the geoscape and tactical engines) and force them to read/write the updated amount of data.

- Find the bit that limits your item count to 80 and extend it. This is only in the geoscape engine.

On the other hand...

What are the limits for alien gear? What's the largest amount of kit they've been known to bring into battle? They typically bring a max of four objects per unit, typically three (again, by memory). I don't think raising the 80 item limit alone is going to flood the item table, so it may just be that the third item on my list is the only one that needs tweaking.

- Bomb Bloke 20:42, 20 January 2007 (PST)