Modpol-Basics-for-Developers
Nathan Schneider edited this page 2 years ago

Modpol is a Minetest game mod which implements the modular politics proposal, a governance layer for the internet. The central idea is that governance can be broken down into modules which can be mixed and matched to form a government system that is diverse and flexible to its needs.

Modpol API

The modpol API manages and handles all the modules. It can serve as a dependency for other governance mods.

Key terms

Core

The modpol_core/ directory contains the command-line version of Modpol, which includes all the basic functionality.

Interactions

The modpol.interactions table includes the functions related to user interactions. In Core, these functions are located at modpol_core/interactions/interactions.lua. When implementing Modpol for another platform, most of those functions will need to be overridden with platform-specific functions at modpol_[platform]/overrides/interactions.lua.

Module

Modules define actions that users can take within orgs. Each module should be as focused as possible; more complex actions can occur by having modules call each other. Modules are also configurable through policies. When a module is called, it creates a process in the org.

Org

Orgs are the basic units of modpol governance—groups of users in which users can call modules. At the base layer of every Modpol system is an instance-level org called "Root" by default. It cannot be removed. Orgs can be created within orgs (which are called child and parent). If a parent org is removed, its child orgs are removed as well. The modpol.orgs[org_name] table contains the org's data, and modules can add new tables to that table.

Policy

Policies are org-level configurations that apply to a specific module. They are contained in modpol.orgs[org_name].policies[policy_slug]. They override the default values of the [policy_slug].config configuration variables.

Process

A process is created in an org when a module is called. Process data lives in the modpol.orgs[org_name].processes table. When a module is done running, it should end the relevant process.

Storage

Storage is how Modpol preserves important information about its state between sessions. This can be done in a platform-specific way. [TBD]

Modules

Each module works to implement a specific aspect of governance.

For more information on modules, see the For Module Writers section