Single Combat with the Sword: A Prototype

You make some good points, I think.

In particular, you remind me that I had already planned on having a variety of level and puzzle types, the latter including traversal (jumping, climbing, getting from A to B, etc.), secrets (hidden levers and doors, etc.) and more. Perhaps an answer, then, is to be careful of which levels have more or tougher enemies, with levels that revolve around heavier puzzle-solving tending to have fewer or no enemies, or simply weaker opponents.

The other thing to do, I think, is to create a test level, then both play it and post it for feedback. (Doing so is going to take a little time, I think.)

This has been one of the directions of thought that I’ve been exploring of late; the main problem that I keep hitting is that I’m not finding a mechanic that works for me: that’s fun, interesting and challenging; doesn’t rely on reflexes; and that nevertheless conveys the danger of combat.

Heh, no, for the most part I don’t intend the puzzle-side of things to be quite as merciless as Riven!

I do intend to have an over-arching puzzle, but at the moment I’m thinking more in terms of clues being scattered around the world than having to experiment several times with machines halfway around the world in order to solve the puzzle.

IMHO, it isn’t strange at all to see combat mixed in with that kind of puzzle fare. Most every platformer ever made, the tomb raider series, marathon series, etc. Even more so if timing is a factor in some of said puzzle types, like evading or riding moving objects or trying to get somewhere before a door closes or the room you are in collapses or fills with some form of deadliness.

Another idea is to make the spawning of enemies a consequence of not solving a puzzle correctly.

Maybe opponents with very different styles of weapons. Such as a morning star that is slow to spin up and can knock the player’s sword completely out of the way if contact is made with the star, but it loses all momentum if contact is made with the chain.

Or opponents with emotional issues. Like an enemy that gets angrier the more times in a row you block its strikes, until after half a dozen or so it starts throwing very heavy blows around, which will break through your guard if they connect, but involve longer wind up and recovery, so you have an easy time sidestepping them and then immediately counter attacking.

Or perhaps the combat surroundings provide an edge against the enemy. Like leading an opponent into side stepping in front of a swinging pendulum or off a cliff.

A good point; indeed, I think that this might well work with those types of level. :slight_smile:

Hmm… That’s a thought. I think that I’d want to be sparing in doing so, however, especially with trickier puzzles, and would want to be careful to keep the appearance of a new enemy plausible. (This isn’t intended to be a game in which enemies can just appear out of nowhere.)

(Funnily enough, I have at least one possible scenario in mind in which correctly solving a puzzle results in an enemy: the puzzle opens a tomb, which wakes a guardian between the player and the door… I do also have it in mind to have (rare) cases in which opening a secret reveals a surprise enemy.)

I think that I was thinking more in terms of designing something different; something not action-based, but rather puzzle-based.

Your suggestions, however, contain some interesting ideas for this combat mechanic. I had indeed had some ideas for individual enemies–an enemy that an occasionally teleport behind the player, or one that always takes at least some damage from a hit–even a blocked hit–but that does a lot of damage, making defence more important–for examples, but the specific ideas that you mention hadn’t occurred to me. I particularly like the angry fellow. Thank you. :slight_smile:

With regards to the combat environment specifically, I’ve given that some thought–one of my combatant ideas involves the AI using objects in the environment–but I’m hesitant to make navigation too complex, or take too much attention, given how complex the combat already is. I’m wary of making the same mistake that I feel that Die by the Sword made: having an interesting, complex swordplay mechanic, but then overwhelming the player by introducing other elements for them to pay attention to.

New version!


