Monday, March 30, 2015

IFComp 2015 Devblog #2: Homemade InvisiClues

I wrote a PERL tool for homemade InvisiClues as a programming exercise, but I didn't use it right for a while. I mean, I had hints in-game, and they seemed to trump this, so the InvisiClues were an afterthought. I had a chicken-and-egg problem.

But it recently occurred to me that the clues could be a useful tool for development. I could just put in a special character/hash for clues I needed to implement. For instance, # at the end of the line meant, get to this. Searching for them would help me decide what to attack next.

It helps me a bit to have this instead of a general outline, because when I think of outlines I think back to school and the outlines I didn't want to do for a paper I didn't want to write. And the term "white paper" makes me think sometimes of how I should be using planning for things that will help me in my career.

InvisiClues fit right in with writing a parser game, though. And it allows me, the author, to have a bit of nostalgia while not inflicting the bad parts (cruel game difficulty, bad implementation) on the player. Plus I still remember the first time I saw InvisiClues online. Wow! How did they do that?

Once I learned scripting language, it didn't seem quite so amazing, but it was still cool.

Juhana Leinonen's JavaScript at Undo Save Restore provided the back-technology I needed for this. I just needed to know how to be able to open parts of a document with a click. Once I had that, I figured how to parse input and convert it to HTML.

The result is that I now have a document that I can twiddle and see where I need to tighten things up, and I have what I think is a slight improvement on the above invisiclues. Even seeing the wrong question can be a spoiler for the player, and at the same time, it's annoying to have to plow through question A, then B, then A.

Trizbort was useful for putting everything in its place, but now I'm relating things in different rooms. Or instead of a long description that overlaps another room, I have a section in the InvisiClues. Also, the template is in human-readable form.

#this is the output file name. Default is invis-(file base).htm
out=hitchhikers-invisiclues.htm
#this is what is displayed in the title bar
!H2G2 HTML Clues
>The Vogon Ship
#below is a subtopic that you can open up
>>The Vogon Hold
#below is the first question to open
?Why am I dying?
#hit tab and enter to reveal each answer
Not enough protein.
Eat the peanuts.
?How do I get the babel fish?
This is just an example. No way I'm displaying the solution.
>>The Airlock
?How do I avoid dying?
Just wait. You won't.
>After playing the game
?Have you tried...
...kicking the dog?
...(other silly stuff?)

I have InvisiClues up for Threediopolis, so you can see how that works.

  • The text source
  • The HTML
  • Finally, here is the PERL code. I've thought about doing markup like *text* for bold, {text} for italic, and _text_ for underline, but that's a bit of a feature. If you find this script useful, I'd be thrilled to hear about it.
As for homemade tools in general? I recommend due diligence first. If you don't find exactly what you want, maybe a freeware app will be close enough. If it's not too complex, it really is a boost to make your own small app. Just don't spend more than a few days getting it working, and don't feel you have to add TOO many features. The ones you need most will reveal themselves as you poke around more.

No comments:

Post a Comment