Jump to content

An interesting PVP bug in mental warrior.


Recommended Posts

  • Developer

Some time ago I had such a problem and if I'm not mistaken, the problem was in Srcs/Server/game/src/input_main.cpp

int CInputMain::SyncPosition(LPCHARACTER ch, const char * c_pcData, size_t uiBytes)
{
..
}

Technically, you should find a lot of commented code inside, on some files it is like this (Polish / Romanian source file)

to be exact, this is the commented code block, you have to reactivate it:

/*
	for (int i = 0; i < iCount; ++i, ++e)
	{
		//...
	}
*/


It seems that this "bug" is something they wanted, according to their pvp way.

Test and let me know, replace the whole function with this: https://pastebin.com/tKycmCEp

 

Edited by Mitachi
  • Good 1

503953077003354113.png

Link to comment
Share on other sites

30 minutes ago, Mitachi said:

Some time ago I had such a problem and if I'm not mistaken, the problem was in Srcs/Server/game/src/input_main.cpp

int CInputMain::SyncPosition(LPCHARACTER ch, const char * c_pcData, size_t uiBytes)
{
..
}

Technically, you should find a lot of commented code inside, on some files it is like this (Polish / Romanian source file)

to be exact, this is the commented code block, you have to reactivate it:

/*
	for (int i = 0; i < iCount; ++i, ++e)
	{
		//...
	}
*/


It seems that this "bug" is something they wanted, according to their pvp way.

Test and let me know, replace the whole function with this: https://pastebin.com/tKycmCEp

 

It was active for me and I checked your pastebin if there's any difference but no. I have the same bug as OP.
It is perfectly presented that the bug only happens after a while punching the enemy, also when the enemy moves and not let himself to punch a lot then there is no bug.

Link to comment
Share on other sites

  • Developer
51 minutes ago, Sierra said:

It was active for me and I checked your pastebin if there's any difference but no. I have the same bug as OP.
It is perfectly presented that the bug only happens after a while punching the enemy, also when the enemy moves and not let himself to punch a lot then there is no bug.

Yeah, I also had the exact same bug. I was sure I fixed it the way above, it's a bug I fixed in 2018. After a few combos it happens.
If I find anything else, I'll let you know, unfortunately in 2018 I wasn't using git, otherwise it would have taken me 5 seconds to tell you the solution 🙄

Edited by Mitachi

503953077003354113.png

Link to comment
Share on other sites

51 minutes ago, Mitachi said:

Yeah, I also had the exact same bug. I was sure I fixed it the way above, it's a bug I fixed in 2018. After a few combos it happens.
If I find anything else, I'll let you know, unfortunately in 2018 I wasn't using git, otherwise it would have taken me 5 seconds to tell you the solution 🙄

First,

Thank you for solution. But i agreed with @Sierra Still same.

If you can find true fix and share with us, i'll really glad.

 

Link to comment
Share on other sites

  • Active Member

@CaptainLucifer I just found a piece of code which could fix that problem.

Spoiler

char.cpp:

// Find this:
m_bOpeningSafebox = false;

//And below change this:
m_fSyncTime = get_float_time()-3;

//To this:
m_fSyncTime = get_dword_time()-3;

//Then find:
bool CHARACTER::CanMove() const

//And in this function change this:
if (get_float_time() - m_fSyncTime < 0.2f)

//To this:
if (get_dword_time() - m_fSyncTime < 50)

//Then find this:
bool CHARACTER::SetSyncOwner(LPCHARACTER ch, bool bRemoveFromList)

//And in this function find this:
m_fSyncTime = get_float_time();

//And change it to:
m_fSyncTime = get_dword_time();

//Then find this:
bool CHARACTER::IsSyncOwner(LPCHARACTER ch) const

//And in this function find this:
if (get_float_time() - m_fSyncTime >= 3.0f)
  
//And change to this:
if (get_dword_time() - m_fSyncTime >= 100)
  

