logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 2 3 [4]  Send TopicPrint
Very Hot Topic (More than 25 Replies) Real crouching bug: telefragging when getting up (Read 3367 times)
Masterkent
Developer Team
Offline



Posts: 1134
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #45 - Nov 3rd, 2018 at 1:34pm
Print Post  
After replaying some games I decided to reconsider and change my implementation. The current implementation in j_40 allows underwater and mid-air crouching only as a post-effect of crouching on a ground. Once a player restores his full CollisionHeight underwater/mid-air, he cannot crouch again until his physics becomes PHYS_Walking in state PlayerWalking.

When a player enters a water zone or changes his physics to PHYS_Falling (e.g. by rocket-jumping) while crouching in a narrow space, I see 4 possible ways to manage player's CollisionHeight as long as the player keeps swimming or falling:

1) Restore full CollisionHeight immediately and forbid further crouching. IMHO, this is the worst solution (the player would overlap with walls and probably could see other parts of the level through walls).

2) Restore full CollisionHeight when space for uncrouching becomes sufficient and forbid further crouching. This is the most conservative approach among all viable options - it introduces minimal changes to the original gameplay. It implies a possibility that a player may get stuck after forced uncrouching, being unable to move in any direction, because all paths (including the reverse path) are narrow and further crouching is impossible (in a water zone).

3) Restore full CollisionHeight when the player releases a crouch key while there is enough space for uncrouching and forbid further crouching. This is how the current implementation works in j_40. Again, a player may get stuck after uncrouching for the same reason as described above, but this time such a situation is more easy to avoid, since the player has more control over uncrouching.

4) Restore full CollisionHeight when the player releases a crouch key while there is enough space for uncrouching and allow further crouching. This approach makes player movement very flexible and more realistic, so players could expect it working such a way.

Conservative approaches 2 and 3 may raise reasonable questions, for which I don't see any satisfactory logical answers:

1) If I can pass through a narrow tunnel while there is no any fluid there, why can't I fit in the same tunnel when it's filled with water?

2) Why am I not allowed to jump onto boxes which are placed close to a ceiling? (I could sit on a box, but my feet can't reach the corresponding altitude, because mid-air crouching is forbidden and my head collides with the ceiling, what the?..)

Some games initially support real crouching, and we can consider how it works there.

Half-Life 2 and SiN Episodes: Emergence (which use Source Engine) allow crouching underwater; in SiN Episodes: Emergence, there is a map (SE1_U4Lab01 "U4 Laboratory") that cannot be finished without using this feature:

Underwater crouching in SiN Episodes: Emergence

These games seem to support mid-air crouching even without using the crouch key: when you jump, you can fit in narrow windows where you can't stand. For example, this feature can be used for reaching a hidden room on map d2_prison_02 "Nova Prospekt" in Half-life 2:

Jumping onto a narrow window in Half-Life 2

HL2 and SEE also allow to jump while crouching.

Quake II and Quake II: The Reckoning allow crouching in water, slime, and lava, and they have maps where some inventory items cannot be reached without using this feature:
- in Quake II:
     - Grenades on map cool1 "Cooling Facility"
- in Quake II: The Reckoning:
     - [secret] Silencer on map xcompnd2 "Inner Compound"
     - [secret] DualFire Damage on map refinery "Refinery"

Quake II: The Reckoning - Refinery - secret #1

As far as I could see, these games don't allow entering a crouching state mid-air.

Eventually, I decided to implement real crouching as follows:

1. State FeigningDeath implies reduced CollisionHeight if bRising is false.

2. A player may crouch when standing on a ground, when falling, when swimming, or when using the Fly mode.

When player's Physics is PHYS_Walking, crouching is done by reducing player's CollisionHeight and moving the player to the ground. In all other cases, crouching is done only by reducing player's CollisionHeight (Location is not changed).

Uncrouching is done by moving the player to location L and restoring the full CollisionHeight, where L is determined using the following algorithm.

Let C be Location of the player in crouching state, Shift be vector (0, 0, 1) multiplied by the difference between full CollisionHeight and reduced CollisionHeight of the player. Firstly, the implementation determines location B where the player would stop if an attempt was made to move the player from C by -Shift. If the player would not bump into any obstacle below, the player would be moved by vector -Shift to location C - Shift; otherwise, he would stop due to colliding with an obstacle at some location between C - Shift and C.

Secondly, the implementation determines location U where the player would stop if an attempt was made to move the player from C by vector (2 * Shift) + (B - C). If the player would not bump into any obstacle above, U - Shift is taken as the location L where the player should be after uncrouching. Otherwise, the implementation determines if an attempt to move the player from C by vector (U - C) - (2 * Shift) would result in collision between the player and an obstacle. If no collision would occur, (U - C) - Shift is taken as the location L where the player should be after uncrouching. Otherwise, uncrouching is assumed to be impossible.

Crouching can be initiated in two ways:
1) by pressing a Crouch key,
2) by touching a ceiling when swimming or flying with pressed Jump key.

