Dustforce level scripting framework
Project description
Dustmaker
Dustmaker is a Python library for reading, manipulation, and writing binary files used by Dustforce, primarily level files.
Documentation
Documentation can be found at https://dustmaker.readthedocs.io/en/latest/.
Installation
Install with pip through PyPi using
python -m pip install dustmaker
or clone this repository and install using
./setup.py install
Command Line Tool
Dustmaker comes with a few command line tools that can be accessed through running the dustmaker module.
$ python -m dustmaker --help
... listing of available utilities
$ python -m dustmaker transform --upscale 2 downhill big_downhill
... creates upscaled version of downhill and saves to "big_downhill"
Example: Creating a new level from scratch
from dustmaker.level import Level
from dustmaker.tile import Tile, TileShape
from dustmaker.dfwriter import DFWriter
# Create a new empty level and add some tiles.
level = Level()
level.name = b"my level!"
level.virtual_character = True
for i, shape in enumerate(TileShape):
level.tiles[(19, 2 * i, i)] = Tile(shape)
# Automatically figure out edge solidity and connectivity flags
level.calculate_edge_visibility()
level.calculate_edge_caps()
# Write level to a file
with DFWriter(open("mylevel.dflevel", "wb")) as writer:
writer.write_level(level)
Example: Counting how many apples are in a level
from dustmaker.dfreader import DFReader
from dustmaker.entity import Apple
with DFReader(open("mylevel.dflevel", "rb")) as reader:
level = reader.read_level()
apples = 0
for x, y, entity in level.entities.values():
if isinstance(entity, Apple):
apples += 1
print(f"Level has {apples} apples")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dustmaker-1.0.1.tar.gz
(44.2 kB
view hashes)
Built Distribution
dustmaker-1.0.1-py3-none-any.whl
(51.0 kB
view hashes)
Close
Hashes for dustmaker-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3aeb85e429622063fffabc9e983e20886d9bf9bce1ae143e1fe7138c69357d82 |
|
MD5 | 54466d5d0f934ffd5b5c3b934bc99fd5 |
|
BLAKE2b-256 | 8952b7c119ab96cf448ba5a482be6e86fee49e499ebfc96218c875d05b0000f5 |