Ascuas Funkeln
Rakkedo Game
- Joined
- Apr 14, 2013
- Messages
- 549
- Solutions
- 32
- Reaction score
- 305
- Location
- Poland
- GitHub
- AscuasFunkeln
Hello, after reaching full madness and despair, i managed to achieve half success "for me", I think.
I started building my own server a few years ago with the client based on the original version OTC by @edubart.
I do not have the Mehah and V8 versions, so I do not know anything about the source codes and the changes made by the developers of these versions.
Warning! Its "noobish" fix xD
1.
Read this topic and make changes to your source code
Final thread for fixing OTClient dashing animation issue for TFS 1.3 (https://otland.net/threads/final-thread-for-fixing-otclient-dashing-animation-issue-for-tfs-1-3.263272/)
2.
In
3.
Now in
Change
To
And change:
To
4.
I change in config.lua maxPacketsPerSecond to 50, but on 25 its look i think the same, just to test it. I increase it just "for sure" xD
5.
And this best work on Enabled Vertical Synchronization this will set automic 60 FPS
6.
Check Full Video how its work in mine client, i test in this video 3 characters with different movement speed.
7.
As i said its not PRO FIX, and may cause some problems, but i dont see anything yet
Best thing its work with Enabled Vertical Synchronization at 60 FPS so, the usage CPU by OTC highly drop from 15% to 4% on my PC.
I started building my own server a few years ago with the client based on the original version OTC by @edubart.
I do not have the Mehah and V8 versions, so I do not know anything about the source codes and the changes made by the developers of these versions.
Warning! Its "noobish" fix xD
1.
Read this topic and make changes to your source code
Final thread for fixing OTClient dashing animation issue for TFS 1.3 (https://otland.net/threads/final-thread-for-fixing-otclient-dashing-animation-issue-for-tfs-1-3.263272/)
2.
In
modules\game_interface\game_interface.lua
set delay to 0
Lua:
function bindKeys()
gameRootPanel:setAutoRepeatDelay(0)
3.
Now in
src\client\localplayer.cpp
Change
C++:
bool LocalPlayer::canWalk(Otc::Direction direction)
{
// cannot walk while locked
if(m_walkLockExpiration != 0 && g_clock.millis() < m_walkLockExpiration)
return false;
// paralyzed
if(m_speed == 0)
return false;
// last walk is not done yet
if((m_walkTimer.ticksElapsed() < getStepDuration()) && !isAutoWalking())
return false;
// prewalk has a timeout, because for some reason that I don't know yet the server sometimes doesn't answer the prewalk
bool prewalkTimeouted = m_walking && m_preWalking && m_walkTimer.ticksElapsed() >= getStepDuration();
// avoid doing more walks than wanted when receiving a lot of walks from server
if(!m_lastPrewalkDone && m_preWalking && !prewalkTimeouted)
return false;
// cannot walk while already walking
if((m_walking && !isAutoWalking()) && (!prewalkTimeouted || m_secondPreWalk))
return false;
return true;
}
To
C++:
bool LocalPlayer::canWalk(Otc::Direction direction)
{
// cannot walk while locked
if(m_walkLockExpiration != 0 && g_clock.millis() < m_walkLockExpiration)
return false;
// paralyzed
if(m_speed == 0)
return false;
// last walk is not done yet
if((m_walkTimer.ticksElapsed() < getStepDuration()) && !isAutoWalking())
return false;
// prewalk has a timeout, because for some reason that I don't know yet the server sometimes doesn't answer the prewalk
bool prewalkTimeouted = m_walking && m_preWalking && m_walkTimer.ticksElapsed() >= getStepDuration();
// avoid doing more walks than wanted when receiving a lot of walks from server
if(!m_lastPrewalkDone && m_preWalking && !prewalkTimeouted)
return false;
// cannot walk while already walking
if((m_walking && !isAutoWalking()) && (!prewalkTimeouted || m_secondPreWalk))
return true;
return true;
}
And change:
C++:
void LocalPlayer::cancelWalk(Otc::Direction direction)
{
// only cancel client side walks
if(m_walking && m_preWalking)
stopWalk();
m_lastPrewalkDone = true;
m_idleTimer.restart();
lockWalk();
if(m_autoWalkDestination.isValid()) {
g_game.stop();
auto self = asLocalPlayer();
if(m_autoWalkContinueEvent)
m_autoWalkContinueEvent->cancel();
m_autoWalkContinueEvent = g_dispatcher.scheduleEvent([self]() {
if(self->m_autoWalkDestination.isValid())
self->autoWalk(self->m_autoWalkDestination);
}, 500);
}
// turn to the cancel direction
if(direction != Otc::InvalidDirection)
setDirection(direction);
callLuaField("onCancelWalk", direction);
}
To
C++:
void LocalPlayer::cancelWalk(Otc::Direction direction)
{
// only cancel client side walks
if(m_walking && m_preWalking)
m_lastPrewalkDone = true;
m_idleTimer.restart();
lockWalk();
if(m_autoWalkDestination.isValid()) {
g_game.stop();
auto self = asLocalPlayer();
if(m_autoWalkContinueEvent)
m_autoWalkContinueEvent->cancel();
m_autoWalkContinueEvent = g_dispatcher.scheduleEvent([self]() {
if(self->m_autoWalkDestination.isValid())
self->autoWalk(self->m_autoWalkDestination);
}, 500);
}
// turn to the cancel direction
if(direction != Otc::InvalidDirection)
setDirection(direction);
callLuaField("onCancelWalk", direction);
}
4.
I change in config.lua maxPacketsPerSecond to 50, but on 25 its look i think the same, just to test it. I increase it just "for sure" xD
maxPacketsPerSecond = 50
5.
And this best work on Enabled Vertical Synchronization this will set automic 60 FPS
6.
Check Full Video how its work in mine client, i test in this video 3 characters with different movement speed.
As i said its not PRO FIX, and may cause some problems, but i dont see anything yet
Best thing its work with Enabled Vertical Synchronization at 60 FPS so, the usage CPU by OTC highly drop from 15% to 4% on my PC.