So I’ve been thinking about the state of the Inform hyperlinks ecosystem. We have several hyperlinks extensions, and you can do a lot with them, but it can also be tricky to know which one to use, and if you want to use multiple extensions you’re probably looking at a lot of messy hacking.
I have an idea for a new extension/framework that would both allow for multiple hyperlink purposes to be used in one game, as well as giving space for future additions to the framework. The basic idea is that hyperlink values are 32bit numbers, so we can use some of them as a tag to indicate the meaning of the hyperlink, while still leaving lots of bits for the value.
So firstly, what are the purposes people want to use hyperlinks for? I can see four main ones:
- line input replacement commands
- hyperlinks acting as keypresses
- run some code
- an arbitrary number to pass to a rulebook for the author to interpret
Can you think of any more? The beauty of a framework like this is that it will be easy to add more without stepping on anyone’s toes.
So the four types of tagged data we would need are:
- memory address of some text
- a keycode number (signed)
- memory address of a rule/function
- an arbitrary number (signed)
I propose using 6 bits for a magic number (arbitrary number used to identify that the hyperlink was produced by the framework; if it isn’t present the framework skips handling the hyperlink), 2 bits for the tag number, and 24 bits for the value. The extension can handle extending the signed numbers from 24 to 32 bits. 24 bits will be enough to encode memory addresses for up to 16MB, which is far more than any I7 game I know of. (Note that is code only - there are bigger games, but they are bigger because of the multimedia they include in the blorb.) If we want more than four types of tagged data we can change to a 5 bit magic number and a 3 bit tag, or just use a second different magic number.
That’s the technical proposal, sorry if it’s confusing. As an author what would this mean? You could seamlessly use hyperlinks to act as keypresses in a menu, use hyperlinks to enter commands, use hyperlinks to expand a side panel window (like in Kerkerkruip for example), all in one game, without having to write code to say “stop interpreting hyperlink numbers as keypresses, now they refer to command replacements.”
Any thoughts? Is there anything you have ever wished you could do with hyperlinks in Inform that seemed to messy or difficult to implement?