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

C++ Spawn BUG in ALL TFS 1.X (distro bug)

OTcreator

Well-Known Member
Joined
Feb 14, 2022
Messages
482
Solutions
1
Reaction score
53
Hi!
While I have already dealt with the duplication of monsters outside the radius, there is still a lime with the respawning of monsters in each of the TFS.If you have 2 monsters in one proficient (large) you kill two at once and one respawns after 60 seconds and the other after 120 only and so on.
It should not work that way.If you kill one , and the other 10 seconds later then one should respawn in 60 seconds and the other also after 60 seconds of killing it.
And this is not the case.Changing the setting in config.lua spawnRate to a higher number only causes two to respawn at once after 60 seconds.
In addition, changing the rateSpawn in config.lua to a high number will cause when using a larger spawn, e.g. 15x15 where you have 30 monsters, that after killing a few in small increments, all, e.g. 8 will respawn after 60 seconds. From the first kill.
And it should be 60 and 70 (because the second one was slaughtered 10 seconds later).

Try add 3 monsters on one big spawn, set spawnRate to 1x. And check time to respawn - 1 = 60, 2 =120, 3=180s respawn time...

I add video with this bug.

 
In TFS, there is a function called check spawn in spawn.cpp, which checks every 60 seconds by default whether a monster can respawn. If you kill the first monster in the spawn, this function will activate. When you kill, for example, the second monster in that spawn after 5 seconds, it will not respawn exactly after its spawn rate time, but when the check spawn function is called again. Additionally, in the new TFS, the spawn rate from config.lua defines how many monsters can respawn at once in a single spawn when the check spawn function checks the spawn again.
 
In TFS, there is a function called check spawn in spawn.cpp, which checks every 60 seconds by default whether a monster can respawn. If you kill the first monster in the spawn, this function will activate. When you kill, for example, the second monster in that spawn after 5 seconds, it will not respawn exactly after its spawn rate time, but when the check spawn function is called again. Additionally, in the new TFS, the spawn rate from config.lua defines how many monsters can respawn at once in a single spawn when the check spawn function checks the spawn again.

It's sick, do you know why?

If you kill a group of monsters in one go, e.g. use UE and 10 of them fall, it will take exactly 10 minutes (60,120,180) to resurrect monster number 10 up to 10*60.

You can save yourself with a function from config.lua by changing spawnRate = 10 (then up to 10 mobs will be reset in one go) OK.

Only what if you kill a monster first, then another in 5 seconds, another in 10 seconds and another in 5 seconds and the last in another 5 seconds.

The respan call counter has already started after killing the first monster.
So you have this: 5s+10s+5s+5s = 25 seconds.
In a minute when the countdown is over and in the config you have a rate of 10. 5 monsters will appear at once from scratch, and only about 15 seconds have passed since you killed the last one.

It works well when each monster has its own separate spawn. If there is already more than one monster in the spawn it messes up the respawn time. This is perfectly shown in the video and the example described.
 
It's sick, do you know why?

If you kill a group of monsters in one go, e.g. use UE and 10 of them fall, it will take exactly 10 minutes (60,120,180) to resurrect monster number 10 up to 10*60.

You can save yourself with a function from config.lua by changing spawnRate = 10 (then up to 10 mobs will be reset in one go) OK.

Only what if you kill a monster first, then another in 5 seconds, another in 10 seconds and another in 5 seconds and the last in another 5 seconds.

The respan call counter has already started after killing the first monster.
So you have this: 5s+10s+5s+5s = 25 seconds.
In a minute when the countdown is over and in the config you have a rate of 10. 5 monsters will appear at once from scratch, and only about 15 seconds have passed since you killed the last one.

It works well when each monster has its own separate spawn. If there is already more than one monster in the spawn it messes up the respawn time. This is perfectly shown in the video and the example described.
The last monster will not respawn in 15 seconds because the "check spawn" function checks if a given monster can respawn and then respawns it using the "spawn monster" function. Therefore, the last 3 monsters (if all 4 have a spawn time set to 60 seconds) will respawn only during the second "check spawn" check, unless blocked by the "spawn rate" from config.lua. This is well done because it introduces some randomness, making the game less mechanical and predictable. In the old real Tibia (I don’t know how it is now), monsters respawned every 4-8 minutes. Additionally, the spawn time was not fixed but dynamic, and a monster could respawn within a time range of 4-8 minutes, 3-6, 5-10, etc. Moreover, the number of online players also affected this time range - the more players, the faster the respawn time. In my opinion, this is necessary because it adds to the atmosphere of RPG games.
 
