Forio Epicenter Documentation

website·Indexed 34 days ago

https://docs.forio.com/epicenter

Developer documentation for Epicenter, a platform for creating and managing simulation applications. It includes guides on integrating various model types—including SimLang, Python, Excel, Vensim, and Java—as well as technical references for model context schemas, JS libraries, and the Interface Builder.

Tokens
95.3K
Snippets
474
Records
791
Agent score
54%

What's inside Epicenter

  1. Overview of SimLang model structure

    SimLang is a system dynamics-inspired language for time-based models. Models are written in equations files (*.eqn) consisting of three primary elements, each identified by a single-letter prefix: Decisions (D), Variables (V), and Properties (M or P). These elements can appear in any order. Definitions can include built-in function calls, operators, loops, and conditionals; however, users cannot define custom functions.
  2. Overview of Forio Epicenter

    Epicenter is a platform used to transform models (either imported or created from scratch) into interactive web applications for simulations, games, or training classes. The model resides on an Epicenter server, and the application communicates with it via the Epicenter API. For developers, Epicenter provides a set of TypeScript JS libraries that wrap these API calls to simplify integration.
  3. Overview of Epicenter Push Channels

    Epicenter push channels allow applications to receive real-time notifications about events related to Epicenter entities such as worlds, groups, runs, or vaults. These channels are powered by CometD and the BAYEUX protocol. For direct user-to-user messaging, Chat rooms should be used instead of push channels.
  4. Manage user scores with Epicenter Leaderboards

    A leaderboard in Epicenter is a collection of user scores scoped to a specific entity (e.g., a group). A leaderboard is structured as an array of objects, where each object contains an array of scores for a specific user. To manage leaderboards in JS libraries, use the leaderboardAdapter.
  5. Access model variables during a run

    In Epicenter, a 'run' occurs when a user plays a game defined by a model. Model variables can be accessed in two ways: directly from memory during an active run, or by retrieving saved values from the database (which does not require restoring the run or loading the model into memory).
  6. Read group information using GroupReadOutView

    The GroupReadOutView interface provides comprehensive details about a group. Key properties include:

    • groupKey: Unique GUID of the group.
    • name: Unique name within the project.
    • capacity: Maximum allowed members.
    • runLimit: Maximum allowed runs.
    • allowSelfRegistration: Boolean indicating if users can register themselves.
    • expirationDate: Date after which registration or run creation is disabled.
    • status: Current status of the group (via Status interface).
    • pricing: Pricing details (via Pricing interface).
    • flightRecorder: Flight recorder configuration (via FlightRecorderReadOutView).
  7. Implement consensus barriers for participant synchronization

    A consensus barrier ensures all required participants have performed a specific action before a simulation progresses. A participant is considered to have 'arrived' at the barrier once they complete the required action. The barrier is 'triggered' when either all participants have arrived or the associated time limit has expired.
  8. Generate PowerPoint slide decks using Epicenter

    Epicenter can generate slide decks on the server by merging simulation data into a prebuilt .pptx template. The process involves locating a template in the project file system, iterating over slides, and replacing named shapes (text, charts, tables, and pictures) with provided data. The resulting deck is returned as Base64-encoded binary data or a streaming download.
  9. Use the ChannelMessage interface to handle push channel messages

    Every message delivered to a subscribe callback in Epicenter is wrapped in a ChannelMessage<D> envelope. This interface provides metadata about the message's origin, destination, and timing, along with the actual payload in the content field.
    export interface ChannelMessage<D = ChannelMessageData> {
        address: {
            boundary: string; // Scope boundary of the address (e.g. 'WORLD')
            category: string; // Push category of the address (e.g. 'RUN')
            key: string;      // Scope key for the address
        };
        sender: {
            type: string; // Sender type, e.g. 'USER' or 'SYSTEM'
            key: string;  // Sender key
        };
        content: D;      // The published payload
        date: string;    // ISO 8601 timestamp of when the message was sent
        type: string;    // Message type/category
    }
  10. Use the Channel class for push notifications

    The Channel class implements a push channel by constructing a CometD channel path based on a provided scope. It manages subscriptions, allows publishing data to the channel, and automatically reuses existing subscriptions for the same path to prevent duplicates.
    export default class Channel<D = ChannelMessageData> {
        path: string;
        update: ((data: ChannelMessage<D>) => unknown) | undefined;
        subscription: SubscriptionHandle | null;
    
        constructor(scope: ChannelScope);
        publish(content: D): Promise<Message>;
        subscribe(
            update: (data: ChannelMessage<D>) => unknown,
            options?: { inert?: boolean },
        ): Promise<SubscriptionHandle>;
        unsubscribe(): Promise<void>;
        unsubscribeAll(): Promise<void>;
    }
  11. Use Proxies for permission elevation

    Proxies in Epicenter are used to implement fine-grained permissions that cannot be handled by standard permissions and permits. A proxy operates with higher privileges than a standard user, allowing it to authenticate users and execute privileged functions. The proxy runs an HTTP daemon, and Epicenter maps the proxy's HTTP port to make it accessible to the application's UI code.
  12. Understand the FACILITATOR role ceiling

    In Epicenter, user sessions are scoped to a single group and are limited by the groupRole. The highest possible role a user session can achieve is FACILITATOR. Account-level roles—such as SUPPORT, AUTHOR, OWNER, and SYSTEM—cannot be granted to a user session or escalated by a logged-in user. For example, groupAdapter.addUser() and groupAdapter.updateUser() only support group roles (FACILITATOR, REVIEWER, LEADER, PARTICIPANT), and userAdapter.createUser() creates users without roles.