Micromod: Quake-like Wall Friction 1.1

Projects that alter game functions but do not include new maps belong here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Post Reply
User avatar
Ivory Duke
Posts: 117
Joined: Mon Jun 17, 2019 12:25 pm

Micromod: Quake-like Wall Friction 1.1

Post by Ivory Duke »

I AM NO LONGER INVOLVED IN DOOM MODDING, YOU ARE FREE TO USE THIS A YOU PLEASE (JUST MENTION MY NAME SOMEWHERE IN THE CREDITS OUT OF CURTESY).

NOTE: THE PK3 ONLY WORKS WITH VANILLA DOOM. TO WORK WITH MODS YOU WILL NEED TO EDIT THE PLAYER'S CODE.
REQUIRES GZDOOM 3.8.0 OR HIGHER. FEEL FREE TO USE TO YOUR LIKING, JUST WRITE SOMEWHERE I WAS THE ORIGINAL CREATOR


An only mildly hacky way to force Quake-like wall friction onto player movement.
What is Quake-like wall friction?
When you touch a wall your velocity is not decimated but is perfectly redirected along the impact surface.


This works on the same concept of the wallslide I coded for ZMovement, which is: GZDoom's P_SlideMove correctly changes the direction player is moving to slide along the wall, but during the process it more or less significantly decreases the player speed.
So all we need to do is keep the velocity vector direction but apply a different length to it.

The mod works around two editable values:
IMPACT_ANGLE_TOLERANCE, if the dot product of the velocity before and after impact is higher than this value the new velocity will not be demultiplied, otherwise it will be proportionally scaled. Edit the const value keeping in mind that: if VelDot is 1 (impossible) the direction of the old and new velocity is the same, 0.5 it means the impacting angle was 45, 0 the angle is 90.
FORCED_VELOCITY_TICS, how many tics velocity length is forced onto the player. 2 works best, but 1 is totally fine if you have a player that moves at regular DoomGuy's (or slower) speed.

Code: Select all

Changelog 1.1:
Slightly changed meaning of const IMPACT_ANGLE_TOLERANCE and added scaling multiplier if the impacting angle is too steep.
A couple of basic demonstration videos
Warning: they are extremely lame. Only watch if you cannot live without doing so



This will eventually be added to ZMovement 3.2, but since the release of this one is not imminent in the meantime I am putting it here in case it is interests anybody.
DOWNLOAD HERE

Code for people who don't want to download the pk3.
Spoiler:
Last edited by Ivory Duke on Sun Nov 15, 2020 10:47 am, edited 1 time in total.
User avatar
Ivory Duke
Posts: 117
Joined: Mon Jun 17, 2019 12:25 pm

Re: Micromod: Quake-like Wall Friction 1.1

Post by Ivory Duke »

1.1, I think this is it
User avatar
RikohZX
Posts: 307
Joined: Tue Sep 04, 2012 9:11 pm

Re: Micromod: Quake-like Wall Friction 1.1

Post by RikohZX »

I guess this technically means you've created the capability for Surf in Doom, huh? Interesting work, I forgot that wall collisions cripple your speed.
User avatar
StroggVorbis
Posts: 866
Joined: Wed Nov 08, 2017 4:23 pm
Graphics Processor: nVidia with Vulkan support
Location: Germany

Re: Micromod: Quake-like Wall Friction 1.1

Post by StroggVorbis »

What about Quake 1/Half-Life style slope physics/friction, like sliding them down and slowly climbing upwards when directly running into them? Would it be possible to recreate this with ZScript?
User avatar
Ivory Duke
Posts: 117
Joined: Mon Jun 17, 2019 12:25 pm

Re: Micromod: Quake-like Wall Friction 1.1

Post by Ivory Duke »

I made "Trimping" which is slope jumping and will be available as an option in the next ZMovement.
Source-Q1 slope sliding is only possible going down slopes, when you try to go up a slope the engine immediately makes your velocity 1 in the downward slope direction.
Furthermore GZDoom has inconsistent behavior between non 3D slopes and 3D slopes with an angle higher than 45.
It is doable by making a custom GZDoom version which removes its hardcoded slope behavior (which I have identified), but of course mantaining a custom GZDoom build for just one thing is out of question
User avatar
Captain J
 
 
Posts: 16891
Joined: Tue Oct 02, 2012 2:20 am
Location: An ancient Escape Shuttle(No longer active here anymore)
Contact:

Re: Micromod: Quake-like Wall Friction 1.1

Post by Captain J »

Oh yeah... I tend to have some serious problem with the walls of Vanilla Doom. No matter how far away from it, short or thin, you get stuck and lose all the momentum nonetheless. It's not Wolf 3D, but still.

But i'm glad you managed to fix this particular problem! So i guess you also could bounce off walls and boost up the speed like a super ball?
User avatar
Ivory Duke
Posts: 117
Joined: Mon Jun 17, 2019 12:25 pm

Re: Micromod: Quake-like Wall Friction 1.1

Post by Ivory Duke »

Captain J wrote:So i guess you also could bounce off walls and boost up the speed like a super ball?
Yes. Tested, works.

Code: Select all

Class BouncyPlayer : DoomPlayer
{
	const P_BOUNCE_FACTOR = 1;
	
	bool BounceForMe;
	vector2 OldVelXY;
	
	Override void HandleMovement()
	{
		Boing();
		Super.HandleMovement();
		OldVelXY = Vel.XY;
	}
	
	void Boing()
	{
		if(BounceForMe)
		{
			if(OldVelXY.Length() && Vel.XY.Length())
			{
				Vector2 WallNormal = (Vel.Y, Vel.X).Unit();
				Float ImpactDot = OldVelXY dot WallNormal;
				Vel.XY = OldVelXY - 2 * ImpactDot * WallNormal;
				Vel.XY *= P_BOUNCE_FACTOR;
			}
			BounceForMe = False;
		}
		
		if(!CheckMove(Pos.XY + Vel.XY)) { BounceForMe = True; }
	}
}
Post Reply

Return to “Gameplay Mods”