Crouching underwater

Jumping while crouching is not allowed.

Notable implications:
1) uncrouching when swimming is safe, players can crouch again in order to return back through a narrow passage,
2) players can jump onto higher or farther ledges than usually.
3) players can jump onto ledges below a ceiling where they couldn't stay.

Jumps with crouching mid-air

Any thoughts regarding the described concepts?
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7790
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #46 - Nov 4th, 2018 at 1:44pm
Print Post  
Reminds me on the "famous duckjump" in HL1. Which I find is a great move, especially we don't have anything like climb. I mean, of course we don't have Tombraider here or something, but Unreal allows a great deal of free movement inside the levels, so this is even more fun. Played Resident Evil 7? a few months ago, which is very restrictive in where and what you can reach, so even nowadays games still lack that to some degree.

That being said, it makes no sense to me either why crouch shouldn't be allowed underwater or mid air- except for "technical reasons" - disallow something to prevent being stuck in the wall and/or look through them, or fell out of world.

4. appears to be the best idea for me- if possible to realize it that way. And since this is a new 227 feature which also needs manual activation via a mod or at least admin command I see little chance for affecting "classic" levels and game modes. For new maps the mapper can decide if and how this is used.

Either way, a solution for all this crouching debate should be found soon, so perhaps we can make 227j a Christmas present.
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1134
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #47 - Nov 4th, 2018 at 2:10pm
Print Post  
Smirftsch wrote on Nov 4th, 2018 at 1:44pm:
4. appears to be the best idea for me- if possible to realize it that way.

Currently it's implementable with some hacks. I guess, PointCheck would not be useful this time (with or without check for initial overlapping), because the location of an uncrouched player cannot be calculated without special tracing or speculative move operations. If we have a proper trace function or speculative move (implemented with or without hacks) for determining the location, such things can be used to determine if player would fit as well.
  
Back to top
 
IP Logged
 
[UDHQ]Jackrabbit
New Member
*
Offline


Oldunreal member

Posts: 17
Joined: Aug 8th, 2012
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #48 - Nov 4th, 2018 at 5:12pm
Print Post  
Smirftsch wrote on Nov 4th, 2018 at 1:44pm:
That being said, it makes no sense to me either why crouch shouldn't be allowed underwater or mid air- except for "technical reasons" - disallow something to prevent being stuck in the wall and/or look through them, or fell out of world.

4. appears to be the best idea for me- if possible to realize it that way. And since this is a new 227 feature which also needs manual activation via a mod or at least admin command I see little chance for affecting "classic" levels and game modes. For new maps the mapper can decide if and how this is used.

Either way, a solution for all this crouching debate should be found soon, so perhaps we can make 227j a Christmas present.


