• Stars
    star
    159
  • Rank 235,916 (Top 5 %)
  • Language Haxe
  • License
    MIT License
  • Created over 6 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Atomic modding framework for Haxe

Polymod

An atomic modding framework for Haxe games/apps.

Polymod allows users of your application to easily and seamlessly replace assets in your application, and manage those asset replacements in a centralized way as mods. It also provides a scripting system powered by HScript, and integration with FireTongue to load assets conditionally based on the currently selected locale.

Polymod supports the following Haxe frameworks:

  • OpenFL

  • HEAPS

  • NME

  • Lime (with or without OpenFL)

  • Custom (provide your own backend)

  • KHA (Coming Soon)

  • Castle (Coming Soon)

  • Ceramic (Coming Soon)

Basic sample:

A visual preview of the polymod OpenFL sample

Installation

Polymod is now available via HaxeLib! If you have previously installed Polymod directly from git, please update your installation:

haxelib install polymod

What is Polymod?

Let's say you have a game or app that you want to make moddable. The easiest way to do this is to:

  1. Make your game data-driven (expose as much of your content in the form of loose data files as possible)
  2. Let players provide their own data files

Easy enough. But what if you want players to be able to use multiple mods together? How do you manage that?

Polymod solves both problems.

First, it overrides your framework's asset system with a custom one pointed at a mod folder (or folders) somewhere on the user's hard drive. Whenever you request an asset via Assets.getBitmapData() or Res.loader.load() call or whatever, the custom backend first checks if the mod has a modified version of this file. If it does, it returns the mod's modified version. If it doesn't, it falls through to the default asset system (the assets included with the game).

Second, it combines mods atomically. Instead of supplying one mod folder, you can provide several. Polymod will go through each folder in turn and apply the changes from each mod, automatically joining them into one combined mod at runtime. Note that this means that the order you load the mods in matters, in the case that they have overlapping changes.

Polymod currently works with desktop* targets, and will eventually support other frameworks and targets.

*sys target, technically. Any target with a File System.

Polymod supports the following kinds of operations:

  • Replace asset
  • Append data to the end of existing asset (text only)
  • Merge data at a specified location within an existing asset (text only)

Replace logic works on any asset format. Append logic works only on text assets. Merge logic is currently supported for plaintext (TXT), CSV, TSV, and XML asset formats only. Support for JSON is planned.

Samples for the OpenFL, Lime, NME, and HEAPS frameworks are provided.

Basic Usage

Loading one mod:

Polymod.init({
  modRoot:"path/to/mods/",
  dirs:["mymod"]
 });

Loading multiple mods:

Polymod.init({
  modRoot:"path/to/mods/",
  dirs:["firstmod","secondmod","thirdmod","etc"]
 });

NOTE: On Mac, the default application working directory is <APPLICATION_NAME>.app/Contents/Resources, which differs from Windows and Linux. If you hard code the search path for your game's mod directory, be sure to account for this difference when targeting the Mac platform.

Be sure to call Polymod.init() before you load any assets. Also note that calling Polymod.init() will clear your Asset cache.

After that, you just load your assets as normal:

OpenFL / NME:

var myImage = Assets.getBitmapData("myImage.png");

Lime:

var myImage = Assets.getImage("myImage.png");

HEAPS:

var myImage = Res.loader.load("myImage.png");

This will return either the default asset, or a modified version if it's been replaced by a loaded mod.

Documentation

For further documentation on how to configure and use Polymod in your application, please see the Polymod website.

Further Reading

https://www.fortressofdoors.com/player-friendly-atomic-game-modding/

More Repositories

1

bazaarBot

A simple free market simulator engine. Based on "Emergent Economies for Role Playing Games" by Doran and Parberry.
Haxe
373
star
2

firetongue

A translation/localization framework written in Haxe
Haxe
143
star
3

crashdumper

A cross-platform automated crash report generator/sender for Haxe/OpenFL apps.
PHP
112
star
4

SteamWrap

Haxe native extension for the Steam API
Haxe
106
star
5

HxLightMask

A tiny 2D grid-based lighting engine for Haxe
Haxe
43
star
6

tdrpg-tools

A set of tools for the tdrpg-haxe project
Haxe
42
star
7

ThirdPartySteamSites

List of all the third party Steam sites that I know of
41
star
8

tdrpg-bugs

Public bug reporting repository for the tdrpg-haxe project (DQ1-haxe and DQ2-haxe)
38
star
9

divingbell

Source code for the Steam Diving Bell prototype (not to be confused with Steam Deep Dive)
Haxe
29
star
10

haxe-flx-ui

FlxUI - GUI library for Haxe+Flixel
Haxe
28
star
11

FlashEmulator

A proposal for a true "Flash Emulator"
26
star
12

CellGame--Open-Source-fork-of--CellCraft--

A real-time strategy game that incorporates real cellular Biology. Grow your cell and fight off viruses!
ActionScript
23
star
13

georgism

Little website about georgism
Pug
17
star
14

monologue-reader

A Haxe parser & controller library for Monologue trees
Haxe
10
star
15

safeparse

A collection of Haxe static extensions that safely read from XML and JSON, reducing boilerplate
Haxe
10
star
16

larsBounties

Open bounties for various tasks Lars needs to delegate to others
9
star
17

StealMyIdeas

Here's some ideas I have. Feel free to steal them.
7
star
18

boardgames

Some board games I designed once that are now open source
6
star
19

gogwrap

Haxe native extension for the GOG Galaxy API
C++
6
star
20

openfl-fla-plugin-tests

Tests of the OpenFL Custom FLA document
Haxe
5
star
21

fireglyph

A Haxe utility library for alphabets, glyphs, and other writing systems
Haxe
4
star
22

HaxePloverLearn

Drills for the Learn Plover! book, part of the Open Steno Project (Haxe port of Erika-n's AS3 version)
HTML
3
star
23

loc-sync

Synchronizes localization files between Google Sheets and a Git repository
PHP
3
star
24

gamejams

Game Jam Repository
Haxe
3
star
25

haxe-test-projects

Just a dumping ground for test projects I want to easily share.
Haxe
3
star
26

nme-benchmark-threshold

A simple test suite for benchmarking nme.display.BitmapData.threshold() function
Haxe
2
star
27

tdrpg-mod-docs

Mod documentation for the TDRPG engine (Defender's Quest)
1
star
28

songs

Original Songs
1
star
29

defendersquest-loc

Localization Repository for Defender's Quest series
1
star
30

timur_budgets

Video Game Budget records based on work by https://twitter.com/bogorad222
1
star
31

SuperSpaceDefenders

The Super Space Defenders Example Mod for tdrpg-haxe engine
1
star
32

hxcpp-examples

Haxe
1
star
33

SDLGrid

Just a little shared table of every platform that exists and whether it supports SDL, Vulkan, and OpenGL.
1
star
34

genre_evolution

Charting the evolution of genres over time
1
star
35

ActionPact

Fiddling around with a C API for universal input actions
C++
1
star