Entity/mobs hit detection is really buggy

Post Reply
cronvel
Member
Posts: 19
Joined: Fri Jan 11, 2019 16:50
GitHub: cronvel

Entity/mobs hit detection is really buggy

by cronvel » Post

Hi,

I upgraded from 0.4.x to 5.1.0 few days ago and decided to add mobs to the game (Minetest game). I play with my 6 year old son (LAN game only), and since he is more confortable with the mouse now, I decided to spice things up and add mobs, mobs_animals, mobs_humans, mobs_wolf and mobs_dwarves.

But it appears that mobs are just almost unkillable (except peaceful one). Not because they are fast or have plenty of life, but because the game doesn't detect hit correctly. I'm just using the regular sword weapons, not some weapon mods. Even when the angry mob is stuck, my sword won't touch it. I can mine nearly blocks, but I can't touch it (despite the entity being "highlighted" -- visible bounding box). I can tell that at least 30 clean (no contest) hits are ignored by the game for each registered hit. This looks like an engine issue to me.

On the contrary, the mob can happily hit me at will, and from quite a distance, probably twice the mining distance (tested on a stuck mob), but I guess this one is not an engine issue but a mod bug/feature.

I play on local network, my desktop computer being both server and client, my son plays on a laptop, so there shouldn't be any lag issues.

Also, when I was younger I was a rather good Quake 3/FPS player, so that's not a problem of aiming skills ;) the game just don't want to register the hit.

Since I have done the upgrade and the mobs* mods installation at the same time, I can't tell if it's a v5.1 regression or if those problems already existed in v0.4.x.

My setup:
Fedora 31, Minetest 5.1 (Flatpak), Minetest Game + dfcaverns + subterrane + magma_conduits + dynamic_liquid + cottages + mobs + mobs_animal + mobs_wolf + mobs_humans + mobs_dwarves + wield3d + skinsdb.

User avatar
Hamlet
Member
Posts: 764
Joined: Sat Jul 29, 2017 21:09
IRC: H4mlet
In-game: Hamlet
Location: Lombardy, Italy

Re: Entity/mobs hit detection is really buggy

by Hamlet » Post

Hi cronvel,
given that you are using my mobs - Wolf, Humans, Dwarves - I'll join the discussion, maybe I'll be able to add something useful to sort out the issue.

First and foremost: do not use Humans and/or Dwarves without installing 3D armor also, else you are cannon fodder. Read further to discover why.
And, my mobs do have bugs: here's a topic where I talk about them: link.

Now, back to the topic. Let's leave the hit detection aside for a moment: I'll add a bit of informations.


Mobs' range
The Mobs Redo API has a default melee value of 3 nodes, while Minetest Game's tools can hit a node placed 4 nodes away. Let's assume that 2 nodes are 6feet/2meters.

The Wolf mob has a melee reach of 1 node because I wanted it to stay near to its target, to simulate a dog's bite; thus let's ignore it for the moment.

Humans and Dwarves have a melee reach of 4 nodes, because I wanted them to be even with the player; but they also have ranged attacks: some humans throw stones, and some dwarves use crossbow bolts - you should be able to see the projectiles.

When the mob hits you from distance, can you see them shooting? Consider that bolts are quite big and slow, while stones are smaller and faster.


Mobs' collision detection
Humans use the default player's mesh and collisionbox, so they should be safe from collision bugs, Wolves and Dwarves use their own meshes and collision boxes.
I would try with a 'caged wolf', that is a wolf around which you have built a wall of dirt 2 nodes tall: this way you should be able to test your weapon while it will not be able to bite you.
Don't try this with Humans or Dwarves before reading the next paragraph.


Mobs' armor
Wolves have the same 'armor' value as players: 100.
This means that 1 hit will deal 100% damage; if the armor's value is, say 50, then the damage is halved - 50%.

E.g. Diamond sword's damage: 8 (4 hearts).
If Wolves had an armor value of 50, then the sword - or any other weapon - would deal only 4 hit points of damage. If it was 200, it would deal 16 damage.

Humans and Dwarves' armors' levels are randomly chosen at spawn time.
And since they gain experience from won battles, it increases.

Humans - init.lua at line 584: self.armor = math.random(10, 100)
Strongest armor's value: 10, lowest: 100; that is, 'diamond armor' or 'naked'.

