Dynamic monster mutations

A really cool concept I have sorta been playing with in one of the Inform 7 games I am making is mutation. The theme is that you are in a post-apocalyptic wilderness and there are mutants everywhere who can infect you with with their creepy diseases. I won’t delve into all the icky horror stuff here, but what I want to do is, when you are battling a mutant, have a random chance of them passing on one of their specific mutations to the player or making some other mutation worse. :stuck_out_tongue:

The problem I’m running up against is that I don’t want these mutations to just be on\off variables or numbers on a chart, I want to be able to give the player really specific mutations, like an extra head or leg, and then have sub-mutations affect each part of each head independently, so one has, say, four eyes of different sorts and the other has two noses of different kinds.

Is there a good way to do this at all?

[pedant]Mutations do not work that way.[/pedant]

It sounds as though you want each mutation to be a thing that can become part of the player, and every mutant to be connected to a mutation (or some number of mutations) that it can give you.

So, something like this:

A mutation is a kind of thing.

The null-mutation is a mutation.

A mutant has a list of mutations called mutie-list. The mutie-list of a mutant is usually {null-mutation}.

(You could also use relations instead of calling out a list.)

So when the mutant attacks, you refer to that list and do whatever you want to select which mutation or mutations are going to affect the player, and then once the crucial moment comes:

if local-mutation is not null-mutation, now local-mutation is part of the player;

(Local-mutation there is a local value that you’ve already set to some mutation.)

I’m not quite sure how you want sub-mutations to behave, other than changing the specific number of noses or whatever. If you just mean that every time the Enlegginator Beast attacks you you grow an extra leg, then all you really need is a number attached to mutations that can be added to when a mutant tries to give the player a mutation that’s already part of them.

Obviously the details depend on how exactly your combat system works, and how you want to describe those mutations to the player.

Yeah, I know, but half the fun is making the player guess what’s going on. :laughing:

Your idea is really cool and sounds like it would be useful, though I’m not sure I really understand how it works in practice. Could you explain it a little more? I’m guessing each mutant would have a table of possible mutations that they can give the player?

I think that what I would like to do is divide the parts of the players body into zones like the head, face, eyes, nose, ears, and so on, and apply diseases from a list to each one. Some of the diseases would stack but, for the moment, I think that I would like to make it so each part of the body can be swapped for a diseased part from a set and make it so that the player can acquire any number of additional body parts that can each gain their own set of specific deformities. That would mean that you can end up having any number of a specific body-part, each with their own set of deformities, without any of those deformities conflicting. I could then stick more general maladies and illnesses on top of that.

Is there a way to basically hot-swap body parts and alter the variables applying to each one without me having to make a complete set of duplicate variables for each one and then hide them? I thought about doing this but I realised that the player would only ever be able to have as many arms or heads as I make duplicate hidden versions with duplicate hidden variables, all of which I need to keep track of. Maybe I could treat all the parts like objects and store them somewhere? But then, how would I prevent the player treating them like clothes?

Make the ‘mutations’ magical or supernatural in some way. There are so many wrong things in here for science, it is better to set it apart from actual genetics, otherwise lots of us pedants will be significantly curtailed in our ability to suspend disbelief and just enjoy the story.

People make this mistake constantly and when there are inevitable complaints they say, ‘It’s just a fantasy lighten up’ as if that is a realistic expectation that people who care will somehow convince themselves not to care. But that just isn’t going to happen, so what ‘lighten up’ actually means is, ‘If you care about accurate science in science fiction then I am not interested in you as a reader/player.’

I was really just going to leave it up to the player to decide what was going on. :stuck_out_tongue: If you are vague enough about stuff like that the player will be happy enough filling in the blanks for themselves. After all, no matter what explanation you give for something you are going to put someone’s back up.

