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]  Send TopicPrint
Very Hot Topic (More than 25 Replies) Real crouching bug: telefragging when getting up (Read 2807 times)
Masterkent
Developer Team
Offline



Posts: 1116
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #30 - Jul 27th, 2018 at 11:19am
Print Post  
Masterkent wrote on Jul 9th, 2018 at 5:36pm:
Quote:
About EyeHeight, just add the half collision offset up from current Location.Z in CalcCamera/Inventory.CalcView

Then camera may be placed too close to the ceiling, especially when CrouchHeightPct == 0.5 (eyes would be located right on the top of the collision cylinder).

In addition to the aforementioned issue, the given approach is very sensitive to overriding CalcDrawOffset and PlayerCalcView in subclasses of Inventory and PlayerPawn correspondingly.

For example, this is how the suggested implementation works with my modification of Plasma Rifle from 7 Bullets: https://www.youtube.com/watch?v=YM2glyhhylo
  
Back to top
 
IP Logged
 
ividyon
New Member
*
Offline


UnrealSP.org Staff

Posts: 23
Location: Stuttgart, Germany
Joined: Mar 24th, 2005
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #31 - Aug 1st, 2018 at 4:35pm
Print Post  
No real input here, only want to add that I'm in awe of Masterkent's professional approach here; a complete joy to read this sort of dedication to bug fixing and applying "the correct method"! Great work!
  
Back to top
WWW  
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1116
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #32 - Aug 2nd, 2018 at 1:11pm
Print Post  
I'm thinking what to do with players who have a non-default DrawScale.

default.BaseEyeHeight is used in too many overridable functions, and I don't see ways to scale it by (DrawScale / default.DrawScale) more or less reliably. If you play as ant-man, your camera may be placed too high without such a scaling.
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7763
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #33 - Oct 15th, 2018 at 6:28pm
Print Post  
@MK

would be
native(283) final function bool SetCollisionSize( float NewRadius, float NewHeight, optional bool bCheckEncroachment ); // CheckEncroachment also updates touch. Also does return 0 if CheckEncroachment fails (and only then).

suffice for your needs? It's in the end the same approach SetLocation does if you hack use it for updating the touchlist. Seems to be the most simple implementation here.

  

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



Posts: 1116
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #34 - Oct 16th, 2018 at 5:07pm
Print Post  
Smirftsch wrote on Oct 15th, 2018 at 6:28pm:
would be
native(283) final function bool SetCollisionSize( float NewRadius, float NewHeight, optional bool bCheckEncroachment ); // CheckEncroachment also updates touch. Also does return 0 if CheckEncroachment fails (and only then).

suffice for your needs?

It could let us reduce

Code
Select All
		bOldBlockActors = bBlockActors;
		bOldBlockPlayers = bBlockPlayers;
		bOldCollideWorld = bCollideWorld;

		SetCollision(bCollideActors, false, false);
		bCollideWorld = false;
		SetCollisionSize(CollisionRadius, NormalCollisionHeight);
		Move(vect(0, 0, 1) * Offset);
		SetLocation(Location);
		if (CarriedDecoration != none)
		{
			CarriedDecoration.SetPhysics(PHYS_None);
			CarriedDecoration.SetBase(self);
		}
		SetCollision(bCollideActors, bOldBlockActors, bOldBlockPlayers);
		bCollideWorld = bOldCollideWorld; 


to

Code
Select All
		Move(vect(0, 0, 1) * Offset);
		SetCollisionSize(CollisionRadius, NormalCollisionHeight, true); 


The return value of SetCollisionSize doesn't seem to be helpful here, because Move + SetCollisionSize is supposed to be evaluated only if CanStandUp determined that the player can stand.

The implementation of CanStandUp cannot be improved by making use of such SetCollisionSize, because CanStandUp is supposed to be a speculative operation that ideally should not have side effects. F.e. determining if the player can stand up shall not activate any Triggers or bump any movers above the player (unfortunately, the current implementation of CanStandUp can affect TT_AnyProximity Triggers).
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7763
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #35 - Oct 17th, 2018 at 6:43am
Print Post  
oh well, return value won't do any harm I guess, if needed or making sense or not Tongue, if not used it returns always 1 anyway.
But fine, that is already quite an improvement then in usability for that.
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
.:..:
Board Moderator
Developer Team
*****
Offline



Posts: 1443
Location: Finland
Joined: Aug 16th, 2005
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #36 - Oct 17th, 2018 at 8:53am
Print Post  
Masterkent wrote on Jul 22nd, 2018 at 12:39pm:
- initially overlapping blocking actors do not allow a crouching player to stand up,
- movers for which bCollideActors && !bBlockPlayers is true may prevent standing up.

