[Inform] Combat in games

10 views
Skip to first unread message

Rexx Magnus

unread,
Feb 18, 2004, 6:35:00 AM2/18/04
to
I've an idea of what to do for my first proper game - after scrapping the
hugely complex "Herbal" that I was working on. I'm going to keep some of
the structures that I had developed whilst working on that though,
otherwise it would have been wasted effort - but intend to put a little
combat into it somewhere.

For those that don't like combat or simulationism in a game, it will be
possible to simply 'nuke' an enemy, so the combat will really only cater
to the 'adrenaline junkie' so to speak.

However, I'm not sure how one would handle the 'modal' nature of combat.
It will be possible to escape from a fight by leaving the location, but
there will be penalties for doing so (you're likely to get stabbed in the
back if you do). Obviously, some actions will have to be 'free' such as
examining the location, and will not count towards your combat action.
I've no idea how to even start planning this though, as it seems to be
along the lines of the "Do you want to open the box? Yes/No" and expecting
a particular range of answers, whilst not totally ignoring something that
is irrelevant to the situation.

Anyone ever done this and might provide some general hints on how to get
started?

--
http://www.rexx.co.uk

To email me, visit the site.

Sam Denton

unread,
Feb 19, 2004, 8:02:20 AM2/19/04
to
Rexx Magnus <tras...@uk2.net> wrote in message news:<Xns949375DB541...@130.133.1.4>...

> I've an idea of what to do for my first proper game - after scrapping the
> hugely complex "Herbal" that I was working on. I'm going to keep some of
> the structures that I had developed whilst working on that though,
> otherwise it would have been wasted effort - but intend to put a little
> combat into it somewhere.

Herbal seemed interesting, based on your postings about it. I'll be
sorry to see it go without a chance to play it.

> For those that don't like combat or simulationism in a game, it will be
> possible to simply 'nuke' an enemy, so the combat will really only cater
> to the 'adrenaline junkie' so to speak.

[...]


> Anyone ever done this and might provide some general hints on how to get
> started?

No, I haven't, but I'm willing to guess. ;-) I'd model a fight with
an NPC similar to a conversation with one, only instead of
conversational topics, I'd use methods of attack:

Object FightStyle;
Object -> HighKick "high kick"
with
name 'high' 'kick',
description "You launch a high kick at your opponent's face.^"
;
[ fight_topics ;
addtoscope(FightStyles);
];
Extend first 'attack'
* noun 'with' scope=fight_topics;

Add blocking moves, a variable holding the last move by each side, a
matrix showing damage to both sides for each combination of moves, and
a meta command that inventories everything in FightStyle. Initially,
the player would do things at random, but over time would learn which
combos work best. You could do an entire game set in a boxing ring
that way.

Or, toss the FightStyle object and actually put the moves into the
player's inventory. The player could start with a few basic moves and
pick up more as the game progesses. Set the game in a martial arts
school, with opponents in different rooms.

Heck, you've got me salivating now.

Rexx Magnus

unread,
Feb 19, 2004, 8:48:01 AM2/19/04
to
On Thu, 19 Feb 2004 13:02:20 GMT, Sam Denton scrawled:

> Rexx Magnus <tras...@uk2.net> wrote in message
> news:<Xns949375DB541...@130.133.1.4>...
>> I've an idea of what to do for my first proper game - after scrapping
>> the hugely complex "Herbal" that I was working on. I'm going to keep
>> some of the structures that I had developed whilst working on that
>> though, otherwise it would have been wasted effort - but intend to put
>> a little combat into it somewhere.
>
> Herbal seemed interesting, based on your postings about it. I'll be
> sorry to see it go without a chance to play it.

It got terribly complicated, then when I started thinking "what would a
player think of this?" I got a bit depressed. There are about 26 herbs in
it at the moment, and trying to make sense of them all is a nightmare.
The unfinished 'exploration' is on my webspace at:
www.rexx.co.uk/if/Herbal.z5

I might actually finish it off, but once I'd got most of the mechanic for
gathering the herbs out of the way, the thought of trying to actually do
something with them got a bit daunting! :)

Good ideas. I've been contemplating something based on Crouching Tiger,
Hidden Dragon for a short while - it would be more like an art show entry
though, I guess, trying to cater for oriental visuals and suchlike, with
perhaps a more theatrical description of combat.

