Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: fightermedic on January 20, 2014, 04:08:42 pm

Title: 250 ship limit
Post by: fightermedic on January 20, 2014, 04:08:42 pm
i've run into the 250 ship limit with my mod
is there a way to raise it for mods themselfs, or is this strictly limited by the engine itself?
if so, could it be raised? 250 is way too low for the kind of mod i'm trying to make, with all sorts of different variants of ships, lots of asteroids etc...  :(
Title: Re: 250 ship limit
Post by: General Battuta on January 20, 2014, 04:09:48 pm
Wowzers.
Title: Re: 250 ship limit
Post by: niffiwan on January 20, 2014, 04:12:24 pm
Wowzers indeed.

It's hardcoded into the engine, so no, mods cannot change the limit themselves (see inferno builds, and the reason they were originally created)
Title: Re: 250 ship limit
Post by: An4ximandros on January 20, 2014, 04:19:25 pm
i've run into the 250 ship limit with my mod
:wtf:

That must be a lot of props! If you have lots of asteroids, maybe you can combine them into "ship-roids" that are invisible and have the smaller ones as destroyable subsystems (whose complete destruction kills the "controller"?

At this stage the only way to have more ships that I can see is to cheat the engine.
Title: Re: 250 ship limit
Post by: General Battuta on January 20, 2014, 04:21:34 pm
The problem he's facing isn't concurrent ships in a mission, but total number of ship classes in his table files.
Title: Re: 250 ship limit
Post by: mjn.mixael on January 20, 2014, 05:47:11 pm
I'm no SCP leader.. but given the history, I suspect this is not a limit that is going to be bumped very easily. But who knows...

I haven't heard of that limit being hit in quite a long time.
Title: Re: 250 ship limit
Post by: Dragon on January 20, 2014, 06:11:49 pm
I've been an advocate of getting rid of the darn thing for long. It did cause pilot file issues, though, so it was never accepted. However, with the new pilot code, maybe it could be either removed or bumped to, say, one million or some other ridiculous value.
Title: Re: 250 ship limit
Post by: fightermedic on January 20, 2014, 06:17:51 pm
it all depends on how it is structured in the engine
if we are talking about an array with a fixed size that is used all throughout the engine this might be difficult to change, i'm aware of it
but if it's an easy change i'm very much in favor of raising it, as i can't ever see me get below 250 ships and still have everything i want :(
Title: Re: 250 ship limit
Post by: AdmiralRalwood on January 20, 2014, 10:09:28 pm
it all depends on how it is structured in the engine
if we are talking about an array with a fixed size that is used all throughout the engine this might be difficult to change, i'm aware of it
but if it's an easy change i'm very much in favor of raising it, as i can't ever see me get below 250 ships and still have everything i want :(
Exactly how are your ship classes distributed, that you're reaching the limit? Do you have, like, 100 different kinds of asteroids or something?
Title: Re: 250 ship limit
Post by: niffiwan on January 20, 2014, 11:03:02 pm
if we are talking about an array with a fixed size that is used all throughout the engine

Yeah - I'm pretty sure it's like this.
Title: Re: 250 ship limit
Post by: Kopachris on January 20, 2014, 11:33:03 pm
if we are talking about an array with a fixed size that is used all throughout the engine

Yeah - I'm pretty sure it's like this.

More specifically, it's in globals.h, line 48:
Code: [Select]
#define MAX_SHIP_CLASSES 250
And then that number is used all over the code for fixed-length arrays, for-loops, memory management, etc., not just one array.
Title: Re: 250 ship limit
Post by: Goober5000 on January 21, 2014, 10:18:46 am
The main reason that ship classes couldn't be bumped for so long was because the pilot code would have been broken.  But now that the pilot code has been upgraded, bumping the limit may be possible.

Of course, there are still a few loose ends with the pilot code that should be fixed before this is looked at.
Title: Re: 250 ship limit
Post by: m!m on January 21, 2014, 10:55:35 am
We should consider using a std::vector instead of just increasing the size of the array. After loading it would behave just like an array, we would only have to make sure that there are no problems when we are parsing the table.
Title: Re: 250 ship limit
Post by: The Dagger on January 21, 2014, 12:22:36 pm
If you have different variants of a same ship, can't you use submodels for the variable part of the ship and destroy the ones not needed at mission start, keeping only the one you need for the specific case at hand? Take this comment with a big quantity of salt though, since I don't know anything about FRED though...
Title: Re: 250 ship limit
Post by: Goober5000 on January 21, 2014, 01:37:00 pm
We should consider using a std::vector instead of just increasing the size of the array. After loading it would behave just like an array, we would only have to make sure that there are no problems when we are parsing the table.

A vector isn't without its own problems.  The ship_info class doesn't have a copy constructor (one of the reasons why ship templates don't work), so that would have to be coded first.
Title: Re: 250 ship limit
Post by: m!m on January 21, 2014, 01:43:43 pm
I'm not saying that switching to a vector is without problems but if we continue to bump the limit we may consider using a vector as that will both decrease our memory usage (although that's only marginal considering how much we need for model, etc.) and it will be compatible with any number of ship classes.
Title: Re: 250 ship limit
Post by: Goober5000 on January 21, 2014, 01:50:10 pm
Yeah, I agree with that, I'm just pointing out that it's not a one-step operation.  Other parsed objects (such as message personas) have been successfully converted to SCP_vector.
Title: Re: 250 ship limit
Post by: karajorma on January 21, 2014, 10:10:34 pm
The main reason that ship classes couldn't be bumped for so long was because the pilot code would have been broken.  But now that the pilot code has been upgraded, bumping the limit may be possible.

There's a reasonable chance of breaking Multiplayer too. The fix I added previously should continue to work if you use a vector but it's possible there are other places it might break. That said, we should hopefully be able to fix any new breakages in the same way.
Title: Re: 250 ship limit
Post by: Aardwolf on January 23, 2014, 01:53:15 pm
250 sounds like "almost a byte, but make it a multiple of 50" to me?
Title: Re: 250 ship limit
Post by: The E on January 23, 2014, 02:49:41 pm
250 is an arbitrarily chosen number based on the assumption that mods which needed that many slots would be really rare.
Title: Re: 250 ship limit
Post by: Aardwolf on January 23, 2014, 04:40:23 pm
But wasn't it already bumped once from the retail value?
Title: Re: 250 ship limit
Post by: niffiwan on January 23, 2014, 05:40:33 pm
But wasn't it already bumped once from the retail value?

yeah - Inferno builds (http://www.hard-light.net/wiki/index.php/Engine_limitations) (now standard of course)
Title: Re: 250 ship limit
Post by: fightermedic on January 25, 2014, 07:20:16 am
if so, wouldn't that suggest that the change is rather painless?
Title: Re: 250 ship limit
Post by: m!m on January 25, 2014, 07:25:05 am
Not really, Inferno builds were incompatible mainly because the pilot files were not compatible with standard builds but there were also issues with the multiplayer code which may break if we increase the maximum number of ships.
The new pilot code should be able to handle a bumped limit but other parts of the code could be affected and this would need some effort to get right.
Title: Re: 250 ship limit
Post by: asyikarea51 on January 25, 2014, 07:45:05 am
I forgot, but ship templates counted to the limit too... do they still? :banghead:
Title: Re: 250 ship limit
Post by: Goober5000 on January 25, 2014, 08:10:34 pm
Ship templates don't work, and they aren't even functional in the code right now anyway.  So you can just remove them if you need a few more slots.