'Splitting enemy' combat concepting

Hi, sorry, new guy here. Having trouble figuring out how to go about implementing a type of enemy in my game.

I am building a combat system that involves locational damage. A person has at least one head, at least one torso, and an arbitrary number of limbs (arms, legs, wings, tails). But some enemies will have multiple torso segments in a row, like an insect or a centipede, with their own limbs.

The player can shoot locations to damage and then destroy the parts of an opponent’s body (a body part has [ok, wounded, disabled] states before it is [destroyed]). If a “person’s” head or all torso sections are disabled or destroyed they are killed.

I want to make a “centipede” type of enemy made of at least three torsos (but possibly an arbitrary number of torsos), and if a middle torso is destroyed, then the two separate end pieces can act of their own accord, continuing to fight separately with the limbs still attached, or even doing different actions according to their behaviour priority (e.g. shooting the rear segment off the centipede might cause it to scuttle away, while the rest of the centipede continues to fight, or result in the player having to fight two small centipedes at once).

I’m not looking for specific coding help, but how to implement the concept of this in Inform7 in broad strokes. How would you approach this?

Should I just be building a bunch of different length centipedes, store them in nowhere, and then swap out a 5-segment centipede that is cut in half for two 2-segment centipedes (or a 3-segment and 1-segment, depending on which torso piece is destroyed)?

Or should I be defining each separate centipede segment as its own person, store a bunch of them in nowhere, then make an arbitrary centipede out of the necessary number of them, but a body segment will only act on its own if the torso part ahead of it is destroyed/nonexistent?

Is there a better way I haven’t considered? Or is this a terrible idea, do not do this.

Also if this is not the right place to ask this sort of question - sorry.

1 Like

I think the first option is better. You might be able to modify this inform example about cutting rope to get it to work (Number 261, at the bottom):
https://ganelson.github.io/inform-website/book/WI_15_16.html

You wouldn’t necessarily have to pre-make the length of each centipede; instead you could just make the length a variable property that you change as needed. But pre-stored centipedes could work if you wanted the different sizes to behave really differently.

The example’s not perfect (you’d have to make tons of changes to accommodate for hitting different segments and stuff) but it could be useful!

4 Likes

This is probably the easiest way.

1 Like

If the longest centipede the player will encounter has N segments, then the most centipedes you can possibly have is floor(N/2). You can store that many in a repository off-stage and bring them on (setting their length values appropriately) as needed.

2 Likes