[HARDCODED LIMITATION] Classdef.lua limit?

Is there a limit on the number of classes I can create in classdef.lua? I’m looking at my notes in my HW2 mod and for some reason I wrote that they should not exceed eMaxUserCount, which is equal to 32.

I don’t recall why. I also forgot where eMaxUserCount is located in the game files.


1 Like

near the end, a search turns up this,

sg_maxClasses = eBattleCruiser+1

and it just needed to be adjusted higher, I had a bunch of classdef that I added and never seemed to have an issue (not saying there wasn’t some limit or adverse behavior I didn’t notice)

I found eMaxUserCount in a globals dump I just did. It’s still set to 32.

How many classes are in your mod?

The game crashes with a Access violation error when I raise the number of classes to 35 total.

I think I’m going to throw in the towel trying to get the AI to work with my Defined Roles game rule.

After looking at my original files, it is necessary to extend the sg_maxClasses, but I never exceeded 32 (Which I think gives you 9 additional classes from stock.) Since these classes were referenced in the build lists for the AI and I had a fully custom AI, I had exceptions in the AI files that broke up classdef groups to specific ships and only used classdef to get the major categories. So that explains how I got around the 32 limitation. Typically it was to say that a specific ship was not to be used to fill a slot in the build queues

My AI needs to keep track of everyone on the team. So I have to use PlayersUnitTypeCount() instead of NumSquadrons() in “ai_upgrades.lua”. This function references the classes in “classdef.lua” instead of individual ships.

I wish there was documentation on PlayersUnitTypeCount(), numActiveOfClass(), NumSquadrons(), ShipDemandGet(), and other AI functions. Maybe I could come up with a workaround.


Could you please increase this limit to something larger than 32 in the next patch? Thanks!!

I can’t really promise anything - beyond which that may also be used as a bit-mask, and 32 may be ‘it’ - depending on where/how that is connected to other things.

I guess what I am saying is, don’t hold your breath.