[]Two new weapons (for the enemies only, I’m afraid): an axe and a mace.
]The axe deals more damage than the sword, especially to the arm.[/]
]The mace deals more damage still, albeit in much the same balance as the sword. However, it also stuns the victim briefly.[/*]

]The game is now restarted using the number keys; if I recall correctly:

[]1 restarts against a sword-wielder.[/]
[]2 restarts against an axe-wielder.[/]
[]3 restarts against a mace-wielder.[/]
[]4 restarts against a randomised enemy. Specifically, this not only randomly selects a weapon, but randomises as set of variables within the AI, potentially altering its behaviour.[/]

]Various tweaks and alterations to the AI; it should hopefully be improved now.

[]For one, the “universal parry” has once again been undone–please let me know if it manifests any new incarnations![/]

]Player input has been tweaked.

[]This includes a change that prevents the player from leading with the back of their sword (as was previously possible).[/]

]Miscellaneous changes.[/*]
Known issues:

[]There is still at least one exploit that I’ve found; at the moment the only noteworthy idea that I have for countering it is detecting patterns in the player’s attacks: doing this once or twice, or at various intervals, should work (it’s a valid move, I feel), but exploiting it shouldn’t (the AI should see it coming if the player keeps doing it). I hesitate simply because that sort of AI pattern recognition isn’t yet one of the arts with which I am familiar.[/]
[]Some physics issues remain. :/[/]

It is definitely more challenging overall. The AI seems to have the advantage at stationary parrying. It is very difficult to match its speed and precision. As a result, I found I must always be throwing more blows out at it than it throws in at me, to somewhat break even.

Using constant side stepping with (semi-blind) sideways swings at the head level puts the AI at the disadvantage though. This strategy is not as effective as it used to be and it can be hard to tell why some blows hit and others miss, but it is still the most effective way to win.

Some ideas:

Forward and backward movement, in addition to side stepping. The ability to attack and retreat for even a fraction of a second at a time would give you a chance to think about what you want to do next. And it would allow the AI to back away from scenarios where it may be getting exploited.

Having the sword stay extended as long as you hold down the LMB, even after it makes contact with the opponent’s sword might be better. The effect of having the sword and player character auto-retreat when contact is made feels jarring and confusing. It seems like the one time where you (suddenly) lose direct control.

Thank you! :slight_smile:

This is good–what I’m developing here is intended to be the highest difficulty setting, with lower settings introducing various measures to make the AI weaker (including such things as longer pauses after parries).

Hmm… I think that I know what causes this (a particular angular value that I reduced, thinking it less important), but experimentation is called for. If I’m correct, then I should be able to have the AI simply sidestep away from such attacks.

Hmm… I’ve thought about this, but I’m hesitant to instroduce more controls, especially movement controls: I don’t want control of the character to become overwhelming. I do intend to give it further thought, however.

I can experiment with this, I do believe.

That seems like clearest way to provide a range of difficulty levels. That is, to focus the challenge on reaction time and precision, which are natural AI strengths, and then dial these down as needed.

There is also another approach (with pros and cons) which is to introduce challenges that rely on anticipation, which is a natural human player strength, to help counteract the natural AI strengths.

Anticipation can come from having short delays and other limiters to follow-up actions, built into the physical simulation itself (rather than just the AI). Like if you (very abstractly) simulated footwork, so that maybe committing to a double sidestep would create a short delay before you could step opposite or advance or retreat, because your the character has to first arrest its momentum and reposition the feet. That commitment to an action, which narrows the list of follow-up actions it can immediately take, allows a human player to anticipate what the opponent may try to do next.

Anticipation also comes from situations where there is no static and objective way to determine which of two similar courses of action is best. For example, you can parry or side step, and these each may have different strengths and weaknesses, but are similarly useful defensive maneuvers. A static AI might be best off randomly choosing between the two and expect an opponent to be equally likely to use either. But a human player can feel free to go all in on one maneuver, because a static AI won’t see the pattern and begin to anticipate repeated actions. A machine learning AI might eventually start to see the pattern, but then the human player could anticipate and exploit the AI’s learning pattern, such that as soon as the AI anticipates another repeat of an action, the human cleverly does something else.

Well currently the LMB seems to lunge you forward, you just don’t have a control for retreat. Thus, I find that when challenged by the AI, I tend to spam sidestepping as a replacement for backing up (which is my first instinct). This gets rather strange because I end up spending most of the match with the enemy completely off screen, since my character side steps faster than he can turn to face the enemy and I am constantly in motion for maximum evasion. A solution for this may be to have the ability to back up until your back is against a wall and make side stepping a bit more limited somehow.

Also, I think since WASD is such a universal paradigm in combat games, it feels quite odd whenever you don’t have it (even if you still have A and D).

That’s an interesting thought…

Indeed, it reminds me of one of the games (or rather a game series) that inspired this mechanic: Quest for Glory. That series didn’t have this control mechanism, but also focussed (for most of the series, at least) on single combat. In that case, however, the mechanic was built around spotting “tells” from the opponent–little animations that they performed before actions–and responding accordingly: ducking below high cuts, dodging to the left when the attacked on the right, attacking when they were open, etc. On top of that, I seem to recall that it included a degree of the machine learning that you mentioned: enemies would notice if you repeatedly used the same attack, for example, and respond accordingly, which could then be exploited to get them to make mistakes in their defences. It was a rather fun mechanic!

An element of machine learning is something that I’d like to include to some degree, I think; for one thing it might help the AI to deal with one exploit that I know about that involves attacking in a certain pattern.

I’m not sure about switching more generally from my current “reaction” basis to an “anticipation” basis, however: it seems like quite a big change to experiment with, given that this version seems, at the moment, to be working out. That said, I do think that it’s an idea that might be worth revisiting if I later find that this “reaction”-based system is unsatisfactory.

Yes, but that’s a lunge, not actual advancement: you return back to your en garde position once the attack is done.

I do see your point, but I’ll confess that I’m still hesitant.

The thing is, a control mechanism rather similar to this has been done before–indeed, said predecessor was another of the inspirations for this. That game, Die by the Sword, had the player not only control the sword arm of their character, but also move about freely in the environment. The result could be a bit of a nightmare to control, as I recall: handling all of that in real-time could become rather overwhelming.

As a result, I’m reluctant to add much complexity to the game, and hesitate to add to the controls. I do see your point about the intuitive desire to simply step back, however, and intend to give it further thought and perhaps experimentation.

This versions quite a bit more of a challenge! I can only seem to hit the AI once or twice before dieing.

Oooh. Right - thats fair enough then :slight_smile:

IMHO I think the camera view is a bit loose, particularly when the AI sidesteps.

Indeed - was awesome but terrible. I don’t think it had the concept of ‘z-targeting’ like Zelda, which is a joy to play compared to Die by the sword.

MWAHAHAHAHA!!!- Ah, I mean, oh, I’m sorry to hear that… :stuck_out_tongue_winking_eye:

I’m glad to hear it, thank you! :slight_smile:

Noted; I’ve made it a little more responsive now, I think, although more experimentation may be called for. :slight_smile:

New version!


[]Difficulty levels!
]Open the options menu and select the “Combat” tab; the difficulty settings should now be available there.[/]
]These settings are still somewhat nascent, and so may be somewhat unbalanced.[/*]

]Further tweaking of the player-input mechanism.[/]
]Back-stepping has been added; press ‘s’ (as with normal WASD controls) to retreat.[/]
]Further alterations to the AI.[/]
]The floor now works properly.

[]This is a feature that I believe that I failed to mention in the post for the previous version: the player should no longer leave the “circle of light” as a result of manoeuvring. It was also broken in that version, but should now be working properly.[/]

]It seems that the previous version included an oversight that allowed one to do damage with parts of a weapon that should have been harmless; this should now be fixed.[/]
]Miscellaneous changes.[/*]
Known issues:

[]As a result of changes to the internal handling of the options menu, that menu’s “done” button no longer works in this prototype (although it does, I believe, work in the main game). Pressing “o” to dismiss the menu should, however, still work.[/]
[]Physics issues still remain.[/]

Oh, since it was suggested in this thread, I feel that I should mention this point: For the moment I’ve decided against keeping the sword extended as long as the player holds the mouse button. I experimented with it briefly, but it clashes with the way that I calculate damage at the moment. This is not insurmoutable, I daresay, but I’m not yet convinced that it’s a sufficiently signifcant problem that it’s worth reworking the damage system to account for such situations. I am, however, open to revisiting the idea at a later stage.

It feels a good deal more polished. I don’t know if it is the changes to input or physics but it seems there are fewer odd or unreadable events happening. Also very good that the opponent doesn’t easily end up off screen anymore and the lighting sticks with the action.

One small tweak I might suggest though is to use one clear theme for the names of the difficulty settings. It is not obvious if explorer or adventurer is more challenging because they both mean about the same thing and ditto for warrior and fighter. Maybe something like:

Jester < Squire < Knight < Monarch


Foolish Peasant < Rugged Wanderer < Intrepid Explorer < Legendary Adventurer

Ah, thank you! I’m very glad that it is indeed improving so. :slight_smile:

As to the difficulty settings, I see your point–I do have reasons for the particular set that I chose (and to my mind the pairs that you pointed out as similar are quite different), but that doesn’t really help me to convey that my meanings to players. I’ll give further thought to the names that I use, I believe–thank you.

(The specific suggestions that you gave wouldn’t fit the tone of the game that I’m making, I feel.)

You could also accompany the name of each difficulty setting with a symbol that becomes more ornate with each increased level. Anything from a simple tally mark to a coat of arms that has more weapons, shields and/or mythical creatures added to it with difficulty advancement.

In this way the implied ranking of the names could be less obvious to the uninitiated but still the idea gets across intuitively, I imagine. Means a bit more content though of course.

That’s a good idea, actually; it’s worth considering when I return to the naming of the difficulty levels, I think. Thank you again. :slight_smile:

This is very cool and reminds me of Silver (1999).


I unzipped and ran on Linux using wine. It gave me a small window which captured the mouse, it was quite a confusing and hectic duel though with the mouse often jumping out of the window (wine kept it on top luckily).

Hey, I think that your video may well be my first YouTube gameplay video! Thank you for that! I’m glad that you enjoyed it. ^___^

I don’t think that I’ve played Silver, but having taken a quick look at a Let’s Play I think that I see what you mean. A closer comparison (and not by coincidence) would be Die by the Sword, which used a very similar mechanic.

In all fairness, the version posted here is quite old now. Indeed, I ended up shelving this mechanic in favour of a simpler, less-physical approach: while I do think that this approach could work, getting it quite right would seem to involve a rather more rigorous approach to the physics, which I’ve decided to back off from.

The new version has some distinct similarities, but I think that it’s a bit more intuitive, if less nuanced.