• 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!

TFS 1.2 Weird monster behavior

Stanos

Veteran OT User
Joined
Jun 12, 2018
Messages
584
Solutions
4
Reaction score
314
Location
Europe
Hello,
i dont ask support that often but i guess i have no choice. So i was testing some stuff on localhost which is zero ping and i noticed that monsters have weird delay before they die, so what i mean is when you kill a monster it shows that it has zero health but it takes couple milliseconds before he dies so its kinda ugly problem you can even imagine what would happen if you had this stuff hosted.

Source: [8.60] The Forgotten Server 1.2 (https://otland.net/threads/8-60-the-forgotten-server-1-2.236489/)
 
It works perfectly with me.
Hmm thats weird because mine monsters feels kinda choppy, laggy even if you are on range of that monster it takes couple milliseconds until he starts focusing you, i dont know they just going crazy/stupid sometimes
35785
But maybe its normal to have some delay and lag with monsters, i dont know but to me it doesnt feel normal.
EDIT: if you can show me gif or video of your server, do they have death delay or something like that so i could compare with mine
 
Okay guys this is what i mean. Note im on localhost. Sorry for bad quality and if its not what you used to see, since i work with anime type of server. But you can see death delay in this gif
35792
 
There have to be actions that delay this kind of thing, but without seeing whole source we can only guess.

I would, first, try to find costly operations in onDie event (and it's derivatives) like printing, saving to file etc.
 
There have to be actions that delay this kind of thing, but without seeing whole source we can only guess.

I would, first, try to find costly operations in onDie event (and it's derivatives) like printing, saving to file etc.
Its really hard to say i have just a two custom stuff that is related with ondie so first one is custom player corpses but i would highly doubt about this one. The second custom script which is related with monsters but not really monsters is "saga" system (based on storage) but again i would highly doubt it either , but i will ask that person who made that saga system is it possible or not. So thats it.
TFS 1.0+ has laggy monster deaths
So it means its not my custom shit that cause it.
 
Which storage does saga/onDie wait on?
It doesnt go onDie but storage is 1000. Saga system works like this (if you dont have x storage) that monster wont attack you, so if you have x storage that monster will start attacking you, after you kill it you get x storage. But i contacted the creator of that system he said he have the same death delay and he dont have saga system (not sure) so he will look into this. But if someone have more ideas about this problem, i will appreciate it.
 
Based on your description it shouldn't be the saga, so let's talk about your custom player corpses - what is it for and do you mind sharing code or is it somehow secret?
 
Based on your description it shouldn't be the saga, so let's talk about your custom player corpses - what is it for and do you mind sharing code or is it somehow secret?
About custom corpses for players i would highly doubt either.
C++:
uint16_t Player::getLookCorpse() const
{
    int32_t value;
    getStorageValue((uint32_t)TRANSFORM_CORPSE_STORAGE, value);

    if (value > 0) {
        return value;
    } else {
        if (sex == PLAYERSEX_FEMALE) {
            return ITEM_FEMALE_CORPSE;
        } else {
            return ITEM_MALE_CORPSE;
        }
    }
}
Lua:
 if transform.corpse then self:setStorageValue(TRANSFORM_CORPSE_STORAGE, transform.corpse) end

What do you thing about editing
C++:
#define EVENT_CREATURECOUNT 10
#define EVENT_CREATURE_THINK_INTERVAL 1000
#define EVENT_CHECK_CREATURE_INTERVAL (EVENT_CREATURE_THINK_INTERVAL / EVENT_CREATURECOUNT)
to like 1 and 50? But have no idea how much it will effect cpu and ram
 
Hmm so changed interval to 500 and cant see the difference pretty much, the only thing that i noticed its better if you kill one monster it feels kinda smoother but if around you there is like 3-6 and etc it feels the same so its kinda ass situation.
 
It makes sense, i'll try. About what crash are you talking about that can happen i just want to know, how this delay can help to avoid crash.
Edit and what safe interval would be to use then EVENT_CHECK_CREATURE_INTERVAL

As far as I understand (not good with sources), when a creature is killed, instead of removing it it will just get flagged for removal. This is to make sure scheduled jobs for the creature (like onThink, condition effects) queue jobs are properly executed and terminated before removing the creature object. Because when they try to do stuff with a creature that no longer exist the server will crash, possibly because the pointers and references are wrong in the scheduled jobs. This may result in another "server tick" before the cleanup is done and creature is ready to actually be removed.
 
As far as I understand (not good with sources), when a creature is killed, instead of removing it it will just get flagged for removal. This is to make sure scheduled jobs for the creature (like onThink, condition effects) queue jobs are properly executed and terminated before removing the creature object. Because when they try to do stuff with a creature that no longer exist the server will crash, possibly because the pointers and references are wrong in the scheduled jobs. This may result in another "server tick" before the cleanup is done and creature is ready to actually be removed.
So as far as i understand there is no solution for it, without consequences?
 
So as far as i understand there is no solution for it, without consequences?

There is always a way. Just because the creature object needs to be alive for a bit longer, the client doesn't need to know that. The question is how to make it better, feel free to send pull requests to the repo if you have a solution. (I don't).
 
Back
Top