Wrong name for the thread, it is not a distro bug, it is just how rateSpawn works. I guess everything has been already explained.

But this is an incorrect action.
If you set spawnRate = 1, then with 10 monsters in the same spawn, you have to wait 10 minutes for all of them to spawn.

Each mob has its own spawn interaval, so that it spawns according to what you set in the map editor.
 
But this is an incorrect action.
If you set spawnRate = 1, then with 10 monsters in the same spawn, you have to wait 10 minutes for all of them to spawn.

Each mob has its own spawn interaval, so that it spawns according to what you set in the map editor.
So set it to 10, then up to 10 mobs will respawn at once, within a minute. Or create new spawn area in map editor for another mob...
 
So set it to 10, then up to 10 mobs will respawn at once, within a minute. Or create new spawn area in map editor for another mob...
So set it to 10, then up to 10 mobs will respawn at once - WHY ?
Each monster has a specific spawn in spawn.xml and that's how they should respawn.
And not , that those that are in the same spawn area respawn either one by one every 60 seconds, or all at once as you change the spawnRate in the config.
The spawn.cpp code is messed up.
 
So set it to 10, then up to 10 mobs will respawn at once, within a minute. Or create new spawn area in map editor for another mob...
So now you're telling us to set it to 100, and then on a large radius like 30, it would work great? Give me a break. It should work like an incremental respawn, with each monster spawning one by one after each kill, not all respawning at once. There's a big difference.
 
So now you're telling us to set it to 100, and then on a large radius like 30, it would work great? Give me a break. It should work like an incremental respawn, with each monster spawning one by one after each kill, not all respawning at once. There's a big difference.
Wait, placing a respawn area with radius 30 and spamming 100 mobs inside of it is your way to go? Dude, why even bothering about spawn areas in the first place? Remove the feature! 🤔 what the.. ok, I'm out, gl & hf ^^
 
So now you're telling us to set it to 100, and then on a large radius like 30, it would work great? Give me a break. It should work like an incremental respawn, with each monster spawning one by one after each kill, not all respawning at once. There's a big difference.
They'll all respawn at once only if you kill all at once. The rateSpawn does not bypass the spawn time from monsters.

Each monster has a specific spawn in spawn.xml and that's how they should respawn.
Yes, each monster can have it's own spawn time but the 'check' depends on the spawn flame interval (event execution). Just use a spawn flame per monster and you'll be fine.

@Edit
To workaround the spawn flame interval you could set a fixed interval as long as it has more than 1 monster to spawn.
Just go to spawn.h and replace the getInterval method with the following:
C++:
uint32_t getInterval() const {
    return spawnMap.size() > 1 ? 10000 : interval;
}
This won't affect the spawn time from monsters, just the spawn flame interval (10 seconds it's also the minimum value in rme) which by default is based on the lowest spawntime from a monster inside the spawn flame.
 
They'll all respawn at once only if you kill all at once. The rateSpawn does not bypass the spawn time from monsters.


Yes, each monster can have it's own spawn time but the 'check' depends on the spawn flame interval (event execution). Just use a spawn flame per monster and you'll be fine.

@Edit
To workaround the spawn flame interval you could set a fixed interval as long as it has more than 1 monster to spawn.
Just go to spawn.h and replace the getInterval method with the following:
C++:
uint32_t getInterval() const {
    return spawnMap.size() > 1 ? 10000 : interval;
}
This won't affect the spawn time from monsters, just the spawn flame interval (10 seconds it's also the minimum value in rme) which by default is based on the lowest spawntime from a monster inside the spawn flame.
Ok, I'll check it out.
I tried changing it only without asking if the spawn larger than one, but then something still happened wrong but I don't remember what anymore.
 
They'll all respawn at once only if you kill all at once. The rateSpawn does not bypass the spawn time from monsters.


Yes, each monster can have it's own spawn time but the 'check' depends on the spawn flame interval (event execution). Just use a spawn flame per monster and you'll be fine.

@Edit
To workaround the spawn flame interval you could set a fixed interval as long as it has more than 1 monster to spawn.
Just go to spawn.h and replace the getInterval method with the following:
C++:
uint32_t getInterval() const {
    return spawnMap.size() > 1 ? 10000 : interval;
}
This won't affect the spawn time from monsters, just the spawn flame interval (10 seconds it's also the minimum value in rme) which by default is based on the lowest spawntime from a monster inside the spawn flame.
work fine respawn in 20 sec /10 sec in rme
Post automatically merged:

