McRogueFace is a powerful roguelike game engine that combines C++ performance with Python flexibility. Create tile-based games with procedural generation, UI systems, and full audio support - all scriptable in Python.
import mcrfpy
# Create a game scene
mcrfpy.createScene("game")
mcrfpy.setScene("game")
# Create a 50x50 grid world
grid = mcrfpy.Grid(50, 50, mcrfpy.default_texture, (0, 0), (800, 600))
ui = mcrfpy.sceneUI("game")
ui.append(grid)
# Add a player entity
player = mcrfpy.Entity(grid)
player.pos = (25, 25) # Center of the grid
player.sprite_number = 5 # Use sprite index 5
grid.children.append(player)
# Set up keyboard controls
def on_keypress(key):
if key == 119: # 'w' key
player.pos = (player.pos[0], player.pos[1] - 1)
elif key == 115: # 's' key
player.pos = (player.pos[0], player.pos[1] + 1)
# ... more controls
mcrfpy.keypressScene(on_keypress)
McRogueFace provides five primary types for building games:
The Grid is the foundation of your roguelike - a tile-based world that efficiently renders terrain, handles camera movement, and manages entities.
Entities are objects that exist on your Grid - players, enemies, items, and interactive elements. Each entity has a position and sprite.
Frames are rectangular UI panels that can contain other UI elements. Use them for menus, HUDs, and dialog boxes.
Sprites display single images from texture atlases. Perfect for UI icons, decorations, and non-grid visuals.
Captions render text with customizable fonts and colors. Use them for labels, dialog, and game messages.
McRogueFace uses a hybrid architecture:
This design gives you the best of both worlds - the performance of C++ with the rapid development of Python.