Jump to content

About blasters deflection system.


Recommended Posts

I considered what would be the best blasters deflection system, because none of the Jedi Knight series convinces me by the following.

 

I do not want an automatic deflection system because I prefer the player has to do something to reject the projectiles. I do not want the deflection system is specially skill based, but that depends more on the player's skills that character's skills. But a manual system where you have to press a button to reject the projectiles also does not attract me, because you have to always press the same button and it is not challenging.

 

My ideal deflection system would be based on quick time events. When enemies start shooting on the character, some images of keys appear on the screen and you would have to press these keys to reject the shots. Depending on where the shots come, so the keys would have to be pressed. The more shots per second threaten the character, more keys you would have to press, to the point that the fire would be overwhelming and would be covered. Upgrades would consist of reducing to a certain limit the number of keys to press when you are fired by several attackers and to return fire to its point of origin or the attackers. What do you think?

JaceSolarisVIII, Onysfx and Cerez like this
Link to comment

Interesting idea, but what keys would they be?

 

I do not know, that might be customizable. I use the cursor keys for movement and the keypad for Force powers, so insert, supr, home, etc., could serve this purpose.

Link to comment

I believe the automatic blocking blaster deflection is handled in.

void WP_SaberDamageTrace( gentity_t *ent, int saberNum, int bladeNum )

or at least it seems to start here (I think) at line 5481 in wp_saber.cpp

if ( saberHitFraction < 1.0f )
		{
			if ( !collisionResolved && baseDamage )
			{//some other kind of in-hand saber collision
				//handle my reaction
				if ( !ent->client->ps.saberInFlight 
					&& ent->client->ps.saberLockTime < level.time )
				{//my saber is in hand
					if ( ent->client->ps.saberBlocked != BLOCKED_PARRY_BROKEN )
					{
						if ( PM_SaberInAttack( ent->client->ps.saberMove ) ||
							PM_SaberInSpecialAttack( ent->client->ps.torsoAnim ) ||
							(entPowerLevel > FORCE_LEVEL_2 &&
							!PM_SaberInIdle(ent->client->ps.saberMove)&&
							!PM_SaberInParry(ent->client->ps.saberMove)&&
							!PM_SaberInReflect(ent->client->ps.saberMove)) )
						{//in the middle of attacking
							if ( entPowerLevel < FORCE_LEVEL_3 && hitOwner->health > 0 )
							{//don't deflect/bounce in strong attack or when enemy is dead
								WP_GetSaberDeflectionAngle( ent, hitOwner );
								ent->client->ps.saberEventFlags |= SEF_BLOCKED;
								//since it was blocked/deflected, take away any damage done
								//FIXME: what if the damage was done before the parry?
								WP_SaberClearDamageForEntNum( ent, hitOwner->s.number, saberNum, bladeNum );
							}
						}
						else
						{//saber collided when not attacking, parry it
							//since it was blocked/deflected, take away any damage done
							//FIXME: what if the damage was done before the parry?
							WP_SaberClearDamageForEntNum( ent, hitOwner->s.number, saberNum, bladeNum );
							/*
							if ( ent->s.number || g_saberAutoBlocking->integer || ent->client->ps.saberBlockingTime > level.time )
							{//either an NPC or a player who has blocking
								if ( !PM_SaberInTransitionAny( ent->client->ps.saberMove ) && !PM_SaberInBounce( ent->client->ps.saberMove ) )
								{//I'm not attacking, in transition or in a bounce, so play a parry
									//just so Jedi knows that he parried something
									WP_SaberBlockNonRandom( ent, saberHitLocation, qfalse );
								}
								ent->client->ps.saberEventFlags |= SEF_PARRIED;
							}
							*/
						}
					}
					else
					{
						//since it was blocked/deflected, take away any damage done
						//FIXME: what if the damage was done before the parry?
						WP_SaberClearDamageForEntNum( ent, hitOwner->s.number, saberNum, bladeNum );
					}
				}
				else
				{//nothing happens to *me* when my inFlight saber hits something
				}
				//handle their reaction
				if ( hitOwner 
					&& hitOwner->health > 0 
					&& hitOwner->client 
					&& !hitOwner->client->ps.saberInFlight 
					&& hitOwner->client->ps.saberLockTime < level.time )
				{//their saber is in hand
					if ( PM_SaberInAttack( hitOwner->client->ps.saberMove ) || PM_SaberInSpecialAttack( hitOwner->client->ps.torsoAnim ) ||
						(hitOwner->client->ps.saberAnimLevel > SS_MEDIUM&&!PM_SaberInIdle(hitOwner->client->ps.saberMove)&&!PM_SaberInParry(hitOwner->client->ps.saberMove)&&!PM_SaberInReflect(hitOwner->client->ps.saberMove)) )
					{//in the middle of attacking
						/*
						if ( hitOwner->client->ps.saberAnimLevel < SS_STRONG )
						{//don't deflect/bounce in strong attack
							WP_GetSaberDeflectionAngle( hitOwner, ent );
							hitOwner->client->ps.saberEventFlags |= SEF_BLOCKED;
						}
						*/
					}
					else
					{//saber collided when not attacking, parry it
						if ( !PM_SaberInBrokenParry( hitOwner->client->ps.saberMove ) )
						{//not currently in a broken parry
							if ( !WP_SaberParry( hitOwner, ent, saberNum, bladeNum ) )
							{//FIXME: hitOwner can't parry, do some time-consuming saber-knocked-aside broken parry anim?
								//hitOwner->client->ps.saberBlocked = BLOCKED_PARRY_BROKEN;
							}
						}
					}
				}
				else
				{//nothing happens to *hitOwner* when their inFlight saber hits something
				}
			}

			//collision must have been handled by now
			//Set the blocked attack bounce value in saberBlocked so we actually play our saberBounceMove anim
			if ( ent->client->ps.saberEventFlags & SEF_BLOCKED )
			{
				if ( ent->client->ps.saberBlocked != BLOCKED_PARRY_BROKEN )
				{
					ent->client->ps.saberBlocked = BLOCKED_ATK_BOUNCE;
				}
			}
			/*
			if ( hitOwner && hitOwner->client->ps.saberEventFlags & SEF_BLOCKED )
			{
				hitOwner->client->ps.saberBlocked = BLOCKED_ATK_BOUNCE;
			}
			*/
		}