char.h

//Find this:
float			m_fSyncTime;

//And change to this:
DWORD			m_fSyncTime;

 

Let me know if these changes solved your problem.

Edited by ReFresh

I'll be always helpful! 👊 

Link to comment
Share on other sites

1 hour ago, ReFresh said:

@CaptainLucifer I just found a piece of code which could fix that problem.

  Hide contents

char.cpp:

// Find this:
m_bOpeningSafebox = false;

//And below change this:
m_fSyncTime = get_float_time()-3;

//To this:
m_fSyncTime = get_dword_time()-3;

//Then find:
bool CHARACTER::CanMove() const

//And in this function change this:
if (get_float_time() - m_fSyncTime < 0.2f)

//To this:
if (get_dword_time() - m_fSyncTime < 50)

//Then find this:
bool CHARACTER::SetSyncOwner(LPCHARACTER ch, bool bRemoveFromList)

//And in this function find this:
m_fSyncTime = get_float_time();

//And change it to:
m_fSyncTime = get_dword_time();

//Then find this:
bool CHARACTER::IsSyncOwner(LPCHARACTER ch) const

//And in this function find this:
if (get_float_time() - m_fSyncTime >= 3.0f)
  
//And change to this:
if (get_dword_time() - m_fSyncTime >= 100)
  

char.h

//Find this:
float			m_fSyncTime;

//And change to this:
DWORD			m_fSyncTime;

 

Let me know if these changes solved your problem.

https://metin2.download/picture/88I6Hq2f6e6dq6M4wTBA80lcogz3Z158/.png

 

Still same 😞

 

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Active Member

"Let's kill source, and find best solution comment sync yeah.."

This fix worked for my server, the bug apperead since 2020 February when Microsoft updated our windows.

Char.cpp & Char.h game source and there is fix

Char.h - search
float m_fSyncTime;

Change with 
DWORD m_fSyncTime;

Char.cpp - search
if (get_float_time() - m_fSyncTime < 0.2f)
Change with 
if (get_dword_time() - m_fSyncTime < 50) 
Search
  m_fSyncTime = get_float_time();
Change with 
  m_fSyncTime = get_dword_time();
Search
  if (get_float_time() - m_fSyncTime >= 3.0f)
Change with
  if (get_dword_time() - m_fSyncTime >= 100)

 

Edited by Vaynz
  • Cry 1
Link to comment
Share on other sites

14 hours ago, Vaynz said:

"Let's kill source, and find best solution comment sync yeah.."

This fix worked for my server, the bug apperead since 2020 February when Microsoft updated our windows.

Char.cpp & Char.h game source and there is fix

Char.h - search
float m_fSyncTime;

Change with 
DWORD m_fSyncTime;

Char.cpp - search
if (get_float_time() - m_fSyncTime < 0.2f)
Change with 
if (get_dword_time() - m_fSyncTime < 50) 
Search
  m_fSyncTime = get_float_time();
Change with 
  m_fSyncTime = get_dword_time();
Search
  if (get_float_time() - m_fSyncTime >= 3.0f)
Change with
  if (get_dword_time() - m_fSyncTime >= 100)

 

 

No sir, not work 😞

Link to comment
Share on other sites

  • 2 weeks later...
  • 5 weeks later...
  • 3 months later...
  • Premium

It's worth noting that this bug only ever occurs if the mental warrior stands absolutely still doing nothing, and so it's not relevant anyhow under normal circumstances, but:

ActorInstanceSync.cpp:

bool CActorInstance::IsPushing()
{
    return m_PhysicsObject.isBlending();
}

to:

bool CActorInstance::IsPushing()
{
    return !IsResistFallen() && m_PhysicsObject.isBlending();
}
Edited by Syreldar
  • Good 1

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

On 6/7/2022 at 10:38 PM, Syreldar said:

It's worth noting that this bug only ever occurs if the mental warrior stands absolutely still doing nothing, and so it's not relevant anyhow under normal circumstances, but:

