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

knownCreatureSet?

pink_panther

Excellent OT User
Joined
Sep 10, 2016
Messages
1,171
Solutions
13
Reaction score
613
Location
Kazordoon
Hey

Just beeng trying to do some troubleshooting in implementing a casting system.

I occasionally get a client debug for the spectators when using the normal tibia client (OT Client seems to not care or crash)

I think it's related to the knownCreatureSet and the way it's removing a random known creature to make room.

I noticed in the Nostalrius distro, this check has a limit of 150 monsters

The function is checkCreatureAsKnown(uint32_t id, bool& known, uint32_t& removedKnown)

C++:
if (knownCreatureSet.size() > 150) {
        // Look for a creature to remove

This section here, I noticed in the latest TFS it checks if > 1300, but here is 150. Not sure why?

Also, If I increase this above 150, once my character "knowsn" more than 150 creatures, it will cause the client to debug (The debug error seems to think it was trying to update a tile to show an item with an ID that exceeds the number of items. It seems to mess up the AddCreature function, where it's trying to remove something, but hasn't anything to remove so it just sends invalid data.

Can anyone call me more about this knownCreatureSet limits? Does the 7.x client have a client side limit of 150, or what allows this to incease? Why does the latest TFS distro have 1300?
 
Yes, it has an array of 150 creatures.

Right, so this was a 7.x client side thing only?

I think the issue is the way spectators are syncing this list. For example, if im playing, i might have 150~ knonw creatures, when spectator joins, it's only 30 or so, but once the spectators get to that 150 limit, it starts receiving invalid information and will crash.
 
Right, so this was a 7.x client side thing only?

I think the issue is the way spectators are syncing this list. For example, if im playing, i might have 150~ knonw creatures, when spectator joins, it's only 30 or so, but once the spectators get to that 150 limit, it starts receiving invalid information and will crash.
I don't know about the actual issue. I don't work with this server and its cast system. All I can confirm is that old Tibia client technically had a limit of 150 creatures, because there was an array for exactly that number. An array means that they were stored in memory one after the other in one section, not allocated dynamically. They probably have changed it in some newer version, but I don't know which one exactly. For sure in 7.X clients you have this limit.
OTC probably has some other data structure which can dynamically allocate more creatures as long as you have memory for them (probably, because I did not look into the code).
If you want to keep Tibia client compatible, you have to stick to 150 known creatures. Alternatively you could maybe check which client player is using and then send the creatures accordingly.
 
Last edited:
Thanks.

On further investigation it looks like it's just the knownCreatureSet list drifting out of sync from the Caster and the people spectating.

The spectators known creatures list is different from the caster, accordinly when it comes to sending back packets for Tile update, the spectators are expecting different data to what it's getting and causing the client to crash.

I'll need to figure out how to keep this known creatures list the same as the casters. If i log in, enable casting and log in with a spectator before seeing any other creatures, it will stay connected just fine. But if the Caster sees creatures, or any spectators connect after the caster has seen some monsters, the spectators will eventually crash.


I know it's vague, but I'm getting there. I've implemented this on the Nostalrius distro and just working out the bugs.
 
Back
Top