It seems to be forcing a saber / bolt block  for anyone over force level2.

Does anyone know the best way just to switch this automatic blocking function off?

Cerez likes this
Link to comment

Jedi Knight Galaxies uses a skill-based blocking system, where you hold down the block button and the attack button to go into "Projectile Blocking Mode". How well the projectile is reflected is dependent on how fast you hit the projectile in relation to going into Projectile Blocking Mode. So if you go into PBM very soon (or literally right before) the projectile hits you, it will reflect the missile right back at the attacker, although this is very hard to do as a beginner Jedi character (ie, without any points in blocking skills) and you'll almost certainly be dead if you try this with repeaters.

If you just hold the PBM, you will stop being able to block projectiles after a period of about 5 seconds, so you need to constantly go into and out of PBM. Higher-levelled Jedi characters can just hold the button for passive blocking. Of course, in order to reflect shots, you will still need to block accurately in this case.

Link to comment
  • 4 weeks later...

Neat idea, but multiple buttons isn't the solution. We have one hand on the keyboard and one on the mouse. I personally have force powers hotkeyed to the buttons around wasd, so using them isn't viable. Plus if I'm being mobile I won't be able to hit all the required keys. Taking my hand off the mouse for the insert, home, etc keys is also not a good idea. I'll lose my ability to turn and attack. 

 

I always thought tying the higher tiers of blaster deflection to force sense, and require the player to aim. This way it's a force power, and that requires force point management, as well as player skill to first aim at the incoming blast, and aiming at your chosen target. No more 180 degree deflection.

GamerRedNeck likes this
Link to comment
  • 5 months later...

Neat idea, but multiple buttons isn't the solution. We have one hand on the keyboard and one on the mouse. I personally have force powers hotkeyed to the buttons around wasd, so using them isn't viable. Plus if I'm being mobile I won't be able to hit all the required keys. Taking my hand off the mouse for the insert, home, etc keys is also not a good idea. I'll lose my ability to turn and attack. 

 

I always thought tying the higher tiers of blaster deflection to force sense, and require the player to aim. This way it's a force power, and that requires force point management, as well as player skill to first aim at the incoming blast, and aiming at your chosen target. No more 180 degree deflection.

 

You could use the numerical keys next to W, but yes, I agree with you.

Link to comment
  • 1 month later...

Hi, just stumbled across this thread while looking for a reference to the console variable I made to do exactly what you're asking for back when I wrote the lightsaber code for the Jedi games.

 

Set g_saberAutoBlocking to 0, then bind a key to +block and you have exactly what you're looking for. Let me know if it's what you wanted!

 

I just checked, it works!

Cerez and MGummelt like this
Link to comment

Set g_saberAutoBlocking to 0, then bind a key to +block and you have exactly what you're looking for. Let me know if it's what you wanted!

Brilliant!

 

Tested it, and while it works, it ends up behaving quite funny with duals. I've had an army of battle droids with blasters attack my character, and, while not blocking, the character stood stationary, facing them, with sabers drawn, holding one in each hand, and the blaster bolts kept bouncing off the lightsaber blades, hitting the attakers. The whole squad fell down in a big droid pile, and my character suffered only shield damage... :lol:

 