0k, gone and made a test version of the script setting out some basic stuff and it all seems to work and I’m ready to start playing around with the mutations. They way I have it set up is I am going to have a room full of limbs I can give to basically anyone and mutate at random. The snag is that whenever I try to use a variable that has been applied to all body parts of the same type I get this run-time error:

Can anyone tell me what I might have done wrong?

Of course you’re free to write your story in whatever way you like, and you may be fantastically successful and effective. All the same, what you’re saying here makes me a little uneasy.

My own rule of thumb is that the reader/player would like to have confidence that he or she is in the hands of an author who can be trusted.

This doesn’t mean your game has to be scientifically realistic! You can be as over-the-top absurd as you like. (Terry Pratchett comes to mind.) But no matter where you go, you need to know where you’re going, and your audience needs to feel that you do in fact know where you’re going and what you’re up to, even if you haven’t yet revealed the details to them. If you’re going to indulge in Pratchett-level absurdity, it’s a good idea to be consistent about it, to work out the absurd fantasy rules of your make-believe world and stick with that one set of rules.

As a writer, I find it difficult to slide a playing card between “vague” and “sloppy.” Maybe there’s a difference, but I think one can easily be mistaken for the other. And no reader/player wants to spend time with the work of an author who is sloppy.

Well, you’ll get the most help if you post the relevant code block. In this case, from what you’ve said, the error message seems probably accurate; you’re referring in code to some property of some thing which doesn’t have it.

Obviously, you’d have to be pretty confused to write that of a fixed thing explicitly, so the problem most likely lies within an implicit loop over things (“all body parts”, “all mutated body parts”, etc) referring to properties thereof.

The code you mentioned referring to all body parts of a certain type seems like the most likely culprit. Try commenting out one or several lines at a time until you no longer see a runtime error to narrow it down precisely.

Ooops, right, sorry. I meant to but then I didn’t. :laughing: Here is the script.

[code]The Body Shop is a room.

Body Part is a kind of thing.

[BODY PARTS]

head is a kind of Body Part. head is a part of every person. HeadType is a kind of value. The HeadType are humanhead, oddhead and nastyhead. Every head has a HeadType. The HeadType of a head is usually humanhead.

extrahead is a kind of head. There is an extrahead in The Body Shop. [Every extrahead has a HeadType.]

A person has a number called HeadNumber. The HeadNumber of a person is usually 1.

A face is a kind of thing. A face is part of every head.

eyes are a kind of thing. eyes are part of every face.
[/code]

Can anyone see anything I might have done wrong? Basically this is a variable attached to the players head I’m trying to call.

It’s a run-time problem, so it shows up when you try to do certain things in the game. The problem presumably lies with the code for doing those things, rather than with your definitions of bodyparts.

How are you trying to use the property?

Maybe you’re saying “the headtype of the head” instead of “the headtype of the noun” or “the headtype of the item described”? Referring to “the head” is always a bug.

It was the headtype of the player, head type of the head didn’t work at all. Is there a way for me to apply just one set of variables to all body parts and be able to check and set the type of each part? If there is a way to do that I think it would be far easyer and less limiting than making one variable per body part, including duplicates.

0k, now, this is basically what I have done: I have a single root ‘thing’ called body part. This root thing now has the above variable attached to it, which means that the program should attach a copy of this to every subtype. I have tested this with an ‘To say’ script and as long as the object I want to reference is ‘the noun’ I am fine and can use stuff like this:

If the BodyType of the Noun is X:

The snag is that short of some method of physically setting the noun every time I want to use it, including mid-conversation, I am basically stuck as I can’t refer to anything that is not the noun. Does anyone know how I might be able to say something like this:

if the BodyType of the player's head is X:

I would not have expected this ‘property only referrable on “the noun”’ behaviour. This is never true of Inform in my experience. Once a property is defined on something, it is always referrable unless it’s a derived property (i.e. calculated on the fly, for which you would have to use the ‘Definition’ syntax). As I recall there are some contexts in which calculated properties cannot be referred to, but if you are not defining calculated properties then any ordinary property should always be referrable on an object – not just when it is ‘the noun’. There must be something else going wrong; sorry I can’t be more help.