ActorInstanceSync.cpp:

bool CActorInstance::IsPushing()
{
    return m_PhysicsObject.isBlending();
}

to:

bool CActorInstance::IsPushing()
{
    return !IsResistFallen() && m_PhysicsObject.isBlending();
}

This is not a solution. 😞

Even when the mental warrior is standing still, his coordinate must be transmitted to the opposite side when he is pushed.

 

We really need help on this issue.

Is there really no one on this forum who knows how to fix it?

Link to comment
Share on other sites

  • Premium
4 minutes ago, CaptainLucifer said:

This is not a solution. 😞

Even when the mental warrior is standing still, his coordinate must be transmitted to the opposite side when he is pushed.

 

We really need help on this issue.

Is there really no one on this forum who knows how to fix it?

This solution fixes the issue that you presented. So it's the appropriate solution. 

If it generates another bug, post it and we'll try to fix it, else, don't look for something that doesn't exist.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Premium

Hmmm, it's not properly a bug. It's happening because you are not making any movement in the victim.

Anyway thanks to this thread, after some check, I figured out that may be this the problem:

 

File ActorInstanceSync.cpp:

Replace the function

void CActorInstance::__Push(int x, int y)
{
	const D3DXVECTOR3& c_rv3Src=GetPosition();
	const D3DXVECTOR3 c_v3Dst=D3DXVECTOR3(x, -y, c_rv3Src.z);
	const D3DXVECTOR3 c_v3Delta=c_v3Dst-c_rv3Src;

	const auto LoopValue = 100;
	const D3DXVECTOR3 inc = c_v3Delta / LoopValue;

	D3DXVECTOR3 v3Movement(0.0f, 0.0f, 0.0f);

	IPhysicsWorld* pWorld = IPhysicsWorld::GetPhysicsWorld();
	if (!pWorld)
		return;

	for (int i = 0; i < LoopValue; ++i)
	{
		if (pWorld->isPhysicalCollision(c_rv3Src + v3Movement))
		{
			ResetBlendingPosition();
			return;
		}
		v3Movement += inc;
	}

	SetBlendingPosition(c_v3Dst);

	if (IsResistFallen())
		return;

	if (!IsUsingSkill())
	{
		const int len = sqrt(c_v3Delta.x*c_v3Delta.x+c_v3Delta.y*c_v3Delta.y);
		if (len > 150.0f)
		{
			InterceptOnceMotion(CRaceMotionData::NAME_DAMAGE_FLYING);
			PushOnceMotion(CRaceMotionData::NAME_STAND_UP);
		}
	}
}

 

Yep, as you can see I just moved the order of execution of a statement. I leave the theory to you.

  • Love 1
Link to comment
Share on other sites

  • Premium
2 hours ago, WeedHex said:

Hmmm, it's not properly a bug. It's happening because you are not making any movement in the victim.

Anyway thanks to this thread, after some check, I figured out that may be this the problem:

 

File ActorInstanceSync.cpp:

Replace the function

void CActorInstance::__Push(int x, int y)
{
	const D3DXVECTOR3& c_rv3Src=GetPosition();
	const D3DXVECTOR3 c_v3Dst=D3DXVECTOR3(x, -y, c_rv3Src.z);
	const D3DXVECTOR3 c_v3Delta=c_v3Dst-c_rv3Src;

	const auto LoopValue = 100;
	const D3DXVECTOR3 inc = c_v3Delta / LoopValue;

	D3DXVECTOR3 v3Movement(0.0f, 0.0f, 0.0f);

	IPhysicsWorld* pWorld = IPhysicsWorld::GetPhysicsWorld();
	if (!pWorld)
		return;

	for (int i = 0; i < LoopValue; ++i)
	{
		if (pWorld->isPhysicalCollision(c_rv3Src + v3Movement))
		{
			ResetBlendingPosition();
			return;
		}
		v3Movement += inc;
	}

	SetBlendingPosition(c_v3Dst);

	if (IsResistFallen())
		return;

	if (!IsUsingSkill())
	{
		const int len = sqrt(c_v3Delta.x*c_v3Delta.x+c_v3Delta.y*c_v3Delta.y);
		if (len > 150.0f)
		{
			InterceptOnceMotion(CRaceMotionData::NAME_DAMAGE_FLYING);
			PushOnceMotion(CRaceMotionData::NAME_STAND_UP);
		}
	}
}

 

