Way too many mobs ... #3981

Open
opened 2023-03-12 23:48:48 +00:00 by Boot · 12 comments
Member

... for my taste. In the Nether this seems to be intentional, but already at -1600?

... for my taste. In the Nether this seems to be intentional, but already at -1600? ![](https://gitea.your-land.de/attachments/1fb8be6e-e500-4e67-91db-b92d67a87aee)
Boot changed title from Way too many mobs for my taste. In the Nether this seems to be intentional, but already at -1600? to Way too many mobs ... 2023-03-12 23:49:54 +00:00
Member

If someone is hanging out in the area, say in a well-lit stone bunker for example... lots of mobs will spawn in the active map block area (3x3x3=27) then 27 map blocks of spawned monsters could potentially wander out of it only to reload the next time an unsuspecting player comes into the area.

It is indeed a complicated issue to deal with, but they're not just spawning like that out of the blue, my guess is someone AFKs nearby and that causes it.

If someone is hanging out in the area, say in a well-lit stone bunker for example... lots of mobs will spawn in the active map block area (3x3x3=27) then 27 map blocks of spawned monsters could potentially wander out of it only to reload the next time an unsuspecting player comes into the area. It is indeed a complicated issue to deal with, but they're not just spawning like that out of the blue, my guess is someone AFKs nearby and that causes it.
Member

this is an issue i'm aware of, and which i'll try to address w/ my personal mobs mod, but i'm still not promising that before the end of the year.

the solution in my mind, is that mobs need to check how many other active mobs are in the area when they reload, not just when they are created initially. we're a ghost; are there already 10 ghosts loaded in the area? then we delete ourselves. similarly, other mobs.

this is an issue i'm aware of, and which i'll try to address w/ my personal mobs mod, but i'm still not promising that before the end of the year. the solution in my mind, is that mobs need to check how many other active mobs are in the area when they *reload*, not just when they are created initially. we're a ghost; are there already 10 ghosts loaded in the area? then we delete ourselves. similarly, other mobs.
AliasAlreadyTaken added the
1. kind/enhancement
label 2023-03-13 08:53:37 +00:00

How do other servers which have mobs solve the problem?

How do other servers which have mobs solve the problem?
Member

I'm not sure other servers have quite as much AFKing as we do... but I do see that as a real trigger of this issue cuz I've seen it happen again and again in a very controlled spot I've been at - well 2 of them now. Places I routinely AFK'd that were not protected or open protected... BAM the issue is easy to create.

I'm not sure other servers have quite as much AFKing as we do... but I do see that as a real trigger of this issue cuz I've seen it happen again and again in a very controlled spot I've been at - well 2 of them now. Places I routinely AFK'd that were not protected or open protected... BAM the issue is easy to create.
Member

we're a ghost; are there already 10 ghosts loaded in the area? then we delete ourselves.

No no! If there are already that many of our species then it has to be a good place! Let's head for it :-)

The problem is a bit annoying but not as big as other issues with mobs and lag i'm afraid.

> we're a ghost; are there already 10 ghosts loaded in the area? then we delete ourselves. No no! If there are already that many of our species then it has to be a *good* place! Let's head for it :-) The problem is a bit annoying but not as big as other issues with mobs and lag i'm afraid.
Author
Member

I'm not sure other servers have quite as much AFKing as we do...

I am not very often afk there. Just a wall behind my chests, tube and anvil and after digging I am load off and sometimes chatting. I really thought mobs will despawn after a while.

> I'm not sure other servers have quite as much AFKing as we do... I am not very often afk there. Just a wall behind my chests, tube and anvil and after digging I am load off and sometimes chatting. I really thought mobs will despawn after a while.
Member

we're a ghost; are there already 10 ghosts loaded in the area? then we delete ourselves.

it's too bad get_objects_inside_radius is so expensive...

> we're a ghost; are there already 10 ghosts loaded in the area? then we delete ourselves. it's too bad `get_objects_inside_radius` is so expensive...
Member

it's too bad get_objects_inside_radius is so expensive...

Perhaps minetest.get_objects_in_area is cheaper? Still, the ghosts want to gather in an area.

> it's too bad get_objects_inside_radius is so expensive... Perhaps minetest.get_objects_in_area is cheaper? Still, the ghosts want to gather in an area.
Member

it's too bad get_objects_inside_radius is so expensive...

Perhaps minetest.get_objects_in_area is cheaper? Still, the ghosts want to gather in an area.

it is not cheaper. both check every single mob that's currently loaded, and we generally have between 2000 and 5000 at any given moment. it's not expensive when called occasionally, but if a few hundred mobs try to call it within a single server step, then problems.

> > it's too bad get_objects_inside_radius is so expensive... > > Perhaps minetest.get_objects_in_area is cheaper? Still, the ghosts want to gather in an area. it is not cheaper. both check *every single mob that's currently loaded*, and we generally have between 2000 and 5000 at any given moment. it's not expensive when called occasionally, but if a few hundred mobs try to call it within a single server step, then problems.
Member

