[WIP Project] Sword Duel System

Posted By: Zelek

[WIP Project] Sword Duel System - 12/29/06 19:24

I'll get right to the screenshots for you impatient types out there


ss1 ss2 ss3 ss4 ss5



ss6 ss7 ss8 ss9

I've been working on a sword dueling system for a little while now, and I've finally gotten to a point where everything works and it's pretty challenging. Basically, there's three attack types: overhead strike, thrust, and sideways lash. There is also a defense for each attack: two different blocks and a dodge for the thrust. Everything is real-time and reflex based, so if you aren't fast, you'll miss a block or dodge. If you're fast, you can keep the enemy from ever touching you (though I can't even do that and I made the game ).

There's also a stamina system, which I borrowed the idea from a great game called Savage. Basically, attacks and blocks take up your energy, and if you run out of energy, you can't attack! This keeps you from just non-stop swinging at the enemy like an idiot . If you get several blocks in a row, you will gain lots of stamina back. This way, you have to be able to attack AND block to win fights. Stamina comes back very slowly during battle.

My goal here is to get a fully functional and polished demo/tutorial together to post, so people can learn the combat system and fight the computer themselves, and give me some feedback. I'm waiting for my commercial version of 3dgs to arrive (only have extra right now), so once that comes, I'll make things look much better with shaders and dynamic shadows and such.

I'm trying really hard not to bite off more than I can chew, so even though I want to expand the game to include sailing, buying/selling cargo, and taking over enemy ships, right now I am only going to focus on this dueling system until I feel it's the best it can be.

Questions about the combat system, comments or criticisms on the screenshots would be great. Does the overall look fit? Do the panels look out of place? Let me know what you think!
Posted By: Loopix

Re: [WIP Project] Sword Duel System - 12/29/06 20:04

Whoho! I can't wait to get my hands on your tutorial

The panels look good. Landscap (especialy the textures) could be better. But I woulden't bother about this...it's not too bad Just keep on concentrating on the ultimate duelling-code
Posted By: Bot190

Re: [WIP Project] Sword Duel System - 12/29/06 20:17

dude that looks awsome. i haven't seen much like this... ever. the panels look nice. i do like the ideas. with stamina and stuff. i would love to read a tut on how to do this. I think you have done a nice job so far and will do a nice job on the rest of this game. I do think your going in the right direction by only working on one part at a time.
Posted By: Zelek

Re: [WIP Project] Sword Duel System - 12/29/06 20:43