Yep, as you can see I just moved the order of execution of a statement. I leave the theory to you.

That'll also fix the issue. But based on what I see here, it means the target will also be pushed way farther than intended while usually targets with Immunity to Fall (mental warriors) get pushed way less.

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

  • Honorable Member
4 hours ago, WeedHex said:

Hmmm, it's not properly a bug. It's happening because you are not making any movement in the victim.

Anyway thanks to this thread, after some check, I figured out that may be this the problem:

 

File ActorInstanceSync.cpp:

Replace the function

void CActorInstance::__Push(int x, int y)
{
	const D3DXVECTOR3& c_rv3Src=GetPosition();
	const D3DXVECTOR3 c_v3Dst=D3DXVECTOR3(x, -y, c_rv3Src.z);
	const D3DXVECTOR3 c_v3Delta=c_v3Dst-c_rv3Src;

	const auto LoopValue = 100;
	const D3DXVECTOR3 inc = c_v3Delta / LoopValue;

	D3DXVECTOR3 v3Movement(0.0f, 0.0f, 0.0f);

	IPhysicsWorld* pWorld = IPhysicsWorld::GetPhysicsWorld();
	if (!pWorld)
		return;

	for (int i = 0; i < LoopValue; ++i)
	{
		if (pWorld->isPhysicalCollision(c_rv3Src + v3Movement))
		{
			ResetBlendingPosition();
			return;
		}
		v3Movement += inc;
	}

	SetBlendingPosition(c_v3Dst);

	if (IsResistFallen())
		return;

	if (!IsUsingSkill())
	{
		const int len = sqrt(c_v3Delta.x*c_v3Delta.x+c_v3Delta.y*c_v3Delta.y);
		if (len > 150.0f)
		{
			InterceptOnceMotion(CRaceMotionData::NAME_DAMAGE_FLYING);
			PushOnceMotion(CRaceMotionData::NAME_STAND_UP);
		}
	}
}

 

Yep, as you can see I just moved the order of execution of a statement. I leave the theory to you.

This solves the issue client-side, but not server-side. When you respawn, you restart from where the one-sided fight started:

d6gZGxv.png

I'm gonna check it further more.

After relogin:

6fpyQAQ.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Good 1
  • Love 1
Link to comment
Share on other sites

  • Honorable Member
3 hours ago, Syreldar said:

But based on what I see here, it means the target will also be pushed way farther than intended while usually targets with Immunity to Fall (mental warriors) get pushed way less.

To solve this, I've tried to reduce the push by 20%:

rHOdniw.png

        // VICTIM_COLLISION_TEST
        const D3DXVECTOR3& kVictimPos = rVictim.GetPosition();
        auto externalForceRatio = 1.0f;
        if (rVictim.IsResistFallen())
            externalForceRatio = 0.8f; // reduce external force almost like before
        rVictim.m_PhysicsObject.IncreaseExternalForce(kVictimPos, c_rAttackData.fExternalForce * externalForceRatio);
        // VICTIM_COLLISION_TEST_END

ActorInstanceBattle.cpp CActorInstance::__ProcessDataAttackSuccess

 

https://metin2.download/video/vMrt47r4elg57lFB6ym3v765UoC6q2MI/.mp4
0.7f

Edited by Metin2 Dev
Core X - External 2 Internal
  • Dislove 1
  • Good 2
  • Love 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.