Still, this at least gives you the feeling of being more in control of your character's hands and movement -- which is truly welcome -- stop blocking when you want to, and deliver that perfect, fluid and confident swing.

 

I don't suppose there is a way to disable the lightsaber blade's collision feature while not blocking and not attacking? (I presume this would take some actual code tinkering.) It would be more realistic for projectiles to pass through (around) the blade than having them bounce off even when the character is holding the lightsaber loosely (with not enough grip to withstand the force of the impact).

 

Edit:

 

On second thought, that poses a problem with non-projectile attacks. Blade going through a blade is not a welcome sight, even when you're not blocking or attacking... >.<'

Edited by Cerez
Link to comment

Brilliant!

 

Tested it, and while it works, it ends up behaving quite funny with duals. I've had an army of battle droids with blasters attack my character, and, while not blocking, the character stood stationary, facing them, with sabers drawn, holding one in each hand, and the blaster bolts kept bouncing off the lightsaber blades, hitting the attakers. The whole squad fell down in a big droid pile, and my character suffered only shield damage... :lol:

 

Still, this at least gives you the feeling of being more in control of your character's hands and movement -- which is truly welcome -- stop blocking when you want to, and deliver that perfect, fluid and confident swing.

 

I don't suppose there is a way to disable the lightsaber blade's collision feature while not blocking and not attacking? (I presume this would take some actual code tinkering.) It would be more realistic for projectiles to pass through (around) the blade than having them bounce off even when the character is holding the lightsaber loosely (with not enough grip to withstand the force of the impact).

 

Edit:

 

On second thought, that poses a problem with non-projectile attacks. Blade going through a blade is not a welcome sight, even when you're not blocking or attacking... >.<'

 

Hmm, yeah, the way the code was written, the lightsaber's contents are disabled only when the lightsaber is turned off or when it's thrown (a thrown saber is a different entity than the one you're holding).  So if the saber is on and another saber or blaster bolt hits it, it will impact it.  You could set the saberent->contents = 0 whenever you're not actively blocking.  But, yes, that means other lightsabers will pass through it when you're just idling.

Cerez likes this
Link to comment

@@JaceSolarisVIII

The blaster deflection is actually handled in WP_SaberStartMissileBlockCheck in wp_saber.cpp which calls many related functions, lots of important ones which are in g_missile.cpp; what you posted refers to saber vs. saber collision properties.

 

@@MGummelt

I've been trying to figure out how to change the animation speed for +block. Currently the player very slowly goes into the vertical parry single-frame pose for whatever saber style he's in. Technically since it's not an animation, but a transition (from whatever animation the player is in to the single-frame vertical parry) I assume there's some default transition speed set somewhere, but I haven't been able to figure it out. I got as far as trying to mess with some "blend speed" argument for a function call related to the BLOCK_T pose but it didn't seem to be doing anything.

 

As for the general topic, I like MovieBattle's system to some degree. The blocking is done for you mostly, but the skill comes in trying to dodge blaster bolts or trying to aim deflections. A bit of skill combined with a bit of automatic leetness to make you feel cool.

 

In JK2 you could block very well but you were peppered by a furious gauntlet of bolts most of the time, so you had to be very cautious sometimes. You had to watch Kyle closely and make sure he was in a good position to block and make sure that the bolts were hitting close to the same location, otherwise that one bolt that slipped through out of 50 could be fatal. In JA they made your autoblock kinda crappy so you are supposed to dodge more.

JaceSolarisVIII and Cerez like this
Link to comment

I've been trying to figure out how to change the animation speed for +block. Currently the player very slowly goes into the vertical parry single-frame pose for whatever saber style he's in. Technically since it's not an animation, but a transition (from whatever animation the player is in to the single-frame vertical parry) I assume there's some default transition speed set somewhere, but I haven't been able to figure it out. I got as far as trying to mess with some "blend speed" argument for a function call related to the BLOCK_T pose but it didn't seem to be doing anything.

 

Hmm, if it's the anim I'm looking at (BOTH_P1_S1_T_), the blend time is only 50ms, which is 1/20th of a second.  He shouldn't be transitioning to that anim so slowly?

 

I think your saber style skill will scale the speed of the transition to attack animations.. not sure about blocking ones.  See PM_SaberStartTransAnim() in bg_panimate.cpp

 

As for the playback speed of animations, I believe that's handled in PM_SetAnimFinal() in bg_panimate.cpp.  That stuff was written by Chris Reed, I believe, not me.  He's still at Raven, too btw (along with Lead Programmer James Monroe).

 

Anyway, if any scaling of an anim speed or blendtime is happening, it's probably in that function.

Cerez likes this
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...