Hey Loopix. As soon as my commercial version arrives, one of my first things to do will be to implement a multi-texture terrain shader. The trees are yours (who else's? ), thanks for making them available.

Thanks for the comments bot! Glad you like the panels, I couldn't decide if they fit in or not.
Posted By: Zelek

Re: [WIP Project] Sword Duel System - 12/30/06 21:57

Today was a really productive day!







I added in some snazzy sword trail effects. I wasn't really going for an arcade/comic-book type look, but the trails make the duels look a lot cooler.

I also added in double-damage hits for when you get 3 blocks in a row. In the last shot, you can tell there was a double damage hit because of the large floating "30!". I also added in floating text effects for the stamina boost, which also happens when you get 3 blocks in a row.

If some more people express interest, maybe I'll put together a video of a fight-in-action. Thanks for any comments!
Posted By: ShoreVietam

Re: [WIP Project] Sword Duel System - 12/31/06 08:16

Oh yes, a video would be great!

The screen already made me wanna see it in motion, since the look good!
Posted By: Gumby22don

Re: [WIP Project] Sword Duel System - 12/31/06 12:21

Yeah, I want to see it in video, definately. To be honest I want to see a demo , but video is next best.

The project looks really cool. I like your way of thinking- get the fight right first, then work out the rest of the game to suit. This duel system should be very cool. Will you enable 3 or more people in one fight, or will they basically line up and take turns if a group wants to fight?

Don
have a great day
Posted By: Germanunkol

Re: [WIP Project] Sword Duel System - 12/31/06 14:10

Same here... Video!! I'm working on something similar right now, and I'd sure like to see what you've done with it, cause it looks great!
Good job on this!!

Micha
Posted By: Blink

Re: [WIP Project] Sword Duel System - 12/31/06 17:38

Incredible screenshots, I need your tutorial a.s.a.p!!!!! I am excited about having a tutorial for sword dueling, and cant wait until I can use it for my projects. Good Work Zelek!
Posted By: Zelek

Re: [WIP Project] Sword Duel System - 01/02/07 06:11

400 views and only 6 replies aside from my own . I think I'm going to pass on the tutorial because there's already a couple of great sword combat tutorials, the Kingdom Hearts one, and in the latest AUM I believe.

I'll try to bust out a video after I spice up the terrain and water with some shaders. Thanks to the few of you who left comments, it helps me to press on .

Gumby: I've thought about allowing multiple enemy fights, but I just don't think it would work out well. You can't block and attack at the same time, so with 2 opponenets, you would just end up blocking nonstop while they swing at you. I have some rough ideas on how I can avoid the "line up and duel" scenario you mentioned, though.
Posted By: raymich

Re: [WIP Project] Sword Duel System - 01/02/07 06:17

people are just being very diplomatic nowadays

i think you should release that tutorial, becouse everyone can talk or promise, but there is so less people who actually does what they started

i would appreciate any help i could get from your tutorial, not only me, everyone. We all know that there is so many ways to do one single thing in scripting, and we want to know your way

cheers
Posted By: RJDL

Re: [WIP Project] Sword Duel System - 01/02/07 09:45

that looks really cool!
i want to make a sword fighting game myself, and i have done an attempt (which totally failed while i didn't have enough experience yet) but i want to trie it again, and a tutorial about it would be really cool!
good luck with the process!
Posted By: JimFox

Re: [WIP Project] Sword Duel System - 01/02/07 23:03

Don't get discouraged about the few responses. Not everyone is interested in every type of demo, and most forum participants won't log on simply to say "me too". I think you should take the response as favorable.
I would be interested in any hints that may help to develop a system such as yours. Of course, if it is basically the same as in AUM, then The need for it would be minimal, but any new ideas would be helpful, indeed.
I hope you are able to finish the game and that it's a great success.
Happy New Year!!
Jim
Posted By: Germanunkol

Re: [WIP Project] Sword Duel System - 01/04/07 09:48

9 replies to a sword combating system... you're right. that's not very much ... combat systems are very hard, especially if they're using close range weapons and realistic blocking!
I think a video of it all might get you more responses. I wanna see what the thing's like... if it's possible, a video would be great ...
It just doesn't look the same on a still picture...:(
Posted By: ShoreVietam

Re: [WIP Project] Sword Duel System - 01/04/07 16:47

Well... always eye-candy makes the race.

The "problem" is, that the game code is kind of a base that is needed, at least we can only judge eye-candy from screens.

I'd advice you to improve the texture detail of your terrain, place a plant, a boulder and a fence here and there and maybe rework you 2D elements a bit (the character pictures look quite good, but the way they are displayed and the compass at the top of the screen.


Example:

Old interface, using a block-like power bar border -> weak design.


New interface, using no border at all -> quite cool (at least I think so )




Edit:
Sometimes less is more, don't put too many Panels on the screen (my opinion).
Posted By: Zelek

Re: [WIP Project] Sword Duel System - 01/05/07 04:09

Thanks for the comments everyone, and the advice, Shore.

I put together a VIDEO (~9 meg, 45 sec) of the code in action. Basically it's me against a really defensive computer. You'll see that I manage to score one hit on him...but I have to cheat and give myself stamina every 10 seconds or so .

Let me know if you run into any problems viewing it. Hope you guys enjoy it!



EDIT: Here's a Google video link if the above link doesn't work for some reason. This one is 320x240 though, so it's a lot harder to see what's going on.
Posted By: DLively

Re: [WIP Project] Sword Duel System - 01/05/07 15:31

Nice game! Looks very fun accually. The idea of the game is brilliant, A demo will be very good. I liked the video, much better than the screens, tho the screens look sweet too

And a tutorial

Keep up the good work!

Link.
Posted By: ShoreVietam

Re: [WIP Project] Sword Duel System - 01/05/07 16:35

Great, with some improvements in the animation cycles it'll be awesome!
Posted By: Germanunkol

Re: [WIP Project] Sword Duel System - 01/06/07 00:31

I agree... it looks very cool, nice effects, sounds etc (Lol... and the bg music, off course... I love Klaus Badelt's music^^)
What I'd really work on is the animations. See, when the opponent moves aside, for example, so that you miss, he does not actually seem to move aside, he seems to be there at once. I'd work on that... other than that... nice job
Posted By: Zelek

Re: [WIP Project] Sword Duel System - 01/06/07 00:52

Yeah, the animation is rough...I hate doing animations myself, such a wretched, tedious process. The problem is that all the collision detection depends on the animations, so if they're too fast, it won't detect correctly, and if they're too slow, there's no real challenge to blocking attacks. For the dodge, if I slow it down and make it animate smoothly, it makes it really hard to respond in time and get out of the way of the sword.

I agree it needs some work though, I'll have to see if I can figure another way to smooth it out or something.
Posted By: ShoreVietam

Re: [WIP Project] Sword Duel System - 01/06/07 11:47

If I were you... I'd make the reactions state dependant, not depending on animation cycles, it gives you too much borders.

The deterministic finite automaton principle.

Just let em check what the other one is doing, I had such a System once, it worked so well, that the to opponents were not able to hit each other.

Depending on how much time was left they used blocking or a vertical hit to slash away a horizontal strinke and the other way round:

Ok this is a screen for a bug, I created an endless loop for creating block-spark-particle-whatever-stuff, but as you can see, the left dummy holds his weapon in defence mode, the right one attacked.
The colors are already set back to normal, a defender should be green, an attacker red:


Here's another one, the red one is the attacking dummy, the blue one reacts with a vertical strike to beat away the horizonal attack slash:



No collision detection at all, just checking states, speed and attack progress.
Posted By: Germanunkol

Re: [WIP Project] Sword Duel System - 01/06/07 14:30

" it worked so well, that the to opponents were not able to hit each other."

LOOOOOL!
that'd be great... a game where you can't hit each other because your fighting and blocking skills are perfect ... I think those ppl would all turn into pazifist pretty soon, getting tired of fighting ^^

I'd very much like to see a demo of both your projects... if possible...
The approach you're doing, Shore, does not leave as much room for the user's skill though.. if your block is always the right one. What I'd do is combining the two. Checking the state rather than collision detection can be a lot easier but maybe look unrealistic. (you need to stop the animation at exactly the right time, right? and how does it work if the two don't stand exactly infront of each other? That wouldn't work at all)...
For example: if you atttack from behind, and you use attack animation 1, the opponent uses block animation 1 that corresponds to attack animation 1, but he's facing the other way, so your sword stops in mid air because he blocked in the other direction? Maybe checking state to determine the reaction and then preforming collision detection to see if the reaction was any use at all would work together better??
Posted By: Zelek

Re: [WIP Project] Sword Duel System - 01/06/07 18:01

A lot of really good points in these last two posts!

Shore - I have thought about doing something like that, I even have states for the different attacks/blocks already set up. You said that you check attack progress - doesn't that mean the animation percent?

Germanunkol is right though, there's less skill involved this way and it looks less realistic. Right now, I can detect the exact moment that the swords touch, then place the particle effect there and play the block sound. I can put in different swords with different sizes and shapes and it will still work. If the player blocks a second too late and his sword doesn't quite make it in time, he will still get hit...it feels very responsive.

The direction they face is also an issue. In my system, I lock the two combatants in place, but that's because I want to make people use the block moves instead of just running away from the enemy and then running in to attack real quick, and running away again.
Posted By: ShoreVietam

Re: [WIP Project] Sword Duel System - 01/06/07 23:33

@Germanunkol

First of all you have to create a -perfect working AI-.

THEN you can build in skill dependet weakness!

Play Soul Calibur (I or II) in sparing mode and set your opponent to -full block- and you'll see what I'm speaking about.
Posted By: Straight_Heart

Re: [WIP Project] Sword Duel System - 01/07/07 02:09

Zelek this is a good base "system" so far. Unfortunately the animations are incredibly important and the current animations in the models detract from the system. Even though the base system is good, the animations are stilted, which show the obvious "switching out of states" in the entities. But this of course is not as important as the fighting system itself.

Maybe when you are working on the A.I, you can add in more movement. Strafing left and right, backing up and advancing. Right now they are rockem sockem robots staying in place exchanging blows (like a japenese RPG). This movment adds a whole dimension to the sword fight, which can be seen in 3d fighting games where characters can sidestep (totally dodging an incoming attack other than jumping). So instead of just blocking the incoming slash, you can add a simple random to switch to different states:

1. AI sees player swinging his sword
2. AI chooses a random number between 1 and 100:

a.If the number is greater than 50, go to the blocking state
b.If the number is less than 50, go to the sidestep state

This simple setup can produce some pretty decent dynamics even though it is eventually predictable. Whats also cool about it is that you can plugin numbers that define the AI combat personality. For example you can plugin an AI to have a 60 "dodge rating". If the number is lesser than 60 then the AI dodges. Since there is a greater chance for the number to be less than 60 (out of 100), this makes the AI more defensive. Lower the 60 rating and the AI has more chances to choose higher than 60, making him a more offensive character.

I got sidetracked there, but more movement is needed. When you add this, a new avenue of strategy comes into play. Hitting the side of an enemy can produce more damage, attacking after a dodge reduces damage output, having a back to the wall prevents teaming up by multiple enemies, 2 handed weapons impair movement but inflict more damage etc etc.
Posted By: Germanunkol

Re: [WIP Project] Sword Duel System - 01/07/07 09:28

Sry, ShoreVietnam... I know.
I just imagined two players hitting each other for the rest of eternity, sort of like two paladins in WOW, where they heal themselves and block the other...
just sounded funny^^
Posted By: Firetag

Re: [WIP Project] Sword Duel System - 03/03/07 16:17

man i cant wait for a tutorial from you guys....well actually I'm just getting into gaming development and no pretty much nothing about coding. If you guys could recommend any books for me or other tutorials that are online that would be great.
Posted By: Blink

Re: [WIP Project] Sword Duel System - 04/17/07 23:26

just wondering, are you going to release a tutorial for this?
Posted By: Blink

Re: [WIP Project] Sword Duel System - 07/13/07 00:57

please tell me, someone is going to post a tutorial or a code for this, please?
Posted By: Zelek

Re: [WIP Project] Sword Duel System - 07/14/07 01:00

Hey Blink, sorry I never put together a tutorial for this. I really appreciated your interest and comments while I was working on it though. But when I took a step back and looked at the code that I had developed, it wasn't really good enough to be the basis of a tutorial.

I ran into several issues:
1) The responsiveness of the combat is highly dependent on framerate. Basically, I am doing scans from the top of the sword to its handle, and analyzing what I detect - if it's the enemy player model, it means I hit him, if it's his sword, it means he blocked.

Unfortunately, if someone with a slower computer tries to fight, they will notice that sometimes their hits don't register, because of low framerate.

2) The swords are separate models from the players, so that I can distinguish between contact with the sword and contact with the enemy player. This means I have to attach the sword via code. I had a lot of trouble making the sword movement look good, because it doesn't know how to tilt with the player's hand unless I tell it. What I probably should have done is give the sword its own set of animations that correspond to the movement of the player's arm/hand.

3) The combat isn't very flexible. As you can see from the video, it's dependent on the players being in a locked position to simplify the code. That's just lazy, looks terrible, and a lot less fun.

I may very well revisit this in the near future and if it's ever worthy enough to make a tutorial I'll do my best to make it happen. For now, definitely check out some of the already existing combat tutorials. The concepts are easily applied to sword fighting.
Posted By: Blink

Re: [WIP Project] Sword Duel System - 07/14/07 05:52

I appreciate the response. I was intially impressed with the duel concept, it was really innovative. i never saw a tutorial anywhere that was as creative as that concept. there are great tuts out here (kh tutorial as an example), but i hope you revisit the idea and offer the code to the community. i have a great pirate game concept that could use the "duel" combat. i hope to be an awesome developer like you one day.
© 2024 lite-C Forums