The other idea I have is along the lines of a D&D style combat routine,
where you have armour class etc, and simply make rolls for the combat.
After reading up on it a bit more, you're allowed to use the D&D system in
that way under the open game licence, but not use certain trademarked
things.

Herbal isn't going to go out of the window though, I'm going to reduce the
number of herbs significantly, leave in some of the mechanic for
collecting, give you something to do with them and hopefully attach a
plot. :)

Otis T. Dog

unread,
Feb 19, 2004, 8:54:25 AM2/19/04
to
Rexx Magnus <tras...@uk2.net> wrote in message news:<Xns949375DB541...@130.133.1.4>...
>
> However, I'm not sure how one would handle the 'modal' nature of combat.
> It will be possible to escape from a fight by leaving the location, but
> there will be penalties for doing so (you're likely to get stabbed in the
> back if you do). Obviously, some actions will have to be 'free' such as
> examining the location, and will not count towards your combat action.
> I've no idea how to even start planning this though, as it seems to be
> along the lines of the "Do you want to open the box? Yes/No" and expecting
> a particular range of answers, whilst not totally ignoring something that
> is irrelevant to the situation.
>
> Anyone ever done this and might provide some general hints on how to get
> started?


Again, the caveat is that I'm no expert, but...

I might try creating a Class Enemy that had the right react_before and
react_after routines. By checking for what you want to be "free"
actions, and returning false when they're detected, you can print some
illustrative text such as:

react_before
[;
Examine:
self.suppress_combat = true; ! if desired. set to false in
each_turn.
print "^You steal a quick glimpse while ", (the) self, " is
looking
the other way...^^";
return false; ! would be implicit in this particular case
]

or

react_after
[;
Examine:
print "^^", (The) self, " didn't seem to notice your
distraction. Lucky for you!";
return false; ! would be implicit in this particular case
]


-- Otis

Sam Denton

unread,
Feb 19, 2004, 9:58:05 AM2/19/04
to
Rexx Magnus <tras...@uk2.net> wrote in message news:<Xns949375DB541...@130.133.1.4>...
> Anyone ever done this and might provide some general hints on how to get
> started?

Another idea that's just occured to me: Program a Rock-Paper-Scissors
combat game. This would let you get the mechanics of the game done
without having to worry about the combat itself; then you could
replace the combat subsystem later with martial arts, sword-n-sorcery,
etc. http://www.cs.ualberta.ca/~darse/rsbpc.html has some code that
you could recycle into RPS opponents.

Rexx Magnus

unread,
Feb 19, 2004, 10:02:18 AM2/19/04
to
On Thu, 19 Feb 2004 14:58:05 GMT, Sam Denton scrawled:

Cheers - along those lines, I was just thinking:

"Your opponent prepares to attack, it looks as though he will attempt to
hit you low."

>Block with gedan barai (this would be for karate, for example)

(code comes into play with random variance that makes it hit either waist
or leg height, then if it ends up at let height, you block)

"You successfully block the blow, taking no damage." or
"You parry the blow just in time, but take some minor damage."

So yes, using kung-fu style terminology, that would work well for my CTHD
game. :)

Anvilsmith

unread,
Feb 20, 2004, 11:57:50 AM2/20/04
to
You know, I could give you some ideas on "herbal". I've written a lot
about fantastic (low-fantasy) herbs and cures for my dormant
Neverwinter Nights project, and I'm confident that I can find six
times as many distinct, original uses as you have herbs. Hell, I'm
willing to make this a bet, on whatever you feel like giving away.

> "Your opponent prepares to attack, it looks as though he will attempt to
> hit you low."
>
> >Block with gedan barai (this would be for karate, for example)
>
> (code comes into play with random variance that makes it hit either waist
> or leg height, then if it ends up at let height, you block)

This is an approach to simplicity that fails to give more
entertainment than a slot machine... It's like cheating at
rock/paper/scissors. The different attacks and defenses you could have
with this system would either be rigidly divided or different only in
their power. For instance, if you were to receive a pie slam attack,
there are three things you could use in this system:

1.The banana knife move. It's naturally fit against pie slams.
2.The muffin puff technique. It might be less effective than the
banana knife by default, but hey, you've put a lot more skillpoints
into it.
3.The crimson sun retreat. He who runs like a coward lives like a
coward.