OT: I'm currently going back and replaying RTNP on Godlike difficulty in 227i and I'm experiencing hitching with my game.  Are these issues resolved in 227j?  I wouldn't want the patch to be released without these issues resolved before then so I'd be willing to test the crouching functionality and to see if the hitching has been resolved in 227j prior to release.
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7790
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #49 - Nov 4th, 2018 at 5:15pm
Print Post  
that won't be a problem, I'll notify you when the final implementation is in.
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1134
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #50 - Nov 4th, 2018 at 9:53pm
Print Post  
[UDHQ]Jackrabbit wrote on Nov 4th, 2018 at 5:12pm:
OT: I'm currently going back and replaying RTNP on Godlike difficulty in 227i and I'm experiencing hitching with my game.  Are these issues resolved in 227j?

What do you mean by hitching and is it related to real crouching?

Note that in an network game, a server and its clients must have the same value of LevelInfo's bSupportsRealCrouching, and servers do not replicate this flag to clients (f.e. if you execute "Admin Set LevelInfo bSupportsRealCrouching true"), because such a replication cannot be introduced due to compatibility concerns. Without a proper client-side prediction, this feature won't work well.
  
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1134
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #51 - Nov 4th, 2018 at 10:06pm
Print Post  
Smirftsch wrote on Nov 4th, 2018 at 1:44pm:
And since this is a new 227 feature which also needs manual activation via a mod or at least admin command I see little chance for affecting "classic" levels and game modes.

Some things should be clarified here. I tweaked the calculation of EyeHeight along with the implementation of real crouching, since EyeHeight should be handled in a special way in case of using real crouching. I introduced scaling of BaseEyeHeight by (DrawScale / default.DrawScale) as indicated below:

Code
Select All
event UpdateEyeHeight(float DeltaTime)
{
	local float smooth, bound;
+	local float DesiredBaseEyeHeight;

	if (bIsReducedCrouch && IsInState('PlayerWalking'))
-		BaseEyeHeight = default.BaseEyeHeight + CollisionHeight - default.CollisionHeight;
+		BaseEyeHeight = default.BaseEyeHeight;
+	DesiredBaseEyeHeight = CalcDesiredBaseEyeHeight();

	smooth = FMin(1.0, 10.0 * DeltaTime/Level.TimeDilation);
	// smooth up/down stairs
	If( (IsInState('PlayerSwimming') || Physics==PHYS_Walking) && !bJustLanded )
	{
-		EyeHeight = (EyeHeight - Location.Z + OldLocation.Z) * (1 - smooth) + ( ShakeVert + BaseEyeHeight) * smooth;
+		EyeHeight = (EyeHeight - Location.Z + OldLocation.Z) * (1 - smooth) + ( ShakeVert + DesiredBaseEyeHeight) * smooth;
		bound = -0.5 * CollisionHeight;
		if (EyeHeight < bound)
			EyeHeight = bound;
		else
		{
			bound = FMin(FMax(0.0,(OldLocation.Z - Location.Z)), MaxStepHeight);
			if (bIsReducedCrouch)
-				bound += default.CollisionHeight;
+				bound += CalcNormalCollisionHeight();
			else
				bound += CollisionHeight;
			if ( EyeHeight > bound )
				EyeHeight = bound;
		}
	}
	else
	{
		smooth = FMax(smooth, 0.35);
		bJustLanded = false;
-		EyeHeight = EyeHeight * ( 1 - smooth) + (BaseEyeHeight + ShakeVert) * smooth;
+		EyeHeight = EyeHeight * ( 1 - smooth) + (DesiredBaseEyeHeight + ShakeVert) * smooth;
	}

	// teleporters affect your FOV, so adjust it back down
	if ( FOVAngle != DesiredFOV )
	{
		if ( FOVAngle > DesiredFOV )
			FOVAngle = FOVAngle - FMax(7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV));
		else
			FOVAngle = FOVAngle - FMin(-7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV));
		if ( Abs(FOVAngle - DesiredFOV) <= 10 )
			FOVAngle = DesiredFOV;
	}

	// adjust FOV for weapon zooming
	if ( bZooming )
	{
		ZoomLevel += DeltaTime * 1.0;
		if (ZoomLevel > 0.9)
			ZoomLevel = 0.9;
		DesiredFOV = FClamp(90.0 - (ZoomLevel * 88.0), 1, 170);
	}
} 