A: Why would this occurr in the first place, isn't that bad mapping design if you get into a situation where you begin overlapping a blocking actor?
B: You have bTraceActors set to True, which as said, takes all colliding actors into account, you should have used it on False:
Code
Select All
return Player.PointCheck(Pos, HitNormal, false, Extent) == none; 



I still disagree with using any additional hacks to see if something blocks you from standing up.
  

Shivaxi wrote on Jul 25th, 2013 at 12:50pm:
...and now im stuck trying to fix everything you broke for the next 227 release xD Tongue

(ಠ_ಠ)
Back to top
ICQYIM  
IP Logged
 
.:..:
Board Moderator
Developer Team
*****
Offline



Posts: 1443
Location: Finland
Joined: Aug 16th, 2005
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #37 - Oct 17th, 2018 at 10:16am
Print Post  
After second take on this matter, heres my slightly modified solution:
PlayerPawn.uc: (discard any changes to other classes I stated earlier)
Code
Select All
var float CrouchEyeOffset;

event UpdateEyeHeight(float DeltaTime)
{
	local float smooth;

	// smooth up/down stairs
	If( (Physics==PHYS_Walking) && !bJustLanded )
	{
		smooth = FMin(1.0, 10.0 * DeltaTime/Level.TimeDilation);
		EyeHeight = (EyeHeight - Location.Z + OldLocation.Z) * (1 - smooth) + ( ShakeVert + BaseEyeHeight + CrouchEyeOffset*DrawScale) * smooth;

		if( EyeHeight<0 )
			EyeHeight = FMax(EyeHeight,-0.5 * CollisionHeight);
		else EyeHeight = FMin(EyeHeight,(Default.CollisionHeight*DrawScale) + FClamp((OldLocation.Z - Location.Z), 0.0, MaxStepHeight));
	}
	else
	{
		smooth = FClamp(10.0 * DeltaTime/Level.TimeDilation, 0.35,1.0);
		bJustLanded = false;
		EyeHeight = EyeHeight * ( 1 - smooth) + (BaseEyeHeight + ShakeVert + CrouchEyeOffset*DrawScale) * smooth;
	}

	// teleporters affect your FOV, so adjust it back down
...
}

state PlayerWalking
{
...
	function ZoneChange( ZoneInfo NewZone )
	{
		if (NewZone.bWaterZone)
		{
			if( bIsReducedCrouch && SetCrouch(false,true) && !Region.Zone.bWaterZone ) // Don't go to swimming if we successfully uncrouched.
				return;
			setPhysics(PHYS_Swimming);
			GotoState('PlayerSwimming');
		}
	}
...
	function ProcessMove(float DeltaTime, vector NewAccel, eDodgeDir DodgeMove, rotator DeltaRot)
	{
		local vector OldAccel;

		OldAccel = Acceleration;
		Acceleration = NewAccel;
		bIsTurning = ( Abs(DeltaRot.Yaw/DeltaTime) > 5000 );
		if ( (DodgeMove == DODGE_Active) && (Physics == PHYS_Falling) )
			DodgeDir = DODGE_Active;
		else if ( (DodgeMove != DODGE_None) && (DodgeMove < DODGE_Active) )
			Dodge(DodgeMove);

		if ( bPressedJump )
			DoJump();
		if ( (Physics == PHYS_Walking) && (GetAnimGroup(AnimSequence) != 'Dodge') )
		{
			if (!bIsCrouching)
			{
				if (bDuck != 0 && SetCrouch(true))
				{
					bIsCrouching = true;
					PlayDuck();
				}
			}
			else if (bDuck == 0 && SetCrouch(false))
			{
				OldAccel = vect(0,0,0);
				bIsCrouching = false;
				TweenToRunning(0.1);
			}

			if ( !bIsCrouching )
...
	}
...
	function EndState()
	{
		WalkBob = vect(0,0,0);
		bIsCrouching = false;
		SetCrouch(false,true);
	}
}

// 227 real crouching mode implemention:
simulated function bool SetCrouch( bool bCrouching, optional bool bForce )
{
	local float OldHeight,NewHeight,ZDiff;
	local vector Pos,Extent,HitNormal;

	if( !Level.bSupportsRealCrouching || bIsReducedCrouch==bCrouching )
		return true; // No can do.
	if( CrouchCheckTime==Level.TimeSeconds && !bForce )
		return false; // Avoid any possible runaway loops.

	OldHeight = CollisionHeight;
	if( bCrouching )
		NewHeight = Default.CollisionHeight*(DrawScale/Default.DrawScale)*CrouchHeightPct;
	else NewHeight = Default.CollisionHeight*(DrawScale/Default.DrawScale);
	ZDiff = (OldHeight-NewHeight);

	Pos = Location;
	Pos.Z-=ZDiff;
	Extent.X = CollisionRadius;
	Extent.Y = CollisionRadius;
	Extent.Z = NewHeight;

	if( !bForce )
	{
		CrouchCheckTime = Level.TimeSeconds;
		if( PointCheck(Pos,HitNormal,true,Extent)!=None || (bCrouching && Level.GetLocZone(Pos,Self).Zone.bWaterZone) ) // New position was blocked.
			return false;
	}

	bIsReducedCrouch = bCrouching;

	// Update collision size, prepivot height and location.
	PrePivot.Z+=ZDiff;
	EyeHeight+=ZDiff;
	if( bCrouching )
	{
		SetCollisionSize(CollisionRadius,NewHeight);
		Move(Pos-Location);
		CrouchEyeOffset = ZDiff/DrawScale;
	}
	else
	{
		Move(Pos-Location);
		SetCollisionSize(CollisionRadius,NewHeight);
		CrouchEyeOffset = 0.f;
	}
	return true;
} 


Now works with custom weapons that overwrite inventory CalcViewOffset.
Also takes into account when crouch-walking into water to not launch you up into air.
  

Shivaxi wrote on Jul 25th, 2013 at 12:50pm:
...and now im stuck trying to fix everything you broke for the next 227 release xD Tongue

(ಠ_ಠ)
Back to top
ICQYIM  
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1116
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #38 - Oct 17th, 2018 at 10:50am
Print Post  
.:..: wrote on Oct 17th, 2018 at 8:53am:
Masterkent wrote on Jul 22nd, 2018 at 12:39pm:
- initially overlapping blocking actors do not allow a crouching player to stand up,
- movers for which bCollideActors && !bBlockPlayers is true may prevent standing up.

A: Why would this occurr in the first place

1) Two or more players can be spawned at the same PlayerStart due to low number of PlayerStarts or in order to maximally reduce random factor in a competitive game (because otherwise a lucky player might be initially placed into a much more favorable area than others).