If no skillpoints exist, the list of choices comes down to two: fight
with the best attack (which might as well be picked by the computer)
or run. Not really a combat system, but it has proven effective,
functioning in just about every casino in the world. To create an
honest combat system, you'll have to intersect abilities, draw them
out of their uniqueness and encourage the player to decide between
them. If his decisions are a direct consequence of your feedback,
you've built yourself a reflex training program, nothing more.

Every RPG I've seen uses a divided architecture for its characters:
they may install abilities in "equipment slots" or build a few of them
directly (a lot of times unconsciously) using an XP system. Some
abilities affect others when used: magic in Arcanum increases fatigue,
which might temporarily prevent the character from casting new spells
and place the character at risk. A stunning attack forbids the
conscious use of some abilities, but automated "synapses" between
abilities still function. Losing all HPs causes you to lose all
abilities, including the ability to restore your HPs, until someone
affects you with a specific ressurection ability.

Try to forgo the appearances of combat systems, and understand that
their structure is never as rigid as most games strive to make it.
Once you hold the abstract principles of combat, you can shape them as
you desire, without the limitations of your prejudice. Just create
some links between hollow elements, which you can later fill with
meaning. As long as they would make a good puzzle game, you're set.
After that, it's only a matter of projecting real life ideas into the
system... And if D&D could get away with quanitfying physical health,
you can do just about anything. If you know some eleventh-grade
mathematics or can deduce the principles of cybernetics, you'll have
the mental tools to create highly compact systems, whose complexity
operates on a small number of elements. This is the sort of system I
expect you want for an IF.

As you yourself have stated, having the manifestations (in your case,
the herbs) before you know the principles (the uses for these herbs)
can lead to a lot of editing. Just figure out an abstract system, one
that shares a few things with the abstract principles of the IF (for
example, the fact that some abilities, like items, are unique).

I can't say what kind of system would work for you, as I have no idea
about your setting or special rules, so I suppose I could design a
combat system that worked well on typical text-adventure IFs. It would
have to rely on the folling principles, among others:

-objects may hold any complex of abilities
-in the case of actors, however, those abilities may not be
quantified, unless they take the form of other objects (so a bit of
flesh would be added to the zombie character's inventory when someone
cut him down, or a little sapling would appear from the treant's
splinter, or the kelvar vest would take an extra bullet-hole, but no
HPs would exist)
-objects may hold any complex of abilities, but show only a few of
these at any time. The rest are kept latent, if they exist at all.

Do you think it would be useful for me to provide a sample? It would
have to be quite long and tedious to read, but so is the Inform code,
I suppose.

Rexx Magnus

unread,
Feb 20, 2004, 12:52:56 PM2/20/04
to
On Fri, 20 Feb 2004 16:57:50 GMT, Anvilsmith scrawled:

> You know, I could give you some ideas on "herbal". I've written a lot
> about fantastic (low-fantasy) herbs and cures for my dormant
> Neverwinter Nights project, and I'm confident that I can find six
> times as many distinct, original uses as you have herbs. Hell, I'm
> willing to make this a bet, on whatever you feel like giving away.
>

Well, I've got 25 herbs, which are all tied to a runic association (through
their links with trees and various other principles), so finding the
uses/puzzle element wouldn't be hard - it's just that expecting someone to
go through the tedium of it all would be quite a request.

For the IF that I eventually produce though, I'm going to reduce the number
to far less, give them fairly obvious associations, and have them used in
the preparation of a spell, which will reveal another clue for a different
puzzle.

I don't think that I'll be putting the combat in that game though, as I've
had a few other good ideas about how to make the combat a bit more logical
than random, and not as simplistic as roshambo. That will be suited to the
other game that I'm thinking of doing.

Herbal, in the state that it's in at the moment, will simply be left as more
of an experiment - as it was basically my first IF, and I used it to lay the
foundation for manipulating the types of objects that I'd have in a game.
The ideas will still be there, but the whole thing will be a bit easier to
pick up and put down. 25 plants (and more once split up into bits) was quite
horrendous to handle in an inventory.

I'd actually started on doing something similar to it in a practise module
for NWN, but the stopping point is, as usual for me, the plot. :)

Coorlim

unread,
Feb 20, 2004, 1:14:32 PM2/20/04
to