I think the problem is that Inform isn’t understanding “the player’s head.” You should check the Index to see exactly what the object you’ve created is called.

In general, if I remember correctly, Inform doesn’t understand apostrophe-s in source code the way you think it might. For instance, if you have “A person has a number called health.” then Inform won’t understand “the player’s health”; you have to say “the health of the player.”

BUT when you create things with a line like “A head is part of every player,” then the head that gets created for “Bob” will be given the name “Bob’s head,” and so on for everyone else. Which means you can refer to it as Bob’s head in the source code – but the apostrophe-s isn’t getting understood as something that has to do with Bob, it’s just part of the name of the object you referred to! (It’s just as if you had outright declared “Bob’s head is on the table.”) This also means that if one of your characters is John Brown, you can’t refer to “John’s head” – only “John Brown’s head” or “Brown’s head” will be referred (or the player might even be able to call it “john head”).

Anyway, “the player’s head” isn’t being understood because that object isn’t named “the player’s head,” I think. Check the Index to see what the name of that head is and you can fix that. (I think it might be “yourself’s head.”)

This is all assuming that you never change who the player is in the course of the game. If you do, then you need to write some code that actually refers to the player – “a random head that is part of the player” would probably work. (Why random? Because at compile-time Inform doesn’t know that only one head is part of the player.)

Laroquod, I’m still kinda new at this, could you explain how you might try to check or change a variable attached to the player’s head without using a noun so I can see if I’m doing it properly? :confused:

Ok, I read through the Index several times and I can’t see the variable or the body parts kind anywhere and they don’t show up in searches. I tried “if the Cond of yourself’s head is human:” but I just got an error:

“if the Cond of yourself is human:” on its own works fine but it isn’t very helpful as I only apply the variable to the player themselves when I want to check if I can make a particular phrase like ‘yourself’ work in general.

It wouldn’t be any different from the example code you’ve already posted, except that I would have typed ‘A head is a kind of body part’ and ‘A head is a part of every person’ though I doubt that would make any difference. Oh, and instead of using ‘yourself’ I would have created a person object to represent the player and then assigned the object to the player with ‘now the player is [player object]’. But that probably won’t make a difference either because according to the i7 manual, ‘yourself’ is supposed to be a person object, anyway.

EDIT: Having read Matt’s advice, I would create a player object with ‘The playerobj is a person.’ so then that should get a noun called ‘the playerobj’s head’ and that should work instead of ‘the player’s head’, if ‘yourself’s head’ didn’t. The thing is ‘player’ isn’t the name of an object, it’s a variable that could refer to any object but happens to refer by default to the yourself object.

Sorry, I should’ve been more clear on how to search the Index. In the Inform IDE you can click “Index” along the side of the window to get an Index of all the stuff that’s in your game. Then you can click “World” along the top of the window and you get a listing of all the rooms and things that you’ve defined. I didn’t test this earlier because I didn’t have Inform fired up but now I can see that the relevant part is this:

(You can’t see this as it’s pasted, but all of this is indented to show that, for instance, your head’s face’s eyes is part of your head’s face.)

This tells us that the name of the object you want to code in the source is “your head” as opposed to “the player’s head” or “yourself’s head” – sorry about that. So try “If the Cond of your head is…” and see if that works.

Also, if you are using Playfic, I don’t think you can to the Index.

Arrrrrrrgh.

ARRRRGH.

I worked it out. It’s so freaking simple. So, so, freaking simple. :laughing:

if the Cond of your head is human:

What the hell was wrong with me saying “the X of the player” or “the player’s X”? ARRGHH.

Oh well, I’ve fixed it now so I don’t have to write a big ugly work-around. :stuck_out_tongue: