Skip to content

Modding

Ed Kolis edited this page Jun 7, 2022 · 2 revisions

FrEee modding works basically the same as Space Empires IV modding. All SE4 mods should work out of the box with FrEee.

We have a reference to all the mod files; please fill in any details based on the Space Empires IV mod files, and we will make any necessary adjustments for the enhancements made in FrEee.

However, there are a few new features and miscellaneous changes:

  • The game does not use Path.txt to load mods. There is a mod launcher built into the game. Mods must be stored in the FrEee/Mods folder for the mod launcher to find them.

  • In multiplayer, players no longer need to keep their mod files in sync. The mod files are embedded into the savegame. If you need to patch the mod mid-game, you can do so from the host console (accessed by loading the master GAM file, eg. mygame_42.gam). This is no longer true; storing the mod data in the savegame was not all that advantageous because other data such as graphics and music still needed to be accessed externally. The mod data was only bloating the savegame.

  • You no longer need to specify "Number of Abilities" or "Number of Tech Reqs". If the field is missing, the number of abilities or requirements will be computed automatically.

  • You no longer need to specify indices for abilities and tech requirements. For instance, you can say "Ability Val" instead of "Ability 1 Val 2".

  • You can use [%Amount1%] and [%Amount2%] as shortcuts for the ability values in ability descriptions, like in SE5.

  • Ability descriptions are actually no longer mandatory; if you leave them out then the descriptions specified in AbilityRules.txt (see below) will be used.

  • You can create custom AIs using Python script. (Note: The SE4 AI files are not supported.)

  • You can create parameterized records. These are basically "templates" for the actual items, much like SE5 data file records, However, unlike SE5, you can have more than one parameter.

The parameters are created like so:

Parameter Name      := level
Parameter Maximum   := 3

You can name the parameters any valid Python variable name. You then can set fields equal to values that are an equals sign followed by a Python script:

Name                := ='Mineral Miner Facility ' + level.ToRomanNumeral()
...
Cost Minerals       := =1000 + 500 * level
...

Alternately, you can embed formulas into a string using string interpolation syntax:

Name                := Mineral Miner Facility {level.ToRomanNumeral()}
  • If you create a formula preceded by double equal signs or an embedded formula surrounded by double curly braces, it becomes a dynamic formula, which is not cached like a normal, static formula; instead it is evaluated freshly every time it is referenced. This is useful in, for instance, weapon damage formulas, which might need to take into account changing data such as weapons range:
Damage := ==40 + level * 10 - range * 5
  • You can create a script which runs after game initialization (prior to the first turn). Place it at FrEee/Mods/YourMod/Scripts/GameInit.py.

  • Random events and other end of turn events are scriptable, like in SE5. The script is found at FrEee/Mods/YourMod/Scripts/EndTurn.py.

  • All scripts (including data file formulas) can access the mod global script, found in FrEee/Mods/YourMod/Scripts/builtins.py. For instance, you might want to define a function called LevelUp that computes a value based on a level parameter; you could then use that function in any script.

  • If a file is missing from a mod, the stock file will be used instead, like in SE5.

  • There is a new mod file, AbilityRules.txt. This file specifies rules for stacking and grouping abilities. You can use this to for instance make space yards stack or not stack, or to add a custom ability for scripts to use.

  • There is another new mod file, DamageTypes.txt. This file specifies the various damage types used in the game, e.g. "Skips Normal Shields".

  • And a third new mod file, EventTypes.txt! This file contains scripts to define the various event types referenced in Events.txt and IntelProjects.txt.

Clone this wiki locally