"Rexx Magnus" <tras...@uk2.net> wrote in message
news:Xns949375DB541...@130.133.1.4...

I've mucked with three different combat systems thusfar, all loosely based
on different rpgs. Note that I work in TADS, but I'll steer clear of
specific code.

1) "GURPS style combat"
Each character has a Combat Skill value and a Defensive Skill value (I
called them unarmedSkill and unarmedParry). To try and hit someone, the
player entered the attack command (KICK NPC, PUNCH NPC, etc). This
generated a random number. If this number was over thier Combat Skill, it
was a miss and a message was displayed to that effect. Otherwise, the
defender generated a random number. If this was below thier Defensive Skill
(usualy 1/2 to 2/3 of a Combat Skill) they managed to dodge or parry or
whatever, and a messsge was displayed. If the defence failed, the attack
hit, subtracting health points based upon the type of attack and the
strength of the attacker.

2) "Feng Shui style combat"
Each character has a combat skill value. When you attack a foe, you
generate a randomly positive or negative number and append that to your
combat skill to get an Outcome. If thats higher than your opponents combat
skill value, you hit, doing damage based upon your strength, how much you
hit by, and how you attacked.

3) "FUDGE based Combat"
Each character has a combat skill. At the begining of each fight scene, you
add a random variable to each combat skill. Whoever has the highest wins
not the round, but the entire fight, with the degree of victory present in
how much better they did in the compared roll.


Anvilsmith

unread,
Feb 21, 2004, 9:36:06 AM2/21/04
to
> Well, I've got 25 herbs, which are all tied to a runic association (through
> their links with trees and various other principles), so finding the
> uses/puzzle element wouldn't be hard - it's just that expecting someone to
> go through the tedium of it all would be quite a request.

Depends on the type of puzzles, the meaning of the herbs and the
entertainment factor of the puzzle itself. Bone Kenning, one of the
coolest NWN I ever played, had a simple skeleton-building system in
it... And people loved to tinker with it. I can also personally say
that I enjoyed the skill use descriptions of Harshlands MUD, even if
they prevented me from role-playing to the fullest (well, actually,
they did... Since I wasn't emoting so much, I could finally get to the
"role" part). What would be tedious about working with herbs? Having
to wait for them to boil? Learning what they do? That's really not a
problem - you could introduce an interesting teacher, give the herbs
some meaning that the player must understand before using them, .
You've still got the issue of a plot, though I've found that by simply
having a good character or even a principle, you can grow from very
little to too much.

Having too many plants in your inventory can be fixed in a number of
ways: create an "herb pouch" that contains a list in its description.
Sort them by category, with "[size] bundle of black herbs" describing
the overall number/class, and its description detailing the specific
herbs. Make it so a plant becomes another one when a magical effect is
applied to it. This would work better with runestones - having five of
them, with the unenchanted batch providing the enchantment spells,
allows you to create a grand total of 25 possible stones while storing
only five at a time. Alternatively, place inventory limitations or a
generous decay rate.

With a good, automated parsing system, you might not even need to use
these things. Create a command like "count mistletoe leaves" for when
the player is looking for these, a "tag leaves 40" to inform him when
he's reached a certain number of them, a "store leaves pouch" to tell
the game where leaves should be put or... Well, there are a lot of
things you could do to make your game more user-friendly.

In my own game, I didn't bother writing descriptions for crushed, cut
and heated versions of the same leaf, not just because of the graphics
issues, but because it was much more convenient to use a crafting
system that takes in all needed materials and gives out only the
result.

Rexx Magnus

unread,
Feb 21, 2004, 10:56:17 AM2/21/04
to
On Sat, 21 Feb 2004 14:36:06 GMT, Anvilsmith scrawled:

> In my own game, I didn't bother writing descriptions for crushed, cut
> and heated versions of the same leaf, not just because of the graphics
> issues, but because it was much more convenient to use a crafting
> system that takes in all needed materials and gives out only the
> result.

That's a good alternative, actually. I think I might do that - getting the
inventory to blurt out the right pieces (and the resulting horrible object
tree) was a bit complicated.

Sam Denton

unread,
Feb 22, 2004, 12:11:07 AM2/22/04
to
Rexx Magnus <tras...@uk2.net> wrote in message news:<Xns9496A221AF6...@130.133.1.4>...

