I’ve taken a crack at this, but need a bit of guidance as to how to post my code. It’s a bit long to include as part of a normal post. I see that some other people have used playfic – could somebody explain how to go about using that?
Sorry of this is quite basic, but it’s not someting I’ve done before.
Report wearing the jetpack:
Say "You slip the harness over your shoulders. It does not seem to fit quite right.";
Stop the action.You probably want to use an “after” rule here.
End the game in death.
[/code]This is deprecated; use "End the story saying..." instead (yes, it is less convenient, but the old form may be withdrawn eventually)
To check for deprecated code like that, write this at the top of your program:[code]
Use no deprecated features.
At least one of the ocean rooms has a description not matching the physical layout of the rooms, leading to this:
For a large number of oceans, it might make more sense to have a single “dead end ocean” room and track where the player came from, instead of having lots of separate rooms that you have to keep identical. For a medium sized case (a typical game), you can create a kind of room and have it automagically generate its name and description:
[code]Leading-from relates a direction (called D) to a room (called R) when the room-or-door D from R is not nothing.
The verb to lead from (it leads from, they lead from, it led from, it is led from, it is leading from) implies the leading-from relation.
An ocean is a kind of room. An ocean is always wet. The printed name of an ocean is usually “Ocean”. The description of an ocean is usually “You are in the air above a large body of water. You can see land to [the list of directions which lead from the location].” [/code]Just make sure every ocean is connected to something and it will produce sensible output. If you’re going to allow the player to go up and down as well, just change the “list of directions” to “list of horizontal directions” and add this:
A direction can be horizontal or vertical. A direction is usually horizontal. The up and the down are vertical.
And finally, a somewhat less relevant issue:
You could not realistically use this code in a “real” game of IF, because it’s far too easy to produce unwinnable situations (by running out of fuel), unless you provide a refueling station of some kind. Ultimately, the fuel mechanic may overly complicate the gameplay.
But that’s okay, because this is just a demo. It’s not supposed to be dropped wholesale into a “real” game, and as an implementation of flight, it’s quite good.
Thanks. The code for generating a single Ocean room which appears to the player to be a myriad of rooms is a very handy thing to know. Producing the individual rooms manually was a bit of a pain in the ass, and, as you pointed out, I evidently made an error in the descriptions.
Here’s my version of the jet pack puzzle. It’s quite complex and probably isn’t the most efficient way of doing it, but it works well. It might also be a little tough, but then again so is navigating through a zero gravity and frictionless environment! Enjoy! Jet Pack.zip (174 KB)
Climbingstars, I haven’t managed to land safely yet, but your piece is definitiely not easy. I’m curious – does it in fact follow the “real world” laws of physics? That Newton guy has definitely made the world more complicated (although I do like the fig cookies he invented).
It does to some extent, but it’s probably not completely perfect. The main concept I use here is for the jet pack to accelerate in a given direction and then continue in that direction when it is put in idle as is the case with travelling in such environments. Also, firing the jet in the opposite direction of motion will slow the jet down and then reverse its direction. One important similarity with real life is that if you keep the jet firing it will continue to accelerate and can make it very difficult to control, that’s why those flying in space shuttles and similar crafts tend to use short bursts of propulsion for aligning up for docking to docking stations.
The discussion of physicists and baked goods calls to mind an egregious act of plagiarism of which I was the victim some years ago.
Back when I was but a lad, I once visited Austria for purely scientific purposes, to wit: I wanted to test the hypothesis that “there is pastry in Vienna.” I designed an appropriate experiment and, having arrived in the subject city, proceeded to conduct said experiment and replicate it a sufficient number of times to obtain an adequate sample of data. Eventually, I reached the conclusion that the hypothesis was confirmed.
However, as I was preparing to leave town, it occurred to me that, if a hypothetical second experimenter were to attempt to replicate my experiment shortly thereafter, he would reach a contrary conclusion. This flows from the axiom that one cannot have one’s cake and eat it too; hence, after I consumed all of the pastry in Vienna, there would be none left for the second experimenter to enjoy (at least until the bakers were able to replenish the supply). More generally, this leads to the principle that, under certain circumstances, the mere fact of conducting the experiment – in this case, eating the pastry – can affect the result. I designated this principle the Rothman Strudel Theorem.
I have since learned that physics students are taught this very same principle, without giving me proper credit. Instead, the principle is attributed to some German guy who evidently didn’t like cats.
I have considered bringing legal action against those who have misappropriated my intellectual property. Were I to do so, the theory of the case would undoubtedly become known as the Sacher Tort.
Excellent stuff. Reminded me a lot of the old asteroids arcade game, and I really liked the visual display of the thrusters on the status bar. The display of the velocity and acceleration was really flash as well. I’ve got to ask: did you write out all those rooms yourself, or did you make a program to do it?
Also, would there be a way of creating infinite identical rooms with just one room? It could be all directions from itself, and you could track your co-ordinates with two number variables, such that when you arrive at the right co-ordinate, you find yourself at the docking bay. The benefit of this method would be that you could have infinite* space without having to describe so many rooms.
The next logical step would be to extend it in three dimensions, and have the parser understand up-southeast or down-north as USE or DN and so on.