UrsulaV (ursulav) wrote,

Total Esoteric Game Crap

So I messing around with Twine, trying to figure out how to work the skill system.

You've got skills that display on the sidebar. (Well, I made them display on the sidebar.) Each skill is represented as a variable: $skill

But if you simply increase by a point every time you do something--say your $hunter skill increases by 1 every time you poke a hamster with the Pointy Stick--you are going to level really really really fast and everybody's going to be level 80 before they're bored. And if hamsters are worth 1, then a mammoth ought to be worth, what--10? 20? A MILLION?

If poking a hamster is not worth 1, though--say it's only worth .1, or .2 or whatever--then your sidebar is gonna be all "Hunter: 37.822" and that's inelegant as hell.

So I get this idea--I will make a hidden variable! I can do that! I will make $hidden_hunter and it will go up by 1 when you poke the hamster and 10 when you poke the mammoth, and whenever it gets to 10, your $hunter skill goes up by 1 and the $hidden_hunter skill decreases by 10 (so that if you were at 3 when you poked the mammoth, you wouldn't lose the extra points in the rounding down.)

And furthermore, because there is a handy function called visited() that tracks how many times a player has visited a particular "room" (I'm thinking of them as rooms--the node map looks like an old-style dungeon crawl) I can set the whole deal so that if you have stood over the body of 10 dead hamsters, you are done learning about hamsters and no longer derive benefit from poking them.

I was very proud of this.

It is probably quite inelegant and there is some crap I should be doing with objects or Javascript or god only knows what, but y'know, for basically having the code skills of kelp, I was rather proud of myself for having solved the problem this way.

Even Kevin admitted that it was impressive--at least, that I'd come up with it, not that it was a great solution, although he did not propose a better one and only muttered something about objects and told me to go write my hamster poking commands and he would see what he could do to make it easier to work with. And undoubtedly all you code monkeys at home are going "But you could just do this thing. Once. Over there. And then it would handle it FOREVER."

But seriously, for me? This crap is rocket science. I'm gonna sit here and be smug for a least five minutes, or until everything else in the game breaks.
  • Post a new comment


    default userpic

    Your reply will be screened

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
← Ctrl ← Alt
Ctrl → Alt →
← Ctrl ← Alt
Ctrl → Alt →