Are you certain we have so many mobs? We have plenty of entities (definitely in that range), but simultaneously loaded mobs is usually far less.

Mobs that attack other mobs already search for them. There's no ready-to-use interface in mobs_redo, but they might start counting how many of their own kind they can see. That wouldn't cost much regarding CPU ressources but would require a PR to mobs_redo I'm afraid :/

Are you certain we have so many mobs? We have plenty of entities (definitely in that range), but simultaneously loaded mobs is usually far less. Mobs that attack other mobs already search for them. There's no ready-to-use interface in mobs_redo, but they might start counting how many of their own kind they can see. That wouldn't cost much regarding CPU ressources but would require a PR to mobs_redo I'm afraid :/
Member

between 2000 and 5000
Are you certain we have so many mobs? We have plenty of entities (definitely in that range), but simultaneously loaded mobs is usually far less.

you're right, my mistake. those #s are counting entities, not actual mobs that are "movable" interact w/ the world. but they all contribute to the expense of get_objects_in_area and get_objects_inside_radius.

There's no ready-to-use interface in mobs_redo, but they might start counting how many of their own kind they can see. That wouldn't cost much regarding CPU ressources but would require a PR to mobs_redo I'm afraid :/

i'm imagining an API that caches paths between all points in a region - this would be an engine change, an rather complicated to get right, but do-able. someone should press me to outline the feature and report it upstream.

>> between 2000 and 5000 > Are you certain we have so many mobs? We have plenty of entities (definitely in that range), but simultaneously loaded mobs is usually far less. you're right, my mistake. those #s are counting entities, not actual mobs that are "movable" interact w/ the world. but they all contribute to the expense of `get_objects_in_area` and `get_objects_inside_radius`. > There's no ready-to-use interface in mobs_redo, but they might start counting how many of their own kind they can see. That wouldn't cost much regarding CPU ressources but would require a PR to mobs_redo I'm afraid :/ i'm imagining an API that *caches paths between all points in a region* - this would be an engine change, an rather complicated to get right, but do-able. someone should press me to outline the feature and report it upstream.
Member

but they all contribute to the expense of get_objects_in_area and get_objects_inside_radius

That's right. Most of them (text on signs, deco in itemframes, smartshop offers, ..) are only of relevance to the players. Even pressure plates and sucking tubes wouldn't be intrested in those. I wonder if it might make sense to add a parameter to minetest.get_objects_* functions to only return entities that can move/be moved?

i'm imagining an API that caches paths between all points in a region - this would be an engine change, an rather complicated to get right, but do-able. someone should press me to outline the feature and report it upstream.

Hmm. I'm not sure if we need that in general. In general, in normal situations, mobs seem to be able to handle what they do. Voice fights are diffrent. There we need all the optimization we can get.

What you say sounds a bit like a heightmap to me. Sadly those are only available at mapgen time, and it's not exactly 2d either (imagine a house with differnt floors, or caves). It also needs to be updated now and then as players tend to modify the area slightly now and then (pillaring up etc.).

Another complication is that mobs can jump up diffrent heights (smalls far less than scouts), and also fear diffrent heights. Still, some sort of...edge detection might help?

But what I meant was something diffrent: Mobs that attack other mobs (which ghosts do) look for targets now and then anyway. In that sweep they might as well check how many of their kind are in the area and then decide to disappear. That wouldn't cost more than checking the entity for type (another ghost?) and counting them. Problem is that this part isn't directly exposed in the API.

> but they all contribute to the expense of get_objects_in_area and get_objects_inside_radius That's right. Most of them (text on signs, deco in itemframes, smartshop offers, ..) are only of relevance to the players. Even pressure plates and sucking tubes wouldn't be intrested in those. I wonder if it might make sense to add a parameter to minetest.get_objects_* functions to only return entities that can move/be moved? > i'm imagining an API that caches paths between all points in a region - this would be an engine change, an rather complicated to get right, but do-able. someone should press me to outline the feature and report it upstream. Hmm. I'm not sure if we need that in general. In general, in normal situations, mobs seem to be able to handle what they do. Voice fights are diffrent. There we need all the optimization we can get. What you say sounds a bit like a heightmap to me. Sadly those are only available at mapgen time, and it's not exactly 2d either (imagine a house with differnt floors, or caves). It also needs to be updated now and then as players tend to modify the area slightly now and then (pillaring up etc.). Another complication is that mobs can jump up diffrent heights (smalls far less than scouts), and also fear diffrent heights. Still, some sort of...edge detection might help? But what I meant was something diffrent: Mobs that attack other mobs (which ghosts do) look for targets now and then anyway. In that sweep they might as well check how many of their kind are in the area and then decide to disappear. That wouldn't cost more than checking the entity for type (another ghost?) and counting them. Problem is that this part isn't directly exposed in the API.
AliasAlreadyTaken was assigned by Boot 2024-01-15 21:30:03 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: your-land/bugtracker#3981
No description provided.