Howto: Get your mods in the game?

Okay, so I made myself a little mod concerning the pirate issue.

Since I don't like replacing game files, I tried using the mods folder.

My folder structure is like this:

\Mods\GameInfo\gameplay.constants

When I load this, it gives me a mod 'GameInfo' to select, loads it, but doesn't load the changes from the file.

So I tried changing the path:

\Mods\SlowPirates\GameInfo\gameplay.constants

This however, crashes the game when enabling the mod.

Do I have to copy the entire GameInfo there? I worked under the impression that contents of the Mods folder would replace their counterparts, while the rest is still read from the original files (like it works e.g. in GalCiv or Spaceempires)
11,712 views 15 replies
Reply #1 Top
I just tried a similar thing to test, except I didn't change ANYTHING about the gameplay.constants file (I opened it, but didn't change anything or even save the file), and copied it to:

C:\Documents and Settings\(my user name)\Local Settings\Application Data\Ironclad Games\Sins of a Solar Empire\Mods\Test\GameInfo\

And then started the game, went to mods, enabled the mod "Test", which resulted in the "Enabled Mod" and the "Enabled Mod Checksum" fields being populated (with "Test", and "15163"), the screen darkening slightly, and the game completely freezing. When I alt-tab out I see a MiniDump screen telling me that it's saved a dmp file.

I then did it again and got the same result.

I reported this to [email protected] and [email protected] (still not sure which one is the right one) with both dmp files attached.
Reply #2 Top
Might want to hold off until we get the modding tutorials and the rest of the tools up, guys :)
Reply #3 Top
Investigating...
Reply #4 Top
Mods to the gameplay.constants work fine if made to the C:\Program Files\Stardock\TotalGaming\Sins of a Solar Empire\GameInfo version (I tested this after testing the above).

But yea, I'll hold off on the modding bug reports until you actually tell us we can mod ;)

Edit: thanks for the replies from SD/IC, these forums are moving pretty fast right now and it's nice to know it wasn't lost in the shuffle. Great product support, as always =)
Reply #5 Top
Hey guys,

There was a bug with this, nice find. It's fixed in the next patch (not too far off).

Also, since there is no info out yet on how to do this - if you want to replace a file in the GameInfo folder, you will have to copy the whole folder as part of your mod, and change the specific file. There is a good reason for this, but it's fairly technical so I will spare you the explanation, unless you want it :P
Reply #6 Top
Actually, yeah, I'd like to hear that explanation. (Software developer myself).

Doesn't this way make it harder to combine mods? If each mod just had to include the replaced files, we could easily mix'n'match...
Reply #7 Top
Hm.

I copied the entire GameInfo folder to

\Mods\SlowPirates\GameInfo

With my modified Gameplay.constants included. It doesn't crash the game anymore, but the changes I made (pirate delays) aren't reflected ingame.

Guess I'll have to wait for the first patch...
Reply #8 Top
Hey, did you remember to enable the mod? Did you remember to change the "first raid" time? It's different than the normal one.

Reply #9 Top
Yes, I changed the 'first raid' time to 90 seconds, in order to see if any changes were accepted. I get the 'mod enabled' checksum, so it should be loaded - the pirate timer doesn't change though.
Reply #10 Top
psugar, thanks for helping us out despite our "jumping the gun" ;)

Copying the entire GameInfo folder to the Mod directory gives the same behavior for me (no crash, but also no modded effect). The same mod made to the "real" gameplay.constants file in ProgramFiles/... will work correctly.

My test was modifying line 414 of gameplay.constants from:

413 gameSpeedData-Normal
414 incomeGameSpeedScalar 0.15

to:

413 gameSpeedData-Normal
414 incomeGameSpeedScalar 0.95

(obviously the line numbers are not in the actual file)

Without mods, initial credit income on the default single player start (normal speed everything, small random map, 1 TEC human player, 1 AI) is 10.1/sec; with the mod in the ProgramFiles/... version of the gameplay.constants file the value is 17ish (I think 17.6/sec). With the mod in the Mods folder that shows up on the Mods UI in-game (and yes, I made very sure that I enabled the mod, it darkens the screen for about 10 seconds and then releases, showing the mod as enabled with a checksum), it's still 10.1/sec.

Is there additional information I can supply that would be helpful?

Thanks,
Keith

Edit: and the technical explanation of the "have to copy the whole gameInfo folder to the Mods directory" would be interesting from a curiosity standpoint, but unless there's some way I could change y'all's mind on that design decision, it'd just be for kicks.
Reply #11 Top
Ok, I'll see if I can figure out why it's not having any effect in the mod folder :(

Fixes first, explanations later :P
Reply #12 Top
"Fixes first, explanations later"

Lol, certainly. Absolutely no need to take away development time solely to satisfy my curiosity =)
Reply #13 Top
Ok, apparently this is fixed in the patch which Frogboy spoke of. And I didn't have to do nuffin.

Briefly, the "copy whole folder" issue: at a low level, the engine separates things into folders... if it finds the GameInfo folder, it will pull everything from that folder. (Rather than loading specific files, it enumerates the files in the folder and loads them) To change the engine to handle pulling things from two different folders and deciding what to do if there's a conflict is non-trivial... not massive, but not trivial.

In addition, what do you do if you want to remove files that were in the original folder and only use the ones in the mod folder? You can't, because it will fall back to the original. Unless we add a switch to say "don't use original folder" to the mod - fine. Then what do you do if you are stacking mods and one says "don't" and one says "do"... it's a potential black hole of messiness.

Cheers

Reply #14 Top
And I didn't have to do nuffin.


Those are the best kind of fixes aren't they? "It's fixed. I don't know how, but who cares?"  :LOL: 
Reply #15 Top
psugar, thanks, that explanation makes a great deal of sense. Short of having a "manifest" file in the directory that explicitly lists the "files to find here" (might could go without that), and the "files to find in the main game's version of the folder"... it'd be nasty, even with that, with multiple mods. No need to inflict that upon yourselves. I'll just use Beyond Compare to merge mods if I have to.

Those are the best kind of fixes aren't they? "It's fixed. I don't know how, but who cares?
Actually, programs crashing doesn't bother me, I'm used to that. When they go from crashing to not crashing with no explanation,
THEN I worry. The computer's preparing an ambush ;) But if another developer fixed it (like this case)... well, that's all ok then.