2) A player may have some kind of temporary ghost-walk abilities that allow him to pass through other players. In Coop game, this may be useful when some player blocks a narrow passage.

.:..: wrote on Oct 17th, 2018 at 8:53am:
isn't that bad mapping design if you get into a situation where you begin overlapping a blocking actor?

Mappers cannot be responsible for everything, since players may use various mods written by independent authors.

.:..: wrote on Oct 17th, 2018 at 8:53am:
B: You have bTraceActors set to True, which as said, takes all colliding actors into account

Blocking by non-overlapping actors should be possible.

.:..: wrote on Oct 17th, 2018 at 8:53am:
you should have used it on False:
Code
Select All
return Player.PointCheck(Pos, HitNormal, false, Extent) == none; 


Among these two wrongly working implementations I'd prefer the one which passes True.

.:..: wrote on Oct 17th, 2018 at 8:53am:
I still disagree with using any additional hacks to see if something blocks you from standing up.

Well, I wonder why it's difficult to implement this without any hacks. If the implementation of Actor.Move is known, making the corresponding speculative move operation (which only determines if real move operation would be done without blocking) should be possible.
  
Back to top
 
IP Logged
 
.:..:
Board Moderator
Developer Team
*****
Offline



Posts: 1443
Location: Finland
Joined: Aug 16th, 2005
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #39 - Oct 17th, 2018 at 12:13pm
Print Post  
Masterkent wrote on Oct 17th, 2018 at 10:50am:
1) Two or more players can be spawned at the same PlayerStart due to low number of PlayerStarts or in order to maximally reduce random factor in a competitive game (because otherwise a lucky player might be initially placed into a much more favorable area than others).

2) A player may have some kind of temporary ghost-walk abilities that allow him to pass through other players. In Coop game, this may be useful when some player blocks a narrow passage.

1: Well then just move out of the way and youre fine.
2: If a mod breaks the rules of the game, isn't it also the mods responsibility to make sure this doesn't happen?

Quote:
Among these two wrongly working implementations I'd prefer the one which passes True.

Wow, would you like to specify HOW its wrongly working? You don't even seam know what you are arguing up against.
If you pass the flag as True, it will treat any bCollideActors as blocking, but if you pass it as false, it only treats colliding actors with BlockedBy as blocking.
WHY would you pass it as True, it makes no sense at all.
  