Dwarves:
Dwarf soldiers' armor: 85 (init.lua @ 300)
Dwarf paladines' armor: 70 (init.lua @ 503)
Miners and marksmen have 100.

Those are the starter values, if they win a battle - that is, they can switch their state from 'attacking' to 'strolling around' - said values will gain 1 point.
The same applies for their melee damage.

These features are stated in the Humans and in the Dwarves' mods' descriptions.
I will add a notice strongly suggesting using StuJones' 3D armor: else you're going naked against an armored Dwarf - or an armored evil Human.


To sum up, when you test your damage dealt, use wolves, or other kinds of animals, not Humans or Dwarves: anything except mobs having randomly chosen armor values.

If, say, chickens ignore your damage, then there's an issue.

Humans and Dwarves might very likely 'ignore' your hits due to their variable armors' rating, whereas Wolves have a fixed armor rating and must not ignore your hits. Try turning off damage - you will not suffer any - then challenge wolves, cows, chickens.

Humans and Dwarves have ranged attacks, crossbow bolts are easy to see, thrown rocks are harder to spot because they are smaller and faster.

Last but not least: Humans and Dwarves do have bugs, their update is pending because I want to rewrite them from scratch - the current versions are overly complex and thus bug prone.

I hope that these informations can be helpful. :)
My repositories: Codeberg.org | My ContentDB's page | I'm on PureOS with XFCE

cronvel
Member
Posts: 19
Joined: Fri Jan 11, 2019 16:50
GitHub: cronvel

Re: Entity/mobs hit detection is really buggy

by cronvel » Post

Sorry, I didn't get any mail notification for your reply.
Ok I understand the armor thing, that's true that I didn't pay attention to that.

I still have few questions.

1/ Even if the bot have armors, they don't "evade" blow, does them? I didn't hear any hit sound most of time.
2/ That's true that some of them can kill me with something like 3 blows, since I haven't 3D armor installed and I was attacking with a steel sword (it was a new game), but I'm pretty positive that even for bots spawning with hard armor, I should have killed some of them anyway.
3/ What makes your human turn evil? We didn't attack them. They have a chance to be evil? They turn evil at night?

cronvel
Member
Posts: 19
Joined: Fri Jan 11, 2019 16:50
GitHub: cronvel

Re: Entity/mobs hit detection is really buggy

by cronvel » Post

Ok, after few tests in creative mod, it appears that keeping the mouse button down is one source of the problem. Sometime the player character is just bashing the air with no effect, but releasing the mouse button and pressing it again seems to solve 80% of the missing hits.

Apparently, bots with high armour don't takes damage if the sword is not good enough (wood, stone). It would be nice if a sound could somewhat makes it clear that the weapon is ineffective.

And lastly, dynamic_water mod seems to produce some extra lags (both other LAN player and bots), and thus create unhit issues, when some players are closed to a lot of water, but I guess I should upgrade my 5 year old computer...

User avatar
Hamlet
Member
Posts: 764
Joined: Sat Jul 29, 2017 21:09
IRC: H4mlet
In-game: Hamlet
Location: Lombardy, Italy

Re: Entity/mobs hit detection is really buggy

by Hamlet » Post

1 - No, they don't 'evade' blows: each blow hits, but the damage gets reduced by their armor.
If, for example, a mob has an armor level of 50 then the steel sword's damage (6hp) gets halved, thus each blow deals 3hp.
Human's HPs are randomly chosen between the range of a min of 15hp and a max of 20hp (10 player hearts = 20 hit points).
Take also in consideration this: weapons normally have a 'cooldown' time of 1 second, i.e. if your blows are faster than that then their damage is reduced.
Therefore: blow - 1 second pause - blow - 1 second pause = full damage, else lower damage.


2 - Yes, some of them can kill unarmored players with 3 blows or even less. If their damage is 6 (steel sword) then 3 blows = 18 hp in 3 seconds. If they have a damage of 8 - (Diamond sword) - they can kill even faster.
Humans and Dwarves have a damage limit of 8hp and an armor limit of 10; these values can't go beyond those limits - i.e. diamond sword damage and diamond armor.
I have recently witnessed that blows do not land (the mob and the player do not take damage) if the mob and/or player is standing on a snow slab: that is not the full snow cube, the 'half' one; may be that this is happening with other nodes.

