Skip to content
Ed Kolis edited this page Aug 25, 2019 · 1 revision

Overview

The scripting API in FrEee is defined by the file FrEee.Core.dll. This file contains all the non-GUI parts of the game, so you can access literally anything in the game using the scripting API. Since there is so much in there, it makes sense to provide an overview of what's available.

Namespaces and Extension Methods

The classes in the API, as in any .NET library, are organized into namespaces. Namespaces can be thought of as a hierarchical structure for containing classes and other namespaces, with each level of the hierarchy separated by a dot (.). When you want to use any of the classes in a namespace, you need to import it in your Python file, like so:

This will allow you to use the classes by prefixing them with "FrEee.Utility.". If you don't want to use the prefix, you can use this syntax instead:

However, if you want to use extension methods on classes in a namespace, you will instead need to import it in this fashion:

Extension methods are handy utility functions which can be attached to objects at runtime, even though the objects themselves don't actually define the methods. For instance, there is a ToRomanNumeral() method defined which extends the type int, so if you have an integer variable, you can call .ToRomanNumeral() on it to convert it to a Roman numeral.

Namespace Hierarchy

Here are the currently available namespaces in FrEee (prefixes for the ancestors in the hierarchy are omitted for clarity):

  • FrEee - Contains FrEeeConstants, which defines several constants used by the game. Also contains all other namespaces.
    • .Game - Container for namespaces relating to in-game objects and supporting data types.
      • .Enumerations - Enumerated types, such as vehicle types and alliance levels. (These may eventually be moved to more individually relevant namespaces.)
      • .Interfaces - Interface types that don't contain any actual code, but just define expected behavior. (These may eventually be moved to more individually relevant namespaces.)
      • .Objects - Container for namespaces relating to physical and conceptual objects.
        • .Abilities - Generic code for manipulating abilities.
        • .AI - Code which calls the AI scripts. (Probably irrelevant to scripters.)
        • .Civilization - Classes relating to empires, races, populations, and cargo.
          • .Diplomacy - Classes relating to diplomatic actions.
            • .Clauses - Treaty clauses.
        • .Combat - Old turn-based combat system.
        • .Combat2 - New real-time combat system.
          • .FixedMath - Fixed point math.
        • .Commands - Commands that a player or AI can issue to something under his/her/its control. (Also see Orders)
        • .LogMessages - Empire log messages.
        • .Orders - Orders that a player or AI can issue to something under his/her/its control. Orders are distinct from commands in that they are queued and persistent between turns, while commands are executed immediately, then discarded. There are commands to manipulate game objects' order queues.
        • .Space - Naturally occurring space objects. Also contains Galaxy, which provides an overview of the entire game state.
        • .Technology - Anything that can be researched that doesn't fit into any other namespace.
        • .Vehicles - Various types of vehicles, such as ships and fighters.
        • .VictoryConditions - Various victory conditions which can be enabled in game setup.
      • .Setup - Classes relating to game setup.
        • .StarSystemPlacementStrategies - Rules for placing star systems on the map.
        • .WarpPointPlacementStrategies - Rules for connecting star systems with warp points.
    • .Modding - Various classes relating to modding. Also contains TechnologyRequirement, for some reason, though that should really go under FrEee.Game.Objects.Technology...
      • .Enumerations - Enumerated types, specifically formula types and requirement types. (These may eventually be moved to more individually relevant namespaces.)
      • .Interfaces - Interface types that don't contain any actual code, but just define expected behavior. (These may eventually be moved to more individually relevant namespaces.)
      • .Loaders - Code to load mod files. Probably not necessary to use unless you want to define custom mod files in your mod.
      • .StellarObjectLocations - Rules for placing stellar objects such as planets in relation to specific coordinates or other stellar objects in a system.
      • .Templates - Templates for objects in FrEee.Game that are loaded from mod files and used to generate game objects.
    • .Utility - Various utility classes used by FrEee.
      • .Extensions - Various extension methods used by FrEee.
Clone this wiki locally