Shivaxi wrote on Jul 25th, 2013 at 12:50pm:
...and now im stuck trying to fix everything you broke for the next 227 release xD Tongue

(ಠ_ಠ)
Back to top
ICQYIM  
IP Logged
 
.:..:
Board Moderator
Developer Team
*****
Offline



Posts: 1443
Location: Finland
Joined: Aug 16th, 2005
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #40 - Oct 17th, 2018 at 12:18pm
Print Post  
Masterkent wrote on Oct 17th, 2018 at 10:50am:
Mappers cannot be responsible for everything, since players may use various mods written by independent authors.

If a map decides to have real crouching enabled, then it should be specifically designed for that. It's not up to us to make sure this event doesn't happen that player spawns inside world geometry.
  

Shivaxi wrote on Jul 25th, 2013 at 12:50pm:
...and now im stuck trying to fix everything you broke for the next 227 release xD Tongue

(ಠ_ಠ)
Back to top
ICQYIM  
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1116
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #41 - yesterday at 10:21am
Print Post  
.:..: wrote on Oct 17th, 2018 at 10:16am:
After second take on this matter, heres my slightly modified solution:
PlayerPawn.uc: (discard any changes to other classes I stated earlier)
.....
Code
Select All
	function ZoneChange( ZoneInfo NewZone )
	{
		if (NewZone.bWaterZone)
		{
			if( bIsReducedCrouch && SetCrouch(false,true) && !Region.Zone.bWaterZone ) // Don't go to swimming if we successfully uncrouched.
				return;
			setPhysics(PHYS_Swimming);
			GotoState('PlayerSwimming');
		}
	} 


SetCrouch(false,true) always works "successfully", so evaluation of this function call unconditionally restores full collision height for the player which is still crouching.

