Strangely Consistent

Musings about programming, Perl 6, and programming Perl 6

July 14 2012 — hidden things which can be revealed

So, here's the idea: there's no door in sight, but when you examine the grass, the door suddenly appears! Well, it was there all the time, but you couldn't see it until you went examining something else nearby.

So, we want to be able to

The first feature is already in place. The second feature means we want a hide_thing method and an X::Adventure::NoSuchThingHere exception when we examine a hidden object.

The third feature means we want an on_examine method to hook arbitrary logic into examining objects. And the fourth feature means we want a an unhide_thing method which causes the object to appear and be examinable.

Taking a step back, we have a situation with two actors here: the adventure game itself, and the player. The adventure game is always aware of objects, even when they are hidden. But to the player it should appear as if... well it shouldn't appear, basically. "Invisible" is what we're after here. Though "completely transparent to player actions" probably captures the intent even better. The game should play dumb and go "door? what door?".

Let's begin.

Another day's work done.

I just realized that the on_try_exit and on_examine methods are outside of the whole event system. I don't really know what to think about that. Maybe it will become a pain point, maybe not. We'll see.

Anyway, the whole model is deepening day by day. This is nice. We're growing a game here.