Dungeon Master in Python

Lesser known clone projects or isolated news items about rare or unusual clones.
Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
Cycl0ne
Craftsman
Posts: 114
Joined: Mon Apr 19, 2010 11:33 am

Dungeon Master in Python

Post 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.
User avatar
ChristopheF
Encyclopedist
Posts: 1729
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: Dungeon Master in Python

Post by ChristopheF »

Great, I'm happy to see ReDMCSB was useful for some new projects !
Cycl0ne
Craftsman
Posts: 114
Joined: Mon Apr 19, 2010 11:33 am

Re: Dungeon Master in Python

Post 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
User avatar
Gambit37
Should eat more pies
Posts: 13844
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Dungeon Master in Python

Post 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...
Cycl0ne
Craftsman
Posts: 114
Joined: Mon Apr 19, 2010 11:33 am

Re: Dungeon Master in Python

Post 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
Cycl0ne
Craftsman
Posts: 114
Joined: Mon Apr 19, 2010 11:33 am

Re: Dungeon Master in Python

Post 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
User avatar
ChristopheF
Encyclopedist
Posts: 1729
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: Dungeon Master in Python

Post by ChristopheF »

I tried https://cycl0ne.codeberg.page/pages/ in Edge, Chrome, Brave and Firefox.
The only thing I get is the "Loading, please wait" message...
Cycl0ne
Craftsman
Posts: 114
Joined: Mon Apr 19, 2010 11:33 am

Re: Dungeon Master in Python

Post by Cycl0ne »

Takes some time 10-15sec. Maybe refresh. Problem is a limitation in Codeberg. I will move to another Server.

Check the f12 Browser console If there is an exception throwing. I tried IT in Chrome Android and Chrome Linux. Works. Was a quick Hack. Will Check tomorrow.
Cycl0ne
Craftsman
Posts: 114
Joined: Mon Apr 19, 2010 11:33 am

Re: Dungeon Master in Python

Post by Cycl0ne »

Hi Christophe,

the problem can be an Ad Blocker, we need to cross-script to get the compiled python executor. normally you should see this on error in the browser console (F12):
pythons.js:2223 Loading python interpreter from https://pygame-web.github.io/cdn/0.9.3/ ... 12/main.js
onload @ pythons.js:2223
The FetchEvent for "https://pygame-web.github.io/cdn/0.9.3/ ... 12/main.js" resulted in a network error response: Cross-Origin-Resource-Policy prevented from serving the response to the client.
main.js:1 Failed to load resource: net::ERR_FAILED


when disabling some blocker (for me its ghostery). all runs. As i said, i hacked it into the codeberg. Maybe i find some other hoster. but its low prio for me. it was just an proof of concept if wasm works ;-)
User avatar
ChristopheF
Encyclopedist
Posts: 1729
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: Dungeon Master in Python

Post by ChristopheF »

I do get the error you mention in F12 dev tools.
In Edge, I had to select "Allow" for "Insecure content" under Privacy, search, and services / Site permissions / All sites / https://cycl0ne.codeberg.page/
Not something anyone should ever do... but now it works. This will definitely need a better fix.

Some feedback so far:
- It's great to see the (nearly) original game running in a browser, well done !
- I'd like an option to enabled/disable the refinements that you implemented, like color icons in the action area & fluid movement for thrown objects.
- When you click on a movement arrow, both the arrow and the rectangle around are briefly inverted. In the original game, only the arrow is inverted, not the rectangle. This looked weird the very first time I clicked an arrow.
- When attacking a creature, you can attack with one champion, the damage amount is displayed over the action area, but you can still click on this damage picture to cause another champion to perform an action, even before the damage disappears.
Cycl0ne
Craftsman
Posts: 114
Joined: Mon Apr 19, 2010 11:33 am

Re: Dungeon Master in Python

Post by Cycl0ne »

ChristopheF wrote: Tue Jul 07, 2026 4:09 pm - It's great to see the (nearly) original game running in a browser, well done !
Thanks !
ChristopheF wrote: Tue Jul 07, 2026 4:09 pm - I'd like an option to enabled/disable the refinements that you implemented, like color icons in the action area & fluid movement for thrown objects.
i will think on it ;-)
ChristopheF wrote: Tue Jul 07, 2026 4:09 pm - When you click on a movement arrow, both the arrow and the rectangle around are briefly inverted. In the original game, only the arrow is inverted, not the rectangle. This looked weird the very first time I clicked an arrow.
- When attacking a creature, you can attack with one champion, the damage amount is displayed over the action area, but you can still click on this damage picture to cause another champion to perform an action, even before the damage disappears.
All fixed + some other bugs (throwing something at a door, the item stays behind the door not infront.

Im compiling a new webasm version and upload it. But as i mentioned, this is just a POC. The native python version is the main source ;-)

The problem with the webversion:
* i need to include the two .dat files, no possible "upload" files.
* No real save/load, for that i need to create a database on a webserver to save to it. at the moment -> out of scope.

--> Just finished compiling and uploading the new version. its now live. (i had to use now icognito Tab to start it). I also implemented a fix, but it could take some time for codeberg to sync their servers. I created now a complete bundle. no more external loading of the python engine.
Post Reply