.:..: wrote on Oct 17th, 2018 at 10:16am:
Code
Select All
state PlayerWalking
{
...
	function EndState()
	{
		WalkBob = vect(0,0,0);
		bIsCrouching = false;
		SetCrouch(false,true);
	} 


After evaluation of this SetCrouch, player may overlap with the world geometry...

.:..: wrote on Oct 17th, 2018 at 10:16am:
Code
Select All
// 227 real crouching mode implemention:
simulated function bool SetCrouch( bool bCrouching, optional bool bForce )
{
...
	if( !bForce )
	{
		CrouchCheckTime = Level.TimeSeconds;
		if( PointCheck(Pos,HitNormal,true,Extent)!=None || (bCrouching && Level.GetLocZone(Pos,Self).Zone.bWaterZone) ) // New position was blocked.
			return false;
	} 


This part implies that an attempt to crouch may fail. So, for example, after transition PlayerWalking -> FeigningDeath, our character may overlap with the world geometry (see above) and then cannot return back to crouching state, because the calculated target location for crouching also implies overlapping with the world geometry...

.:..: wrote on Oct 17th, 2018 at 10:16am:
Code
Select All
CrouchEyeOffset = ZDiff/DrawScale; 


Perhaps, I need to show the implications of my previously mentioned note "camera may be placed too close to the ceiling":
https://www.youtube.com/watch?v=NR_sISfuIAQ (this is how it looks with your implementation)

.:..: wrote on Oct 17th, 2018 at 12:13pm:
1: Well then just move out of the way and youre fine.

...unless you don't have to jump when spawned inside a pit. Jumping while crouching is not possible. But this situation should be rare. Nevertheless, players may notice the inconsistency between different kinds of movement: you can move horizontally, but you can't stand up - there is no logical reasoning for such a difference.

.:..: wrote on Oct 17th, 2018 at 12:13pm:
2: If a mod breaks the rules of the game, isn't it also the mods responsibility to make sure this doesn't happen?

The possibility of overlapping between players wasn't invented by authors of mods, this code in UnrealShare.CoopGame

Code
Select All
function bool IsRelevant(actor Other)
{
	// hide all playerpawns

	if ( Other.IsA('PlayerPawn') && !Other.IsA('Spectator') )
	{
		Other.SetCollision(false,false,false);
		Other.bHidden = true;
	}
	return Super.IsRelevant(Other);
} 


deliberately disables collision in order to prevent telefragging. Authors of mods may find other useful applications of such a feature. Overlapping may also occur between a player and a mover with ME_IgnoreWhenEncroch. If you can't uncrouch inside movers, this may increase chances to be trapped inside some of them.

While testing your code, I found another case of overlapping - between player and grabbed decoration (Book or SmallWoodBox). If you grab a Book while standing, you can't crouch; if you grab a Book while crouching, you can't stand up. In either case, the given implementation thinks that the grabbed decoration is blocking you.

.:..: wrote on Oct 17th, 2018 at 12:13pm:
If you pass the flag as True, it will treat any bCollideActors as blocking, but if you pass it as false, it only treats colliding actors with BlockedBy as blocking.

I tested it again (on j_40), and it doesn't work like you said. With bTraceActors == false, PointCheck ignores blocking actors, so the player can freely stand up as if there was no any obstacle; with bTraceActors == true, PointCheck considers actors whose bCollideActors == true && bBlockPlayers == true as blocking for the player, while actors, for which bCollideActors == true && bBlockPlayers == false, are not considered as blocking for the player.

.:..: wrote on Oct 17th, 2018 at 12:13pm:
WHY would you pass it as True, it makes no sense at all.

If it makes no sense, why did you pass True in your own code which you published shortly before?

.:..: wrote on Oct 17th, 2018 at 12:18pm:
If a map decides to have real crouching enabled, then it should be specifically designed for that. It's not up to us to make sure this event doesn't happen that player spawns inside world geometry.

Overlapping with regular actors and overlapping with world geometry are two different things. A mapper could place a PlayerStart inside a BlockPlayer actor and claim that this BlockPlayer actor is a tricky force field that doesn't let players return back once they leave the given radius. IMHO, this might be a fully legitimate and flawlessly working solution.
  
Back to top
 
IP Logged
 
.:..:
Board Moderator
Developer Team
*****
Offline



Posts: 1443
Location: Finland
Joined: Aug 16th, 2005
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #42 - yesterday at 9:51pm
Print Post  
Masterkent wrote yesterday at 10:21am:
This part implies that an attempt to crouch may fail. So, for example, after transition PlayerWalking -> FeigningDeath, our character may overlap with the world geometry (see above) and then cannot return back to crouching state, because the calculated target location for crouching also implies overlapping with the world geometry...

For that matter, all you need to do is to before change to FeigningDeath do a if( !SetCrouch(false) ) return; check in the beginning and you can't feign death in places you can't fit to stand up.

Quote:
deliberately disables collision in order to prevent telefragging. Authors of mods may find other useful applications of such a feature. Overlapping may also occur between a player and a mover with ME_IgnoreWhenEncroch. If you can't uncrouch inside movers, this may increase chances to be trapped inside some of them.

As the matter of overlapping a blocked actor, that's why it does also a point check before it crouches, so you can't enter full reduced collision height crouch mode if you are overlapping something. So that being said you can't get stuck in a crouched mode there.

Quote:
While testing your code, I found another case of overlapping - between player and grabbed decoration (Book or SmallWoodBox). If you grab a Book while standing, you can't crouch; if you grab a Book while crouching, you can't stand up. In either case, the given implementation thinks that the grabbed decoration is blocking you.

Sounds like an issue with how ULevel:: PointCheck handles the trace flags, will have to review on that.

Quote:
I tested it again (on j_40), and it doesn't work like you said. With bTraceActors == false, PointCheck ignores blocking actors, so the player can freely stand up as if there was no any obstacle; with bTraceActors == true, PointCheck considers actors whose bCollideActors == true && bBlockPlayers == true as blocking for the player, while actors, for which bCollideActors == true && bBlockPlayers == false, are not considered as blocking for the player.

^above.

Quote:
If it makes no sense, why did you pass True in your own code which you published shortly before?

It was just a sample, not to be used in this context.
  

Shivaxi wrote on Jul 25th, 2013 at 12:50pm:
...and now im stuck trying to fix everything you broke for the next 227 release xD Tongue

(ಠ_ಠ)
Back to top
ICQYIM  
IP Logged
 
.:..:
Board Moderator
Developer Team
*****
Offline



Posts: 1443
Location: Finland
Joined: Aug 16th, 2005
Gender: Male
Re: Real crouching bug: telefragging when getting up
Reply #43 - yesterday at 9:55pm
Print Post  
Masterkent wrote yesterday at 10:21am:
Perhaps, I need to show the implications of my previously mentioned note "camera may be placed too close to the ceiling":
https://www.youtube.com/watch?v=NR_sISfuIAQ (this is how it looks with your implementation)

Yea that doesn't happen with default human models, but if you want to be in a safe side, could add a Trace in UpdateEyeHeight and forcefully reduce eyeheight if it gets too close to ceiling.
  

Shivaxi wrote on Jul 25th, 2013 at 12:50pm:
...and now im stuck trying to fix everything you broke for the next 227 release xD Tongue

(ಠ_ಠ)
Back to top
ICQYIM  
IP Logged
 
Page Index Toggle Pages: 1 2 [3] 
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo