Coding Task - Footprints

Given the success of the previous coding task, this week’s coding task is footprints, as suggested by katz:

For those that don’t know the drill: this is a beginners-level-challenge to implement a unique game feature, in this case footprints. The idea is, you can get some practice coding in whatever language takes your fancy, practice others can learn from.

It may sound offtopic, but in my Node-X system when the player navigates through a node then a boolean flag is automatically set to true, indicating that the player has “visited” this node. This flag can be queried by the author/designer of the adventure. For instance, you can add a flag check which checks whether the player has already been on a particular Node or not. And if the player has already been there then do this or do that instead.

This system feature can be viewed as a sort of “footprint” too. But I assume you are not asking for something like this and you probably want this coding task for a parser-based system, such as Inform, and not for a choice-based system, right?

If so, then I’m out of here. If no, then I have to tell you that it has already been done by me in Node-X Generation 1 (2009).

Just for you information.

The tasks are system neutral, but the spirit of the footprints idea is not just to log when a room has been visited but to base some kind of puzzle or simulation around actual footprints. By all means show how this might be done using Node-X.

Ah okay, I get it. The task is to create an adventure, such as a murder plot, where the player has to follow NPC footprints and solve puzzles based on that. Well, in that case I have to correct myself. I haven’t done anything like that before. It sounds like an interesting game concept though.

Hmm, I can create a seperate thread with a quick tutorial which shows how to query visited nodes with flag checks and then do alternative actions based on that. But I’m not sure if I can create the kind of game you are talking about. I sure can implement NPCs, even ones who travel through the nodes of the adventure, same as the player, but following footprints of a dynamically moving NPC? No, not sure if I can do it. Right now I have no idea how to implement sth like this. I would have to think about it in detail first…

I’m not 100% sure how your Node-X system works, but given what I remember from Dead Hotel, here’s how I’d do it:

Have the player be rifling through a room. After examining a few things, there triggers a response saying that you can hear someone coming. This prompts the player to enter a cupboard and close the door. After waiting (with a new ‘wait’ option available for that node only) for a few turns, the person leaves. They’ve trailed muddy footprints, which show up in room descriptions hereon in, and indicate the most direct way to follow the person. Would something like that be doable? Can you track dynamic states like that in Node-X?

Okay, let me see what’s possible and what’s not…

This one can be easily done with flags and a jump to the node which tells the player that he can hear someone coming.

Can be done aswell. Technically speaking, the player would be given some time, in form of nodes he can move on, to enter a cupboard and close the door. Two outcomes would be possible in that case:

  1. The player moved through all the given navigation nodes (indicated by the automatically set NodeFlags), but didn’t enter the cupboard (certain node) and close the door.

  2. The player directly moved to the cupboard (node) and closed the door.

Depending on which of those 2 situations occur the game could respond with an according reaction, also triggered by checking one or more flags.

A “wait” option doesn’t exist in Node-X. It would have to be simulated with one or more nodes asking the player whether he wants to wait or not each time. Let’s say the player is asked 3 times (nodes) if he/she wants to wait. If he says No the first time it is not enough. If he says yes the first time, but no the second time then it’s still not enough. But when he says yes the first, yes the second time and either yes or no the third time then the goal has been accomplished.

Yes and no. The “footprints” would have be to scripted by the author, so to speak. They would not appear randomly. In other words, it would be a static and linear thing, no dynamic thing. The player would just have to read the descriptions and go to the given way. There would be no real surprise element in this. It would be like following someone on rails blindly.

This is because I haven’t implemented random states in Node-X yet (only in Dead Hotel in special cases, such as zombie fights). But I could fully implement this in Generation 2. I intended to add random gameplay anyway.

Alright, I’ve just scripted the wait scene in NodeScript:

I will try to script the other tasks and post the entire footprint adventure in a separate thread once I’m done with it…



T=Footprints (Demo)



1=Hotel Room

1=wait a minute
2=open cupboard
3=close cupboard


1=You are hidden inside a cupboard which stands in a hotel room.
2=You hear a noise!


1=You wait a minute, hiding in the cupboard…
2=You don’t hear the noise anymore.

; Set/Unset Flag Check of Node 1

; Game Over 1
1=You wait a minute, standing inside the opened cubpboard…
2=A male zombie enters the room. He sees, attacks and eats you!


; Game Over 2
1=As you open the cupboard you are noticed by a zombie standing
2=in the room. He attacks and eats you!


1=You wait another minute, still hidden in the cupboard…
2=Everything appears to be calm.


; Game continues here
1=You open the cupboard. Whoever or whatever the noise was, it’s gone.
2=There is no one in this room.


So how does it work.