3 - Humans' characteristics are completely random, they are chosen at spawn time.
Mobs using Mobs Redo can be type 'animal', 'npc', 'monster'.
Animal: peaceful.
NPC: may be peaceful or not.
Monster: hostile. In addition, 'monster' can be always hostile or only when it is night.
Humans are randomly assigned to one of these groups, therefore you might meet:
- a peaceful human
- a human that is a monster and attacks on sight
- a human that is a monster but only attacks when it is night
- a human that is an NPC and does not attack
- a human that is an NPC but attacks
And so on in every possible random combination, melee, ranged or both.

I have tried to make their spawn rate quite low, knowing that they could be an 'overpowered' nightmare for someone starting a fresh game.

Advice taken:
I will add a couple of sounds to be played when they're hit, so one can have a confirmation that his/her hits are landing, and know if they are effective or not.
I will also add a 'debug' mode, that will show their stats on their heads: so one can figure what's going to happen.

Dwarves have been updated, Humans are under update, hopefully in a couple of days I'll release the new version. :)
My repositories: Codeberg.org | My ContentDB's page | I'm on PureOS with XFCE

cronvel
Member
Posts: 19
Joined: Fri Jan 11, 2019 16:50
GitHub: cronvel

Re: Entity/mobs hit detection is really buggy

by cronvel » Post

Thanks for all those informations (and for the time you have gracefully spent) ;)

User avatar
Hamlet
Member
Posts: 764
Joined: Sat Jul 29, 2017 21:09
IRC: H4mlet
In-game: Hamlet
Location: Lombardy, Italy

Re: Entity/mobs hit detection is really buggy

by Hamlet » Post

cronvel wrote:Thanks for all those informations (and for the time you have gracefully spent) ;)
You're welcome :)
Check the Mobs Humans RC1, it should provide a far better gaming experience: post.
My repositories: Codeberg.org | My ContentDB's page | I'm on PureOS with XFCE

cronvel
Member
Posts: 19
Joined: Fri Jan 11, 2019 16:50
GitHub: cronvel

Re: Entity/mobs hit detection is really buggy

by cronvel » Post

Ok I will give it a try. ;)
Also, would you be interested in some markov-like name generator? I could eventually port some Javascript stuff of mine to Lua. Since I'm not totally familiar with Lua (especially with Lua string manipulation, and UTF8), I would probably only port the generator part, not the graph-making part. So you would have to create the graph file using a Node.js CLI script.

User avatar
Hamlet
Member
Posts: 764
Joined: Sat Jul 29, 2017 21:09
IRC: H4mlet
In-game: Hamlet
Location: Lombardy, Italy

Re: Entity/mobs hit detection is really buggy

by Hamlet » Post

cronvel wrote: Also, would you be interested in some markov-like name generator? I could eventually port some Javascript stuff of mine to Lua. Since I'm not totally familiar with Lua (especially with Lua string manipulation, and UTF8), I would probably only port the generator part, not the graph-making part. So you would have to create the graph file using a Node.js CLI script.
Uh that's something that I've never heard of before, but I'm surely interested!
Just open a thread in the WIP mods when you've ported the most of it from Javascript, that way I'll be able to mess with it.
I had thought of using a name generator that produced strings like 'Eagle Eye', 'Stormy Sea', 'Strong Arm' and so on ('Native American-Style'), now I'm curious about this Markov thing.
My repositories: Codeberg.org | My ContentDB's page | I'm on PureOS with XFCE

cronvel
Member
Posts: 19
Joined: Fri Jan 11, 2019 16:50
GitHub: cronvel

Re: Entity/mobs hit detection is really buggy

by cronvel » Post

Basically, you provide a list of names, and the generator produce a graph with statistics. That graph is used to generate names that are or are not in the initial list. Those that are originals still looks alike the other.

But if you want something more like native american, composed of two random word, it is probably not the right tool.

cronvel
Member
Posts: 19
Joined: Fri Jan 11, 2019 16:50
GitHub: cronvel

Re: Entity/mobs hit detection is really buggy

by cronvel » Post

@Hamlet I've ported the name generator, see this thread. Let me know if you need help to implement it in your mod (I can give you a hand) ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests