Page 4 of 4

Re: HeroScribe source code

PostPosted: May 18th, 2021, 8:49 pm
by Kurgan
There are several "Mario Maker" type clone programs for windows out there. No idea if any of them are open source...

Re: HeroScribe source code

PostPosted: May 19th, 2021, 2:09 am
by iKarith
Unless they're also multi-platform, that's not so useful to me since I'm a Linux user. I can probably get a basic, well-behaved windows program to run pretty easily. With effort, I can get more complex Windows programs working. But I can also decide that a board a list() of spaces (or a list() of rows each containing a list() of spaces in that row) and define walls and define walls and rooms…

(In fact the other night, I literally spent 15 minutes in a PM to Kurgan where I did that, so he knows I can. I defined a list of objects with floating point coordinates—though I now think they should be integer + offsets for other reasons—coming up with that much. Took no time at all.)

If I were doing it in C (I probably wouldn't today), I have a LOT of experience working with and on Simple DirectMedia Layer (SDL), the platform-specific glue layer used by all Valve games and a bunch of others to let them Just Work just about anywhere. The SDL 2 API binding for Python 3 is a bit rough on the Python side, but … I've got enough of a hang of it to use it at this point.

There's certainly no need to reinvent the wheel if a suitable wheel exists. Regardless though, we have a currently existing tool and at least some versions of it that are "current" out in the wild don't seem to exist on any website anymore. I'd like to make sure they get archived.

Re: HeroScribe source code

PostPosted: May 24th, 2021, 6:38 am
by Shadzar
iKarith wrote:So far as I can tell, we also need "fractional space" support so that you can position doors between two tiles (effectively WHQ rules—if door spans two tiles, you treat it as a double-wide door) and I have no freaking idea what to do with the DragonStrike maps yet! No idea how many people actually use those for HQ, they're … not ideal.


Dungeon Tile Mapper also uses 2 space doors, but can place things on the half square.
Image

It would just take a little bit of work to edit it like HeroScribe to use HQ features.
http://archive.wizards.com/default.asp?x=dnd/dnd/20061121t

Runs completely offline (http://archive.wizards.com/dnd/dungeontilesmapper/DungeonTilesMapper120.zip), and gives a "code" to be able to load and change a "map" later. You can also move and remove tiles as well as rotate them.

Again, like HeroScribe it can only be edited for personal use, and can't be redistributed, but it would do the job. Maybe WotC wouldn't mind so much using the D&D mapper for HQ since they are both HASBRO owned?

Re: HeroScribe source code

PostPosted: May 24th, 2021, 10:57 am
by Anderas
My preferred solution would always be one that understands the original Heroscribe XML files (there are loads of them out there!) and then expands that format with Quest texts, marks, monster stats and wandering monster.

I've made a proposal for an extended heroquest file format here:

https://github.com/Anderas2/Heroscribe2 ... est-format

Re: HeroScribe source code

PostPosted: May 25th, 2021, 7:37 am
by iKarith
Shadzar wrote:
iKarith wrote:So far as I can tell, we also need "fractional space" support so that you can position doors between two tiles (effectively WHQ rules—if door spans two tiles, you treat it as a double-wide door) and I have no freaking idea what to do with the DragonStrike maps yet! No idea how many people actually use those for HQ, they're … not ideal.


Dungeon Tile Mapper also uses 2 space doors, but can place things on the half square.
Image

It would just take a little bit of work to edit it like HeroScribe to use HQ features.
http://archive.wizards.com/default.asp?x=dnd/dnd/20061121t

Runs completely offline (http://archive.wizards.com/dnd/dungeontilesmapper/DungeonTilesMapper120.zip), and gives a "code" to be able to load and change a "map" later. You can also move and remove tiles as well as rotate them.

Again, like HeroScribe it can only be edited for personal use, and can't be redistributed, but it would do the job. Maybe WotC wouldn't mind so much using the D&D mapper for HQ since they are both HASBRO owned?


Can't be redistributed is a dealbreaker. In fact, given those terms, to do it properly I can't even look at the source code because it might cause me to write something similar, unless there are a lot of things just like it out there that I can point to as other sources of inspiration. The devs who originally made HeroScribe have moved on—it happens. Once upon a time it was written in Python and Java, but later developers continued it only in Java… This dev prefers the python. Unfortunately I don't have the python version to compare to (and it'd have to be ported to Python 3 at the very least anyway…) So may as well start fresh.

I haven't put a whole lot of time into it yet, but I've written some code that draws each space of the HQ board on a text screen using UTF-8 combining characters (so that a line of spaces on the board only takes up one line on the screen). Each space is drawn showing the properties of whether it has an occlusion to its neighboring spaces and if it is dark. All spaces are dark and have occlusions matching the walls and edges of the board by default.

Placing an object will default to fill that space, and all neighbors that are not blocked by occlusions, with light. Door objects remove the occlusion on both sides of the wall they're placed along. Blocks (non-trap rubble in EU-based regions) only lights itself and occludes all sides. So if you drop a door on a wall into a corridor, the room and the corridor will light up. Drop a block and … no change. Drop another and anything outside the region you've fenced in goes dark.

Actually, it fairly inefficiently recalculates every time the object list changes—so don't drop several million objects on your quest map on a slow system unless or until I decide to fix that. :lol:

In a GUI, you'd skip drawing darkness at all until an object is placed. I haven't written that far yet.

Debating how I'd do the block tiles caused me to write a pathing algorithm I thought I might use to find out if one object can reach another. Simple: Take your target tile, it's distance 0 to itself. All adjacent spaces that are not occluded are distance 1. All spaces adjacent to that which are not occluded and don't have a lower number already are distance 2… Exhaust non-occluded tiles. If your source tile has a distance number to the target, it can reach the target. If it does not, then it can't. To navigate to the target, for each move, go to the lowest-numbered target you can.

Why do you need that in an editor? You don't! Where would you need it? Well, the HQ PC game, if an orc decided it wanted to stab an elf, but the nearest elf had a block in the path between them, the orc would stand in front of the block stupidly and just wait for it to move.

:orc: Stupid rock. Want to stab elf!

If however there are a couple of open doors between the orc and the elf, using this algorithm, simple though it is, the orc will know how to make a beeline for the target.

:orc: Bob use door, then stab elf! Elf never think of that…

This could be done for each target in order of priority.

:orc: Elf is far away. Play with swordy man instead? Can try catch elf. No, play with swordy man now, stab elf later. Hey swordy maaaan!
:barbarian: An orc! :skull: :skull: :skull:
:orc: :whiteshield: :blackshield: I'll get you next time Ga—er, Elf! Next time!

:wizard: Did that orc just sound like …?
:dwarf: Aye, I think he might've just broken a wall.
:barbarian: He did? The walls all look fine to me…

Re: HeroScribe source code

PostPosted: May 26th, 2021, 6:46 am
by Shadzar
iKarith wrote:Can't be redistributed is a dealbreaker. In fact, given those terms, to do it properly I can't even look at the source code because it might cause me to write something similar, unless there are a lot of things just like it out there that I can point to as other sources of inspiration.


Dungeon Tile Mapper was made by someone that allowed WotC to use it on their site. Not sure who owns the code now, but might reach otu to the original code author to see what can be salvaged for use with HQ and be allowed to redistribute?

HTML and CSS would be a lot better as it would be able to be used on all platforms.

even HTML canvas element like Roll20 uses to pick up and move assets could be an idea, but it is not something i am comfortable with messing too much with the canvas element as oppsoed to old DHTML styles.

So if you are starting from scratch HTML 5 canvas element might b an option to look at for cross platform simplicity?

Re: HeroScribe source code

PostPosted: May 27th, 2021, 5:50 am
by iKarith
Shadzar wrote:
iKarith wrote:Can't be redistributed is a dealbreaker. In fact, given those terms, to do it properly I can't even look at the source code because it might cause me to write something similar, unless there are a lot of things just like it out there that I can point to as other sources of inspiration.


Dungeon Tile Mapper was made by someone that allowed WotC to use it on their site. Not sure who owns the code now, but might reach otu to the original code author to see what can be salvaged for use with HQ and be allowed to redistribute?


I'm not sure it's worth the effort. The tool runs in a browser, which is nice and all, but it doesn't have several things we would want for HQ, which means they'd have to be written. In JavaScript. Which is a language I don't speak. And I'd have to track down a 3rd party author and get permission to modify his program. The fact that it's some random 3rd party author means he/she would probably give permission if I asked, but … I'd have to track them down first. Oh, and learn a new programming language.

OTOH, we have HeroScribe. The version I've got is pretty clunky, but it's got the features we want in terms of what it generates (PostScript—it calls GhostScript to turn that into PDF, but realistically I could just replace the PostScript commands with PDF commands if GhostScript were the real problem here…) There's a (somewhat) BETTER version of HeroScribe out there, "HeroScribe Improved", but I don't have it. It is, apparently, an improvement over an older version of HeroScribe than what I have—but if someone's got that, I can fold its features into HeroScribe proper. It's written in Java, a language I DO know, though I haven't used it heavily in a long time, so I'm a bit rusty.

Additionally, I've been kinda rethinking it a bit. An ancient version of HeroScribe was written in Java and in Python (2 certainly), but the Python code was abandoned because people thought Java was better for some reason at the time. Most people now … are not Java fans, and about four people here on the Inn have expressed some interest in working on a new HeroScribe in Python.

Noodling around, I've already written something that has a cool feature that would've been really cool for HeroScribe to have had, and the start of a new HeroQuest PC game that fixes the silliest limitation of the classic game. Oh, and I'd build everything using SVG, because … why would I use anything else today? The reason to use eps is that you can just take any Encapsulated PostScript and just insert it into a PostScript document like a stamp. But you can do likewise with SVG anyway. And the SVG command set is deliberately an XMLification of PDF because Adobe more or less designed it to be that, so printing isn't hard either.

I don't know why I'd go backwards to something in JavaScript which works with image files.


Shadzar wrote:HTML and CSS would be a lot better as it would be able to be used on all platforms.

even HTML canvas element like Roll20 uses to pick up and move assets could be an idea, but it is not something i am comfortable with messing too much with the canvas element as oppsoed to old DHTML styles.

So if you are starting from scratch HTML 5 canvas element might b an option to look at for cross platform simplicity?


What platform does Python NOT support? Python's included explicitly on any Linux or BSD system except OpenBSD because OpenBSD doesn't include anything non-essential by default. Most Python development is done on Windows, so it obviously works there, and at least until Big Sur it came with macOS too.

Hasbro would be wise to do it in HTML because it could be hosted on their website and hopefully saved offline. We can do better, though, since if you've gotta download an app, okay., we can give you something native.

On Windows, you'd exe-ify the Python so the user doesn't need to install Python and we'd include the wxWidgets or SDL DLLs. The former would even be accessible to screen readers, although since it'd be a visual map editor application … that doesn't … yeah. The tool is py2exe and it works well. On a Mac, the fact Apple has decided to stop including things they don't directly control because they're APPLE means we should do likewise. Fortunately, py2app is a thing! Works the same way. And we'd shove the wx Mac framework into the bundle for the same reason as on Windows.

On Linux, we'd just tell you to install wxPython or SDL however you'd normally do that. The flatpak option also exists and I'd be willing to set that up, resulting in something that looks like Windows or Mac to the end user in terms of setting it up, but it'd be all nice and sandboxed for security. BSD, Solaris (for both people still running it) and other UNIXes would follow the normal Linux instructions. (Admittedly, SDL doesn't run on a lot of those UNIX platforms it used to because those are far more niche than they used to be!)

Haiku … you're effectively looking at Linux directions.

I mean, what else are you trying to run it on, OS/2? :mrgreen:

Re: HeroScribe source code

PostPosted: May 29th, 2021, 3:09 pm
by iKarith
The source code to the HeroScribe All In One is 1.0-pre1. Kurgan dug up the thread talking about HeroScribe Enhanced 1.01 and … my understanding was that the latter was based on an older version of HeroScribe than exists, so there's features added to HeroScribe not in there.

It's not—it's a pure superset of the 1.0 pre1 All In One release. If someone's got something "newer" than that, please share it!

I've put the All In One's source code in a git repo and intend to build a portable build for it using whatever seems to be the trend in Java builds these days. Gradle? IDK. I do know Java 14 includes a thing called jpackage which includes macOS app bundle support. As macOS is the sticking point (Windows and Linux have obvious solutions, in fact both can just have .jar files be executable and be done with it if you really wanna go that route…) Once I've done that and tested it a bit, I'll add the enhanced stuff, throw it on Gitlab, and and "release" it with versions for a platform near you.

Not trying to "take over" HeroScribe, just trying to make it so it's as easy as possible for anyone who wants to do cool things to it to get those things out to people in a way that works for as many of them as possible. In other words, I know git-fu, and am doing it since nobody else has yet.

Heck, if we need to add an old version before the All In One, I know how to add it to an empty branch, use git replace to make it the parent of the Initial Commit in a shareable way. This effectively prepends history, which is good if you have a patch to a version that predates history you want to bring forward to today.

No particular impact on future plans … just that's a thing I can do, and will. It's on The List.