where CalcDesiredBaseEyeHeight and CalcNormalCollisionHeight are defined as

Code
Select All
simulated function float CalcDesiredBaseEyeHeight()
{
	return FMin(
		BaseEyeHeight * (DrawScale / default.DrawScale),
		FMax(BaseEyeHeight, default.BaseEyeHeight) * (CollisionHeight / default.CollisionHeight));
} 


Code
Select All
simulated function float CalcNormalCollisionHeight()
{
	return default.CollisionHeight * (DrawScale / default.DrawScale);
} 


This change takes effect independently of Level.bSupportsRealCrouching (because DrawScale is a separate parameter that can be altered with or without real crouching) and theoretically it may imply setting EyeHeight to noticeably improper values with some existing mods, although I think that this is very unlikely. If you want better backward compatibility, I can change the definition of CalcDesiredBaseEyeHeight to

Code
Select All
simulated function float CalcDesiredBaseEyeHeight()
{
	if (Level.bSupportsRealCrouching)
		return FMin(
			BaseEyeHeight * (DrawScale / default.DrawScale),
			FMax(BaseEyeHeight, default.BaseEyeHeight) * (CollisionHeight / default.CollisionHeight));
	return BaseEyeHeight;
} 


Similarly,

Code
Select All
			if ( !bBehindView )
				CameraLocation.Z += PTarget.EyeHeight;
			else
				CameraLocation.Z += PTarget.PrePivot.Z - PTarget.CalcNormalPrePivotZ(); 


can be changed to

Code
Select All
			if ( !bBehindView )
				CameraLocation.Z += PTarget.EyeHeight;
			else if (Level.bSupportsRealCrouching)
				CameraLocation.Z += PTarget.PrePivot.Z - PTarget.CalcNormalPrePivotZ(); 



Smirftsch wrote on Nov 4th, 2018 at 1:44pm:
For new maps the mapper can decide if and how this is used.

I hope to adapt this implementation to some existing UT campaigns (ONP, 7B, and Project Xenome). They initially implement real crouching in special subclasses of PlayerPawn, and my goal is to make those maps playable with regular U1 player classes.
« Last Edit: Nov 5th, 2018 at 9:25am by Masterkent »  
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1134
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #52 - Nov 4th, 2018 at 10:13pm
Print Post  
BTW, I faced with an annoying UScript bug when implemented this stuff:

expressions like CalcNormalPrePivot().Z crash the game, so I had write the wrapper

Code
Select All
final simulated function float CalcNormalPrePivotZ()
{
	local vector NormalPrePivot;
	NormalPrePivot = CalcNormalPrePivot();
	return NormalPrePivot.Z;
} 


just to obtain member Z of the temporary vector returned by CalcNormalPrePivot():

Code
Select All
simulated function vector CalcNormalPrePivot()
{
	return default.PrePivot * (DrawScale / default.DrawScale);
} 

  
Back to top
 
IP Logged
 
[UDHQ]Jackrabbit
New Member
*
Offline


Oldunreal member

Posts: 17
Joined: Aug 8th, 2012
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #53 - Nov 5th, 2018 at 7:24am
Print Post  
Masterkent wrote on Nov 4th, 2018 at 9:53pm:
[UDHQ]Jackrabbit wrote on Nov 4th, 2018 at 5:12pm:
OT: I'm currently going back and replaying RTNP on Godlike difficulty in 227i and I'm experiencing hitching with my game.  Are these issues resolved in 227j?

What do you mean by hitching and is it related to real crouching?

Note that in an network game, a server and its clients must have the same value of LevelInfo's bSupportsRealCrouching, and servers do not replicate this flag to clients (f.e. if you execute "Admin Set LevelInfo bSupportsRealCrouching true"), because such a replication cannot be introduced due to compatibility concerns. Without a proper client-side prediction, this feature won't work well.


