Table of Contents

Namespace AlphaFramework.World

Provides a basis for building engine-agnostic models of game worlds.

Note

NuGet package: AlphaFramework.World

Universe

The Universe (see UniverseBase) represents the game world data. It contains:

  • Entities and objects - All game objects, their properties, and relationships
  • Terrain data - Heightmaps, textures, and world geometry

The Universe is typically serialized to/from files as level or map data. It is designed to be presentation-agnostic and can be edited without running the game.

public class Universe : UniverseBase
{
    public static Universe FromContent(string id)
        => Load(ContentManager.GetFilePath("World/Maps", id));

    // Serializable properties describing game world here

    public override void Update(double elapsedGameTime)
    {
        base.Update(elapsedGameTime);

        // Game world update logic here
    }
}

Session

A Session (see Session<TUniverse>) represents a game being played. It wraps a Universe and adds:

  • Dynamic state - Entity states that change during gameplay
  • Runtime data - Player progress, inventory, quest states
  • Temporal information - Game time, event history

Sessions are serializable as savegames.

public class Session : Session<Universe>
{
    /// <summary>
    /// Creates a new game session based upon a given <see cref="Universe"/>.
    /// </summary>
    /// <param name="baseUniverse">The universe to base the new game session on.</param>
    public Session(Universe baseUniverse) : base(baseUniverse)
    {}

    /// <summary>
    /// Base-constructor for XML serialization. Do not call manually!
    /// </summary>
    public Session()
    {}

    // Serializable properties describing game state here
}

API

Namespaces

AlphaFramework.World.Components

Component system for describing rendering aspects, collision bodies, gameplay behavior, etc..

AlphaFramework.World.Paths
AlphaFramework.World.Positionables
AlphaFramework.World.Properties
AlphaFramework.World.Templates

Template system for building reusable/instantiable entities out of AlphaFramework.World.Components.

AlphaFramework.World.Terrains

AlphaFramework provides tools for generating, editing, and storing data for Terrain.

Classes

CoordinateUniverse<TCoordinates>

A common base for game worlds with objects in a coordinate system.

Session<TUniverse>

A common base for game sessions (i.e. a game actually being played).

UniverseBase

A common base for game worlds (but not a running game). Equivalent to the content of a map file.

UniverseExtensions

Contains extension methods for IUniverse.

Interfaces

IUniverse

A game world (but not a running game). Equivalent to the content of a map file.