Hi!
While I have already dealt with the duplication of monsters outside the radius, there is still a lime with the respawning of monsters in each of the TFS.If you have 2 monsters in one proficient (large) you kill two at once and one respawns after 60 seconds and the other after 120 only and so on.
It should not work that way.If you kill one , and the other 10 seconds later then one should respawn in 60 seconds and the other also after 60 seconds of killing it.
And this is not the case.Changing the setting in config.lua spawnRate to a higher number only causes two to respawn at once after 60 seconds.
In addition, changing the rateSpawn in config.lua to a high number will cause when using a larger spawn, e.g. 15x15 where you have 30 monsters, that after killing a few in small increments, all, e.g. 8 will respawn after 60 seconds. From the first kill.
And it should be 60 and 70 (because the second one was slaughtered 10 seconds later).

Try add 3 monsters on one big spawn, set spawnRate to 1x. And check time to respawn - 1 = 60, 2 =120, 3=180s respawn time...

I add video with this bug.

config.lua
LUA:
deSpawnRange = 200
will fixe 200 monsters will appear at once
 
Last edited:
work fine respawn in 20 sec /10 sec in rme
Post automatically merged:


config.lua
LUA:
deSpawnRange = 200
will fixe 200 monsters will appear at once
Ok, but kill first monster , next kill after 5 seconds.
First monster must spawn in 10 sekund next 5 second after first (becouse you kill kill him 5 sec after first).

Add video result :)
 
Ok, but kill first monster , next kill after 5 seconds.
First monster must spawn in 10 sekund next 5 second after first (becouse you kill kill him 5 sec after first).

Add video result :)
What's the problem with that? look
It is not 10 seconds as I explained above, it is 20 seconds, and based on what I think and what I have tested, it works well, and it will not work with you in the monster regeneration timing difference unless it is 20 seconds or more.
I don't see that there are problems
 
Guys, don't beat your head up trying to help this man. I have already told him time and time again I will fix this, but he is not happy unless someone is dedicated to working on it right now for him. The solution is simple, the design is flawed by having the spawn point in charge of creating spawns and cleaning them.... instead, the solution is to assign the spawn point to the monster during its creation, and during its removal or death, trigger a respawn. This will solve all the problem's he is having, all the problems with mixing features (like overspawn and extra spawn), it literally fixes all the problems, and it reduces CPU and will give more consistent spawn times too, because now the spawn check won't be running on an infinite loop, but rather only run at all once a monster is removed/killed.

He is specifically using black tek sources when he came to me with this problem, and I have told him many times its on my list of things to do. I actually intend to remake the entire spawn system to reduce all that overhead, and provide more options to the end user... he just is not patient enough to wait for me to get to it on my own time, so instead he has plagued discord until everyone there has had enough of him, so now he comes here, and nothing you do for him will ever be enough, be warned, if you resolve one of his complaints on this matter, he will simply find another and be back blaming you.
 
Guys, don't beat your head up trying to help this man. I have already told him time and time again I will fix this, but he is not happy unless someone is dedicated to working on it right now for him. The solution is simple, the design is flawed by having the spawn point in charge of creating spawns and cleaning them.... instead, the solution is to assign the spawn point to the monster during its creation, and during its removal or death, trigger a respawn. This will solve all the problem's he is having, all the problems with mixing features (like overspawn and extra spawn), it literally fixes all the problems, and it reduces CPU and will give more consistent spawn times too, because now the spawn check won't be running on an infinite loop, but rather only run at all once a monster is removed/killed.

He is specifically using black tek sources when he came to me with this problem, and I have told him many times its on my list of things to do. I actually intend to remake the entire spawn system to reduce all that overhead, and provide more options to the end user... he just is not patient enough to wait for me to get to it on my own time, so instead he has plagued discord until everyone there has had enough of him, so now he comes here, and nothing you do for him will ever be enough, be warned, if you resolve one of his complaints on this matter, he will simply find another and be back blaming you.
offtopic, but related.

If it's not already on your list, you should incorporate a Lua function, that allows you to set/change/remove the respawn condition from a specific creature.

Feels in line with the core change you're intending.
 
offtopic, but related.

If it's not already on your list, you should incorporate a Lua function, that allows you to set/change/remove the respawn condition from a specific creature.

Feels in line with the core change you're intending.
Absolutely doable, and like you said, perfectly in-line with the changes I would be making :D
Consider it as part of the spawn system remake I will be doing, you can count on it.
 
Back
Top