Do you know about 'list_together'? I've used it to good effect in my
current project, "Expense Report":

Constant SOMETHING "something, but you don't remember what";
Constant BFAST "breakfast";
Constant LUNCH "lunch";
Constant DINNER "dinner";
[...]

Class Receipt(50)
with
receipt_for 0,
article [;
if (listing_together ofclass Receipt) print "one";
else print "a";
],
name 'receipt' 'receipts//p',
description [ ;
print "A receipt.";
],
short_name [ ;
if (~~(listing_together ofclass Receipt)) print "receipt ";
else print "one ";
print "for ", (string)self.receipt_for;
rtrue;
],
plural [ ;
if (~~(listing_together ofclass Receipt)) print "receipts ";
print "for ", (string)self.receipt_for;
rtrue;
],
saved 0,
list_together [ ;
if (inventory_stage == 1) {
print "a collection of receipts";
if (c_style & INDENT_BIT == 0) print " (";
else print ", ";
self.saved = c_style;
c_style = c_style | (ENGLISH_BIT + NOARTICLE_BIT);
c_style = c_style &~ (NEWLINE_BIT + INDENT_BIT);
} else {
c_style = self.saved;
if (c_style & INDENT_BIT == 0) print ")";
}
],
parse_name [ i flag;
if (parser_action == ##TheSame) {
if (parser_one.receipt_for == parser_two.receipt_for)
return -1;
return -2;
}
for (:: i++, flag = false) {
switch (NextWordStopped()) {
'receipt','for': flag = true;
'receipts': flag = true; parser_action = ##PluralFound;
'something','other':
flag = (self.receipt_for == SOMETHING);
'breakfast':
flag = (self.receipt_for == BFAST);
'lunch':
flag = (self.receipt_for == LUNCH);
'dinner':
flag = (self.receipt_for == DINNER);
[...]
-1: return i;
}
if (flag == false) return i;
}
],
create [ my_receipt_for;
if (my_receipt_for == 0) {
self.receipt_for = SOMETHING;
} else {
self.receipt_for = my_receipt_for;
}
];

Rexx Magnus

unread,
Feb 22, 2004, 5:21:02 AM2/22/04
to
On Sun, 22 Feb 2004 05:11:07 GMT, Sam Denton scrawled:

> Do you know about 'list_together'? I've used it to good effect in my
> current project, "Expense Report":

Thanks for that, I think I noticed it briefly in the past, but didn't read
up on it much. I don't really know a great deal of inform, and don't
understand most of what I'm doing, I think. :)
Just learning new things as and when I need to do something!

Sam Denton

unread,
Feb 22, 2004, 12:10:14 PM2/22/04
to
Rexx Magnus <tras...@uk2.net> wrote in message news:<Xns9497694AF75...@130.133.1.4>...

> On Sun, 22 Feb 2004 05:11:07 GMT, Sam Denton scrawled:
>
> > Do you know about 'list_together'? I've used it to good effect in my
> > current project, "Expense Report":
>
> Thanks for that, I think I noticed it briefly in the past, but didn't read
> up on it much. I don't really know a great deal of inform, and don't
> understand most of what I'm doing, I think. :)
> Just learning new things as and when I need to do something!

Yeah, I didn't know beans about 'list_together' until I decided to
code my receipts. I lifted much of the code from DM4, although there
were lots of tweaks to get things to print just the way I wanted them.

Stick the Receipt class in a game along with a few copies of code to
create receips, then do some inventories, looks, etc.

x = Receipt.create(LUNCH); ! Ditto for BFAST, DINNER, etc
if (x ~= nothing) {
move x to player;
print "You get a a receipt";
}

Here's some sample output from my game:

>i tall
You are carrying:
some money
a collection of receipts, one for lunch and three for dinner a
floppy disk
a to-do list

>i wide
You are carrying some money, a collection of receipts (one for lunch
and three for dinner), a floppy disk and a to-do list.

(Hmmm, I just noticed a bug (missing new-line) in the "i tall"
output.)

BTW, I don't think that would be too hard to have the list_together
routine just print "a collection of receipts" in 'inventory' and
'look', and have 'look at receipts' give you a more detailed listing.
I suspect that that's what you were trying to do on your own.

Reply all
Reply to author
Forward
0 new messages