The hitching is most apparant to me in Glathriel2.unr in the beginning basement area.  I've tested in all renderers offline in 227i and I get noticeable hitching regardless so I believe it's a scriptedpawn AI issue causing the hitching.  I would recommend optimizing (debugging) scriptedpawn 227i to find out what is eating resources.  I believe the issue relates somewhat to crouching as if I jump in the air it increases the chance of an AI hitch.

I would also add I've tested under the same circumstances in 226b using glide as my renderer without these issues.
  
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1134
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #54 - Nov 5th, 2018 at 8:37am
Print Post  
[UDHQ]Jackrabbit wrote on Nov 5th, 2018 at 7:24am:
The hitching is most apparant to me in Glathriel2.unr in the beginning basement area.

I couldn't notice anything unusual there, except that sometimes I get several entries like

Code
Select All
ScriptWarning: Spinner glathriel2.Spinner3 (State UnrealShare.ScriptedPawn.Guarding:004C) Accessed None 'OrderObject' 


in the log. These logged invalid operations are performed fast enough on my machine, so they don't cause any visible frame rate drops.

[UDHQ]Jackrabbit wrote on Nov 5th, 2018 at 7:24am:
I believe the issue relates somewhat to crouching as if I jump in the air it increases the chance of an AI hitch.

I can't imagine how crouching could be related to hangs.
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7790
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #55 - Nov 5th, 2018 at 9:27am
Print Post  
Masterkent wrote on Nov 4th, 2018 at 10:13pm:
expressions like CalcNormalPrePivot().Z crash the game, so I had write the wrapper

crashing with...?
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7790
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #56 - Nov 5th, 2018 at 11:13am
Print Post  
Masterkent wrote on Nov 4th, 2018 at 10:06pm:
If you want better backward compatibility, I can change the definition of CalcDesiredBaseEyeHeight to

Code
Select All
simulated function float CalcDesiredBaseEyeHeight()
{
	if (Level.bSupportsRealCrouching)
		return FMin(
			BaseEyeHeight * (DrawScale / default.DrawScale),
			FMax(BaseEyeHeight, default.BaseEyeHeight) * (CollisionHeight / default.CollisionHeight));
	return BaseEyeHeight;
} 


Similarly,

Code
Select All
			if ( !bBehindView )
				CameraLocation.Z += PTarget.EyeHeight;
			else
				CameraLocation.Z += PTarget.PrePivot.Z - PTarget.CalcNormalPrePivotZ(); 


can be changed to

Code
Select All
			if ( !bBehindView )
				CameraLocation.Z += PTarget.EyeHeight;
			else if (Level.bSupportsRealCrouching)
				CameraLocation.Z += PTarget.PrePivot.Z - PTarget.CalcNormalPrePivotZ(); 



I think this would be best.

Masterkent wrote on Nov 4th, 2018 at 10:06pm:
Smirftsch wrote on Nov 4th, 2018 at 1:44pm:
For new maps the mapper can decide if and how this is used.

I hope to adapt this implementation to some existing UT campaigns (ONP, 7B, and Project Xenome). They initially implement real crouching in special subclasses of PlayerPawn, and my goal is to make those maps playable with regular U1 player classes.

Nice idea Smiley
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1134
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #57 - Nov 5th, 2018 at 2:46pm
Print Post  
Smirftsch wrote on Nov 5th, 2018 at 9:27am:
Masterkent wrote on Nov 4th, 2018 at 10:13pm:
expressions like CalcNormalPrePivot().Z crash the game, so I had write the wrapper

crashing with...?

nothing interesting in the log, see https://www.oldunreal.com/cgi-bin/yabb2/YaBB.pl?num=1541429076

Smirftsch wrote on Nov 5th, 2018 at 9:27am:
I think this would be best.

OK, changed.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 3 [4] 
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo