Skip to content

annhilati/rhombus

Repository files navigation

Header

Static Badge Static Badge Static Badge

Static Badge Static Badge Static Badge

Terrain development in Minecraft relies on large, deeply nested JSON structures that quickly become difficult to read and maintain. Rhombus introduces powerful abstractions and a comprehensive Python API, making world generation code cleaner, more modular, and significantly faster to develop.

Rhombus is an eDSL delivered as a Python package that allows worldgen developers to comfortably write expressions resembling the abstract syntax trees of density functions for Minecraft while benefiting from Python's forgiving syntax.

This project is pretty similar to misode/gaia-beet, which you might also find useful. Know that I started developing Rhombus before I knew about it, the similarities in concept are quite frightening though. The biggest difference to Misode's gaia-beet is that Rhombus does not see itself as a mere Beet plugin — although we heavily rely on it — but rather as a coherent, mostly separated language and it will be further developed and improved in exactly this sense.

Key Advantages

  • 📦 Object-oriented Design
    Full use of Python’s object model for composing, reusing, and structuring density functions.
  • 📝 Native Comments
    Since Python code is in use, comments work naturally without any custom syntax.
  • 📖 Integrated Documentation
    Functions and classes provide docstrings describing behavior, parameters, and usage.
  • Performance Optimization
    Recurring expressions and resource intense operations can be cached automatically.
  • 🗄️ Macro Library
    Growing collection of macros for common patterns and complex operations, reducing boilerplate and improving readability.

Features

Unveil

This list only includes features that are principially not neccessary, but make up the real strengths of Rhombus.

Impressions

pip install rhombus
from rhombus import *

continent_noise = Noise(-10, [2, 1, 2, 2, 2, 1, 1, 1, 1])
erosion_noise   = Noise(-9, [3.5, 0, 2, 4, 2, 2, 3])

erosion = clamp(noise(erosion_noise, xz_scale=1.3, y_scale=0) - 0.1, min=-1, max=1)

height_map = spline(erosion, [
    (-1,    -1,     0),
    (-0.6,  -0.95,  0),
    (-0.61, -0.6,   0),
    (-0.2,  -0.55,  0),
    (-0.21, -0.2,   0),
    ( 0.05, -0.2,   0),
    ( 0.21,  0.2,   0),
    ( 0.6,   0.3,   0),
    ( 0.61,  0.8,   0),
    ( 1,     0.8,   0)
])

FINAL = maps.extrude_heightmap(height_map, (-1, 0.8), (64, 256))

Preview

About

The Python-embedded Domain specific Language for Minecraft Terrain Generation

Topics

Resources

License

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Contributors