• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OTClient Animations - lets give it a try

oen432

Legendary OT User
Joined
Oct 3, 2014
Messages
1,900
Solutions
55
Reaction score
2,121
Location
Poland
GitHub
Oen44
Hello,

While digging through forum, I'm reading more and more complaiments about animations in OTClient. @Keru told me it's about Idle Animations which were added at some point in official Tibia. I thought I'll give it a try and implement these animations into OTC. Well... I'm stuck at something different than coding right now. Downloaded Object Builder 0.3.3 which is compatible with Tibia 10.98 (found somewhere on this forum), opened Tibia.spr and exported Citizen outfit to .PNG. Unfortunately I don't see any idle animation frames there. Only walking, standing and while mounted.

Before I get to coding part, I'll have to get proper tools and files to work with these animations. Can someone link me Tibia files (spr, dat, pic) and tools like Object Builder but newer or something?
 
Try with an outfit that has moving parts when idle. Evoker for example.

But its not only that, theres also some monsters bugged (mino archer, squirrel, not sure if more)
 
Actually I uploaded a fix/workaround almost a week ago to OTLand's OTClient fork (WalkAnimation). I guess it went by unnoticed due to the fact that the majority of its (OTC) users are following the main repository, and not this new one :p.

Anyway, looking forward to see your attempt (if your intention is to share the solution with the public that is) ;)
 
Actually I uploaded a fix/workaround almost a week ago to OTLand's OTClient fork (WalkAnimation). I guess it went by unnoticed due to the fact that the majority of its (OTC) users are following the main repository, and not this new one :p.

Anyway, looking forward to see your attempt (if your intention is to share the solution with the public that is) ;)
Uhh, so there is no point for me to spend time on this. I'll get back to my mods then.

if your intention is to share the solution with the public that is
This is the only reason that I even thought about doing this, for people, not me, I'm not even Tibia player at this moment.
 
TFS 1.3 compiled for Windows x64 today +
OTClient - OTLands' Fork compiled for Windows x32 today +
OTClient - OTLand's Fork compiled for Windows x32 today with @Ninja commit, take your own conclusions:
http://www.mediafire.com/file/n2ahhrfd4a38dz9/tfs1.3+++otclient+(animation+fixed).zip

Original OTClient - OTLands' Fork without changes - Streamable (https://streamable.com/95l7x) (walking on Original OTClient - OTLands' Fork)
OTClient - OTLands' Fork with NinjaLulz changes - Streamable (https://streamable.com/j89lw) (walking on OTClient - OTLands' Fork with @Ninja changes)

I think my screen recorder has bad fps :/

Tested with a level 1 and a level 120, for me its working so much better.

Edit:
Tested with a Tibia 10.98, then with the changed OTClient. The @Ninja fix is changing sprites a little more fast than normal Tibia.

I'm working on fix that trying different values for footdelay.

My fix, on creature.cpp use this formula to footDelay:
Code:
int footDelay = (getStepDuration(true) / footAnimPhases) * 2;
and
Code:
footDelay = (getStepDuration(true) / footAnimPhases) * 2;

I know this is not the right solution, not all sprites are being used.

Also I think
Code:
if(totalPixelsWalked == 32 && !m_walkFinishAnimEvent) {
should be
Code:
if(totalPixelsWalked >= 32 && !m_walkFinishAnimEvent) {

Shouldnt footDelay be float?

getAnimationPhases() is returning 9, so why do you removed the -1?

shouldnt footSteps be reset?

Edit:
Did 1 sqm walk on client, printed that on terminal, I think its reaaaally smooth now reseting footSteps count.
Code:
ERROR: m_footStep = 1
ERROR: m_walkAnimationPhase = 2
ERROR: m_footStep = 2
ERROR: m_walkAnimationPhase = 3
ERROR: m_footStep = 3
ERROR: m_walkAnimationPhase = 4
ERROR: m_footStep = 4
ERROR: m_walkAnimationPhase = 5
ERROR: m_footStep = 5
ERROR: m_walkAnimationPhase = 6
ERROR: m_footStep = 6
ERROR: m_walkAnimationPhase = 7
ERROR: m_footStep = 7
ERROR: m_walkAnimationPhase = 8
ERROR: m_footStep = 8
ERROR: m_walkAnimationPhase = 1

Code:
void Creature::updateWalkAnimation(int totalPixelsWalked)
{
    // update outfit animation
    if(m_outfit.getCategory() != ThingCategoryCreature)
        return;

    int footAnimPhases = getAnimationPhases() - 1;
    float footDelay = getStepDuration(true) / footAnimPhases;

    // since mount is a different outfit we need to get the mount animation phases
    if(m_outfit.getMount() != 0) {
        ThingType *type = g_things.rawGetThingType(m_outfit.getMount(), m_outfit.getCategory());
        footAnimPhases = type->getAnimationPhases() - 1;
        footDelay = getStepDuration(true) / footAnimPhases;
    }

    if(totalPixelsWalked >= 32 && !m_walkFinishAnimEvent) {
        m_footStep = 0;

        auto self = static_self_cast<Creature>();
        m_walkFinishAnimEvent = g_dispatcher.scheduleEvent([self] {
            if(!self->m_walking || self->m_walkTimer.ticksElapsed() >= self->getStepDuration(true))
                self->m_walkAnimationPhase = 0;
            self->m_walkFinishAnimEvent = nullptr;
        }, std::min<int>(footDelay, 200));
    }

    if(footAnimPhases == 0) {
        m_walkAnimationPhase = 0;
    }
    else if(m_footStepDrawn && m_footTimer.ticksElapsed() >= footDelay && totalPixelsWalked < 32) {
        m_footStep++;
        m_walkAnimationPhase = m_footStep % footAnimPhases;
        m_footStepDrawn = false;
        m_footTimer.restart();
    }
    else if(m_walkAnimationPhase == 0 && totalPixelsWalked < 32) {
        m_walkAnimationPhase = m_footStep % footAnimPhases;
    }

}

With this function I think its veery near real tibia animation
But it looks like the last frame walking left (when left foot is out of the ground) is skipping a little faster than normal, dont know how to fix. But thats the only issue i guess.
 
Last edited:
Back
Top