In programmer’s terms:
In Node 1 (N1) the player can open or close the cupboard. He can do that an infinite amount of times on this node.
When the player chooses “wait a minute” then we jump to Node 2.
In Node 2 (N2) we check whether the cupboard in Node 1 is in an openend (set) or closed (unset) state.
If it’s in an open state we jump to Node 3 (N3, Game Over 1). If it’s closed then we stay on Node 2 and give the player further options.
In Node 2 when the player chooses “open cupboard” then we jump to Node 4 (N4, Game Over 2). If he chooses “wait a minute” we jump to Node 5 (N5) where we give the player further options.
In Node 5 the player can choose “wait a minute” an infinite amount of times. The node will always jump to itself, creating an infinite loop.
When the player chooses “open cupboard” in Node 5 then we jump to Node 6 (N6, solution).

In gamer’s terms:

  • Player has to keep the cupboard closed and stay hidden before waiting.
  • He has to wait 2 times and then he can finally open the cupboard.
  • If he opens the cupboard the first and second times then the zombie will notice him.

Actually, the adventure part is completely optional. The point of the exercise is to create a minimal working version with emphasis on the coding rather than the story or plot.

That’ll be separate! :slight_smile:

Ok, so I started coding this, but somehow my code went completely missing… I think I forgot to sync my Dropbox. Anyway, here’s how I would make footprints in TADS 3:

  1. Footprints are ‘created’ as individual objects every time the footprint-leaving NPC enters or leaves a room (“The glowing footprints lead west and north.”)

  2. Footprints will eventually vanish; they are created with a timer, so that the following is true at the designated ages:
    0-3 turns: …brightly glowing…
    4-7 turns: …glowing…
    8-11 turns: …dimly glowing…
    12-14 turns: …faintly glowing…
    turn 15: The faint footprints to the west vanish entirely.

  3. Examining the footprints will give additional details:
    “Closer examination shows the footprints arrived from the west, and continue to the north.”

  4. Since these are glowing footprints, they light the room equal to the amount of brightness they have left:
    0-3 turns light the room
    4-7 turns light the room dimly (objects aren’t shown, or something)
    8-11 turns only show exits
    12-14 turns only light the footprints themselves, and the exits they lead to/from.
    I’ll probably make part of the puzzle catching up to the glowing fiend in enough time to traverse a dark area.

These footprints could be modified (remove the light parts) to make them footprints in the sand, the snow, pouring rain, or other such surface. With a little work, I could probably add the ability for footprints to fade faster or slower on certain surfaces, or the ability to ‘disturb’ the footprints by walking through them (that is, doing things in the room with the footprints will increase their age faster). The interesting part is if the NPC backtracks… you could end up with “Footprints lead north, south, east, and east.” (as in, entered from the north, walked east, walked back, then walked south). I haven’t coded anything to deal with that yet; I would have to make it read, “There are two sets of footprints - one set leads north and east, while the other leads south and east.” The hardest way to code that would be to make each set traceable, but the easiest would be to just muddle them together: “The footprints from the north glow dimly. The footprints leading east glow dimly. The footprints from the east glow. The footprints leading south glow brightly.” or some such. I’ll have to figure out the best method.

Anyway, if I can find my code again, I’ll post it.

That sounds like a pretty neat implementation ArmanX. Do let us know if you find your code.

My implementation, along with source, can be found at playfic. I decided to implement a pretty bare-bones puzzle game in which you yourself spread different kinds of footprints. Hopefully it’s somewhat instructive or at least amusing.

Okay, here’s mine. It’s still a bit buggy on the footprint end and I ran out of steam when it came to write descriptions for mud, but the basics are there, and it’s solvable.

I’m still trying to figure out why sometimes the mud-prints will get out of sync and show the wrong rooms - I think it’s just showing the room that the dog is currently in, regardless of where you are when you look at the mud. It only does it sometimes, though, so it’s baffling.

Here’s my version of the footprints puzzle. It’s probably not the best, but it has some interesting features and coding. Enjoy! (166 KB)

Since it’s coming up to a month since the start of the footprints task, I believe it’s probably time for a new task. I have two more ideas for the next coding task.

  1. Russian dolls - Puzzles including scenarios where there is a container inside another container or a supporter inside another supporter.

  2. Public transport simulator - Puzzles where a bus, train turns up at regular intervals with the player being able to hop on and the driver going to the next stop or even a taxi where you can tell the driver where to go next.

I’ll leave the rest for you to decide.

I’ll vote for the second - if only because I already have some code for that. My footprints code has vanished, it seems :-/

Did you check the folder where all the source code and stuff is kept? A copy might still be around there somewhere.

My default folder is a Dropbox folder, and until this, that’s worked splendidly; however, there must have been a glitch somewhere, because it’s vanished. I searched the original computer, but it was gone. Usually, I copy everything to a different folder before letting Dropbox sync, but I was in a rush, so I skipped it. Lesson learned, I guess.

The coding tasks appear to have gone dormant recently. Are there any more entries for this task? If not, then it may be time for a new task.