Tuesday, October 15, 2013

Dev Log: Horror Text Adventure #24

So while I was taking my dog for a walk, all bundled up against the biting cold, I decided to add temperature as some flavor text, determined (for the moment) by your z coordinate.  As you go down, it gets hotter, and as you go up, it gets colder.  It was a quick little job, throwing in a case statement for particular floors (though I'll make things more complicated later).  At present, the cold and heat only go up and down to around floor 10 and -10, respectively, and a quick trace error on world creation lets me know when the world is too tall for it.  It's interesting to watch, since sometimes the world sprawls out horizontally without too much variation in height (and I get no errors), while other times I get dozens of errors because the world is like a skyscraper.

Of course, it's not really an error, I just need to have the temperature make more sense.  But as a test for world-determined (instead of room-determined) flavor text, it works.  I will probably also mess with the odds of a change in z, so the skyscraper effect is more rare.

The real error I discovered when I did this is that I've connected rooms backwards.  At first I was confused as to why going down made things colder, then figured out basically when two rooms were connected, and one z is less than the other, the former room was connected above the latter.  That, of course, means that not only did I have my z logic wrong, but east means west, and north means south.  That was quickly corrected.

I also came up with a quick way to randomize what items are in a room, and as a test, a hallway may or may not have a painting hanging on a wall. I can also determine the exact odds of any given item in the moment of (potential) creation.  I may need to generalize this later, when the number of potential items gets large, but for a quick couple of lines, it works for now.

No comments:

Post a Comment