demoinfocs-golang icon indicating copy to clipboard operation
demoinfocs-golang copied to clipboard

isWalking flag is not actually walking

Open sjaanus opened this issue 3 years ago • 9 comments
trafficstars

Also mentioned in markus-wa/demoinfocs-golang#317

isWalking is using underlying CSGO flag m_bIsWalking, which actually means that user is holding walk button.

Also reproduced it in local machine, by standing still, holding walk key and attacking enemy. All hits were done and isWalking was true.

sjaanus avatar Dec 17 '21 18:12 sjaanus

I implemented a check that checks if players is moving based on velocity. Basically checked all shots that occured when velocity was higher than 0. It seems that pro players move 60-80% of shots they take. This means there might not be a accuracy penalty while moving in very low speeds.

I think a good thing to implement is this https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/cstrike15/weapon_csbase.cpp#L1208

This allows to check how much penalty users get during shooting, which basically means how efficient they are.

sjaanus avatar Dec 19 '21 12:12 sjaanus

thanks for the detailed analysis @sjaanus - I think this may indeed be worth re-implementing.

PRs welcome, otherwise I'll see if/when I can get to it.

markus-wa avatar Dec 19 '21 23:12 markus-wa

Do you know how much velocity affects accuracy? Like, lets say velocity is on scale 0 to 250. I checked if all values are over 0, then player is moving. But maybe when velocity is like 1, then player gets no penalty.

sjaanus avatar Dec 20 '21 07:12 sjaanus

I would say this is the key bit

float flMovementInaccuracyScale = RemapValClamped(pPlayer->GetAbsVelocity().Length2D(), 
		fMaxSpeed * CS_PLAYER_SPEED_DUCK_MODIFIER, 
		fMaxSpeed * 0.95f,							// max out at 95% of run speed to avoid jitter near max speed
		0.0f, 1.0f );

and then

		float flAirSpeedInaccuracy = RemapVal( fSqrtVerticalSpeed,
			fSqrtMaxJumpSpeed * 0.25f,	// Anything less than 6.25% of maximum speed has no additional accuracy penalty for z-motion (6.25% = .25 * .25)
			fSqrtMaxJumpSpeed,			// Penalty at max jump speed
			0.0f,						// No movement-related penalty when close to stopped
			flInaccuracyJumpInitial );	// Movement-penalty at start of jump

markus-wa avatar Dec 20 '21 13:12 markus-wa

the code you linked seems to cover all these areas I think

markus-wa avatar Dec 20 '21 13:12 markus-wa

Do you have any examples where you call methods from game/shared/cstrike15/weapon_csbase.cpp? This could help to a right path.

sjaanus avatar Dec 22 '21 18:12 sjaanus

we can't call any source-engine code from this library. it has to be re-implemented in Go.

but I think the data is all there, e.g. m_fAccuracyPenalty := weapon.Entity.PropertyValueMust("m_fAccuracyPenalty") etc.

let me know if you're missing any of the variables used in the calculation and I'll try to dig them up

markus-wa avatar Dec 22 '21 19:12 markus-wa

Okay that is over my head. The method I linked, there are too many variables in there. Have never touched csgo source and Go language before. Not a good starter project 😄

sjaanus avatar Dec 22 '21 19:12 sjaanus

fair enough @sjaanus :sweat_smile: - yeah most new features are pretty tricky now, the easy stuff is mostly done :disappointed:

I'll see if I can get to this soon :tm: but I wouldn't hold my breath to be fair

markus-wa avatar Dec 29 '21 14:12 markus-wa