ACC: Too many map Variables

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Project Shadowcat
Posts: 9369
Joined: Thu Jul 14, 2005 8:33 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: Blacksburg, SC USA
Contact:

Re: ACC: Too many map Variables

Post by Project Shadowcat »

Code: Select all

// Was 64
#define MAX_WORLD_VARIABLES 256
// [RH] New
#define MAX_GLOBAL_VARIABLES 64
What is the difference between World variables and Global variables?
skadoomer
Posts: 1026
Joined: Fri Sep 05, 2003 12:49 pm

Re: ACC: Too many map Variables

Post by skadoomer »

randy wrote:Are there any places where you could substitute arrays in place of multiple variables? There is no limit on the length of an array, so you could pack multiple variables in them and use #define to give them symbolic names so the code is still readable.
Yes and no. To a large degree that has already been done. However, a lot of whats eating up my space is map arrays that contain needed information, like hud positions of graphics (which i have a lot of, and there really isn't a good working solution to undo this) I have an ACS driven stat screen which requires positions of hot spots to be clicked. In order to make the hot spots active, i need pre-defined coordinates. Doing this in a definition style will make the code much much messier than it already is.

The good news is most of the system is in place for the libraries that are hitting this limit, so the chance that I'm going to expand on the system in question in minimal. Anything causing an overflow from this point on (and yes, there are a few things) are added to the global declaration. I'm on 56 (out of 64?!?), so i still have some wiggle room until i have to start defining stuff on a global scale.

The better news is that this error seems to be encountered basted on variables actually used from the chain of imports. So if i call something from another library, it adds to my limit. Some areas can be sub-divided so their variables only pertain to the areas their needed and not in the general #import file. (this pertains to f_arrays, where most of my array values are stored). By sheer dumb luck, apparently I've been on the verge of this for a while, but haven't been bitten until now.
Actually, nothing has such a large limit.
Wow, apparently I don't have as much freedom as I thought. Good to know what limits I'm up against though. In terms of the max limits, i was confused about max tid and hud id's. Fortunately, I'm nowhere close to hitting the limits on those.
What is the difference between World variables and Global variables?
Scope
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: ACC: Too many map Variables

Post by randi »

That wiki page doesn't seem to explain the difference all that well, so I'll say some more:

World variables are reset to 0 when you switch to a new hub.
Global variables are reset to 0 only when you start a new game.

Other than that, the two types are identical.
User avatar
Project Shadowcat
Posts: 9369
Joined: Thu Jul 14, 2005 8:33 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: Blacksburg, SC USA
Contact:

Re: ACC: Too many map Variables

Post by Project Shadowcat »

Thanks, randy, that's extremely important to know.
Locked

Return to “Editing (Archive)”