Page 1 of 1

Dungeon Master in Python

Posted: Sun Jul 05, 2026 9:51 pm
by Cycl0ne
The last couple of month.. years(?).. i used the ReDMCSB Source for the Amiga V3.6 and ported all to python. The project is called PyDm.

As you can see from the Source Code, the comments will reference the apropiate C Code, for people to check why something is done like its done:

Code: Select all

def perform_action(champ: Champion, action: Action, has_target: bool, rng: random.Random,
                   difficulty: int = 1, xp_override: int | None = None) -> str | None:
    """Apply an action's cost to the champion (the F0407 tail, MENU.C:1233-1243) and
    grant its skill experience. Returns the base-skill name if the champion gained a
    level (for the caller to announce), else ``None``.

    With nothing in front to hit (``has_target`` False) it's the "miss" path: the
    cooldown and experience are halved (MENU.C:1045-1052) but still applied. Either way
    the action is consumed — cooldown set, stamina decremented, (partial) XP granted.
    ``difficulty`` is the current map's XP multiplier (F0304). ``xp_override`` supplies a
    dynamic experience amount (the HEAL action's ``2 + 2*cycles``) that replaces the table
    value and is never halved."""
i included a module : Automap. this checks the world in the space of 3x3 around the char and saves it. Teleporters "invisible" are not shown (So you dont get spoiled). Its a kind of: Convenient Method, instead of you maybe did 30 years ago with pen and paper ;-)
Bildschirmfoto_20260705_212531.png
I used also the hand icon from the Amiga Version and the Yellow Pointer, which are data fields in the source
Bildschirmfoto_20260705_212443.png
All creatures are living in the dungeon like the original.
Bildschirmfoto_20260705_212335.png
Bildschirmfoto_20260705_212308.png
Here a short demo video of the port with the appearance GODMOG my debug Character ;-)
https://youtu.be/XU9nbs-FwZk

I divided the code into 2 Parts:
Renderer -> PyDM
World -> Basilisk Engine

I will upload the whole source in the next couple of days to my codeberg repository. And also create a Webasm Version and upload it to a website.

Oh, i use my own DMCSB Python module to extract graphics.dat/dungeon.dat, you need to supply it at the assets dir later. Maybe i will write a small "own" format to not get any problems with copyright of a nearly 40 year old game graphics :-D
What else is needed:
pygame-ce
numpy

Will keep you updated.

Re: Dungeon Master in Python

Posted: Sun Jul 05, 2026 11:48 pm
by ChristopheF
Great, I'm happy to see ReDMCSB was useful for some new projects !

Re: Dungeon Master in Python

Posted: Mon Jul 06, 2026 12:47 pm
by Cycl0ne
Have fun, bugs and comments you can write here...

https://codeberg.org/CyCl0ne/pyDM

tested at the moment with the Amiga dungeon.dat/graphics.dat (3.x)

* MagicMap implemented, but not used since this item is not available in the dungeon, you can use "M" for this.
* Skill decrease shooter CSB code part -> not implemented

Re: Dungeon Master in Python

Posted: Mon Jul 06, 2026 1:25 pm
by Gambit37
This is very cool, great work! It's wonderful to see DM running in new contexts.

Will this version always need to decode a graphics.dat, or could it be extended to read external image files? And could those external images have a higher bit depth? You can see where I'm going with this....

I have a semi-complete project for DSB to replace all the graphics with improved 8-bit versions (256 colours). I work on it very slowly but it will be finished one day. If your PyDM had support for that, it could also use these improved graphics...

Re: Dungeon Master in Python

Posted: Mon Jul 06, 2026 1:41 pm
by Cycl0ne
Hey Gambit of course ;-) this is why i separated the engine from the renderer. I had one forum post what my initial goal was: a DMCK (DM Contruction Kit). ;-)

All my projects allways fail, because i first implemented all goodies and then the motivation was gone. This time i said to myself: do a complete port and then the goodies.

But what you have to keep in mind: im using the ZONE/LAYER from the original Game, so every blit to screen goes through this mechanism. This was the first port and cleanup i did 2 years ago, when i thought this project would be cool in Typescript ;-)
https://codeberg.org/CyCl0ne/pyDM/src/b ... ne/zone.py

Re: Dungeon Master in Python

Posted: Mon Jul 06, 2026 8:22 pm
by Cycl0ne
For people who dont want to install python:

https://cycl0ne.codeberg.page/pages/

pyDM running as Webassembly

Bugs:
* Sound opening
* you can save and load, but it is not persistant.. sorry :( for that i need to read more webdocu