[Mod] Mobs Redo [1.55] [mobs]

oddguy117
Member
Posts: 23
Joined: Thu Nov 07, 2019 19:08

Re: [Mod] Mobs Redo [1.50] [mobs]

by oddguy117 » Post

Thanks for your help.
By the way, I've got some performance problems, @TenPlus1 can you please help me (I just need help by SB who has some experience with it.)?
Forum post is here: viewtopic.php?f=47&t=23781

Also, can you tell me where in the API documentation it's written how to make mobs spawn under specific conditions in a place, that got generated by a mod.
See here: viewtopic.php?f=47&t=23709

Thanks in advance

User avatar
TenPlus1
Member
Posts: 2929
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Post

@oddguy117 - mob spawning is usually abm intensive but by using the mobs:spawn function and spawning with a neighbor you can lower this:

https://notabug.org/TenPlus1/mobs_redo/ ... i.txt#L356

e.g. I tend to spawn cows on dirt_with_grass that has a neighbor of group:grass, so less nodes to check and spawn on, you can also increase timer and chance or use on_spawn function within the mob definition or mobs:spawn itself to be very specific.

User avatar
Nathan.S
Member
Posts: 1052
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] Mobs Redo [1.50] [mobs]

by Nathan.S » Post

Maybe I'm remembering something that never existed, but didn't weapons used to take damage when attacking mobs? Looking through the API I see there is a check for the toolranks mod and it looks like it weapons are meant to take damage. I tested with both Minetest 5.1.0 and the latest dev, both with and without the toolranks mod and I never got any damage on the tools.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
FreeGamers
Member
Posts: 651
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [Mod] Mobs Redo [1.50] [mobs]

by FreeGamers » Post

It might have a check on if its in creative mode Nathan?
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

User avatar
Nathan.S
Member
Posts: 1052
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] Mobs Redo [1.50] [mobs]

by Nathan.S » Post

I believe there is such a check, and I checked to make sure that I have creative mode turned off, and that I also didn't have the creative priv. I actually tried both ways, but got no difference. Interestingly if the tool has no wear it sometimes will show the wear bar for a fraction of a second before going back to being in perfect condition. If the tool has wear, say from digging grass or leaves it stays at the same damage level.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
FreeGamers
Member
Posts: 651
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [Mod] Mobs Redo [1.50] [mobs]

by FreeGamers » Post

I was able to recreate the issue Nathan is reporting. I never really noticed until I saw his report.
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

User avatar
TenPlus1
Member
Posts: 2929
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Post

On Xanadu weapons still take damage since it's using Minetest 5.0.1, for some reason 5.1+ stops the weapons from being damaged even though it's using the same and correct code ?!?

https://notabug.org/TenPlus1/mobs_redo/issues/27

User avatar
FreeGamers
Member
Posts: 651
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [Mod] Mobs Redo [1.50] [mobs]

by FreeGamers » Post

Hey TenPlus1,

What are the major difference between the spawning api functions?

mobs:spawn_specific seems to be the most versatile but I understand it costs more processing? I've been using this for my mobs mod and its has a lot of mobs, I've been trying to optimize things more. I've been using spawn_specific for almost everything.

mobs_spawn is less cpu intensive but more limited in its specificity?

How much of a difference does this make this in processing usage?
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

User avatar
TenPlus1
Member
Posts: 2929
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Post

The mobs:spawn() is the best one to use as it is easier to read and has all features and functionality of spawn_specific and many defaults set already to save you adding lines.

e.g.

Code: Select all

mobs:spawn({
   name = mob name, (required, e.g. "mymod:mymob")
   nodes = list of nodes to spawn on (defaults to {"group:soil", "group:stone"})
   neighbors = list of neighbor nodes to spawn beside (defaults to {"group:air"}
   interval = default abm interval (defaults to 30)
   chance =  default abm chance (defaults to 5000)
   min_light = minimum light level (defaults to 0)
   max_light = maximum light level (defaults to 15)
   active_object_count = amount of same mobs in active block (defaults to 1)
   min_height = minimum height level (defaults to -31000)
   max_height = maximum light level (defaults to 31000)
   day_toggle = true to spawn in day, false for night, nil for both (default)
   on_spawn = custom function to run after mob spawned (self, pos)
end)

User avatar
FreeGamers
Member
Posts: 651
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [Mod] Mobs Redo [1.50] [mobs]

by FreeGamers » Post

OK. No performance difference between them?

I have to further optimize my spawning functions again so I'll be going through them all eventually and I'll likely convert them to mobs:spawn
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

User avatar
TenPlus1
Member
Posts: 2929
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Update:

by TenPlus1 » Post

- glow setting added so that mobs can glow in the dark.
- api.txt has been updated with new spawning information and glow setting.
- bug fixed when using on_replace function, oldname and newname return actual string names, even when groups used.
Last edited by TenPlus1 on Sun Jan 12, 2020 09:46, edited 1 time in total.

User avatar
Nathan.S
Member
Posts: 1052
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] Mobs Redo [1.50] [mobs]

by Nathan.S » Post

I'm probably just missing something obvious, but when using on_replace what is oldnode? or rather how to I get the nodename from it. I want to check if a mob is eating a specific node, and if they are have a certain action take place. As far as I can tell oldnode is a table? of what I'm not sure, nor can I figure out how to compare that table to a nodename. I tried doing oldnode.name but that didn't work. I can't seem to find any examples of the code in any of the mods I have locally on my machine.

Thanks.

edit:
Looking at the code it looks like there may be an error in the api. If I change replace_what from a table to a single string I can call oldnode.name and get the node name, but as soon as I do a table it breaks.

edit2:
Okay so I was just going about it the wrong way. doing this works.

Code: Select all

replace_what = {
      {'group:flora', 'air', 0},
      {'group:grain', 'air', 0},
      {'group:veggie', 'air', 0}
   },
   on_replace = function(self, pos, oldnode, newnode)
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
TenPlus1
Member
Posts: 2929
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Post

Hi Nathan, I've updated the mob api so that on_replace will now give proper node names for oldnode and newnode, even when groups are use :)
Last edited by TenPlus1 on Mon Jan 13, 2020 08:06, edited 1 time in total.

User avatar
Nathan.S
Member
Posts: 1052
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] Mobs Redo [1.50] [mobs]

by Nathan.S » Post

Ah nice. I'll be using that feature in several mobs, that I'm working on.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
FreeGamers
Member
Posts: 651
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: [Mod] Mobs Redo [1.50] [mobs]

by FreeGamers » Post

I noticed particle spawners, like the one I have on this flying skeleton head, no longer work in version 5.2.0-dev.

Code: Select all

   do_custom = function(self)
		local apos = self.object:getpos()
                part = minetest.add_particlespawner({
                        8, --amount
                        0.3, --time
                        {x=apos.x-0.3, y=apos.y+0.6, z=apos.z-0.3}, --minpos
                        {x=apos.x+0.3, y=apos.y+0.6, z=apos.z+0.3}, --maxpos
                        {x=-0, y=-0, z=-0}, --minvel
                        {x=0, y=0, z=0}, --maxvel
                        {x=0,y=1.5,z=0}, --minacc
                        {x=0.5,y=1.5,z=0.5}, --maxacc
                        1, --minexptime
                        1, --maxexptime
                       2, --minsize
                        3, --maxsize
                        false, --collisiondetection
                        "mobs_creatures_arrow_fireball_trail.png" --texture
                })
   end,
FreeGamers.org has moved to MeseCraft.net | FreeGamers on this forum is now MeseCraft

User avatar
TenPlus1
Member
Posts: 2929
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Post

check the code for sandmonster. lua in the mobs_monster mod, it uses particles and works ok.

User avatar
Wuzzy
Member
Posts: 4127
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Mobs Redo [1.50] [mobs]

by Wuzzy » Post

The code quality leaves much to be desired …

- Hard dependency on default. Lots of the codebase is tightly coupled with MTG stuff, even the API
- Mob aliases are an ugly hack. They shouldn't exist at all
- Mob types are a confusing mess that affect many different things at once and also restrict what you can do with the mob. Most of this is undocumented. Given that most parameters affect one very specific thing about the mob, this design is hardly justifiable
- For some reason, most mobs have “fleshy=200” as armor group, so they take double damage. WTF?
- "shoot" mobs run to you as close as possible which is pretty stupid as this makes them vulnerable to melee attacks
- Some nodes are checked for their drawtype while they should be checked for the physical property. For example, checking for solid nodes is done by checking `drawtype=="normal"` instead of `walkable=true`. There are other examples.
- TONS of implicit mob behavior that is entirely undocumented. There's always a surprise on the corner when you use the API. Documentation of all parameters is not enough if you don't know how the basic behavior of mobs work
- Mobs that "fly" in a liquid (fly_in = {"default:water_source"}) will also fly in plants
- The up/down flight of bees is done by cheating: It's done in the mesh animation, the real entity actually never changes height
- Mobs spawn tamed even if I use a normal spawn egg
- Behavior of pathfinding=2 seems quite broken. It's also a quite questionable feature to include in an API
- minetest.line_of_sight is called with useless 3rd parameter
- Access to global “yaw” in line 591 (92ab4eeb2e362886bb6dcfbe547107aff40e4e28)
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

Astrobe
Member
Posts: 328
Joined: Sun Apr 01, 2018 10:46

Re: [Mod] Mobs Redo [1.50] [mobs]

by Astrobe » Post

Wuzzy wrote:The code quality leaves much to be desired …
Well, yes but that is currently the best mobs mod we have (in my biased opinion).

It often happens with old code bases: they suffered from trial and errors and from the fact that they have to maintain backwards compatibility. And because they were "good enough" to gather a huge ecosystem, it is not easy to change or replace them. MT itself is probably in this situation too.
- Hard dependency on default. Lots of the codebase is tightly coupled with MTG stuff, even the API
As do many non-trivial mods. At some point, if you want to provide anything useful out-of-the-box (and not some sort of big library) you have to depend on a game.

Personally I believe we should actually have just libs, because piling mods over mods over MTG (or any other game) actually degrades the quality of the game (unless you exactly know what you are doing, and when you do, you rarely use mods as-is). A game is a delicate balance, altering it on a whim is generally a not-so-good idea.
- Mob aliases are an ugly hack. They shouldn't exist at all
Compatibility issue. Probably some are obsolete, but the burden of dealing with the unintended consequences of their removal is probably not worth it for TenPlusOne, I totally understand that. And it has next to zero value for the users.
- Mob types are a confusing mess that affect many different things at once and also restrict what you can do with the mob. Most of this is undocumented. Given that most parameters affect one very specific thing about the mob, this design is hardly justifiable
The justification is "old design". Probably if it were to be redone (so MobsRedoRedone?) the "type" property would go away in favor of a behavior driven by orthogonal properties. It may even be doable in a compatible way: if the "type" field is present, it sets other properties, otherwise the mob engine uses the supplied properties. But that's a lot of work (and potential hard-to-debug and annoying breakage).
- For some reason, most mobs have “fleshy=200” as armor group, so they take double damage. WTF?
Armor is useless if it doesn't shield against specific types of damage. If armor applies to all types of damage, or if there is only one type of damage in a game, then damage reduction by N% by armor is equivalent to have N% more health (that's actually a good excuse to make kids do some arithmetic ;-)

If armor shields against a specific type of damage - say "fire" or "magic" - then it becomes a lot more meaningful. This is extensively used in MOBA games such as LoL or DoTA, where you typically have to choose between armor that protects against physical damage and armor that protects against magical damage. Typically players' choice depends on who is "fed" in the enemy team.
- "shoot" mobs run to you as close as possible which is pretty stupid as this makes them vulnerable to melee attacks
That's probably "dogshoot" behavior. "shoot" type won't move between shots - which have its disadvantages too, so neither are totally stupid. If you use dogshoot, then consistency wants that you indeed configure a melee attack and/or high HP etc. Just in case, the configuration of third-party mobs is not always very consistent. In any case, you often have to adjust their HP/range/speed/DPS/etc. to get the level of difficulty you want in your game.
- Some nodes are checked for their drawtype while they should be checked for the physical property. For example, checking for solid nodes is done by checking `drawtype=="normal"` instead of `walkable=true`. There are other examples.
That may be due to walkable nodes that are not full nodes such as slabs and stairs. Those and the "default:snow" block (the snow that you can see on trees for instance) are a real PITA to deal with (and not only for mobs).
- The up/down flight of bees is done by cheating: It's done in the mesh animation, the real entity actually never changes height
This might be correct for those bees, but I have observed oscillation moves for (Doom's) wasps that don't use the mesh trick. I don't observe it in my game anymore, but that's probably because I hacked MobsRedo a bit too much.
- Mobs spawn tamed even if I use a normal spawn egg
Works as intended. It is always unpleasant to be attacked by the dragon that you just helped to hatch. If this is problematic there's an "after spawn" hook in which you can modify the mob's parameters after birth. Also there are two types of eggs, IIRC only one of them spawn tamed mobs (no time to check right now).
- minetest.line_of_sight is called with useless 3rd parameter
This third parameter was removed from the MT's docs probably with the 0.4.15 release. This code has been obsoleted by the newer minetest.raycast(), the old routines are there as a fallback in case the mod is used with a pre-5.0 (or 5.1?) engine.

User avatar
Lone_Wolf
Member
Posts: 2421
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: Lone_Wolf or LoneWolfHT
In-game: Lone_Wolf
Location: Not there, THERE!

Re: [Mod] Mobs Redo [1.50] [mobs]

by Lone_Wolf » Post

Astrobe wrote: As do many non-trivial mods. At some point, if you want to provide anything useful out-of-the-box (and not some sort of big library) you have to depend on a game.
I think that's a bad excuse for an API.
mobkit (Another API you can use to make mobs) doesn't depend upon default and I am currently using it without any trouble to add mobs to a game I'm making (A game with no default mod)

Astrobe
Member
Posts: 328
Joined: Sun Apr 01, 2018 10:46

Re: [Mod] Mobs Redo [1.50] [mobs]

by Astrobe » Post

I don't know... Maybe you don't have mobs that only swim in default:water_source or want to avoid default:lava_source... Yet?

User avatar
TenPlus1
Member
Posts: 2929
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Post

@wuzzy - pull requests are more than welcome :)

...as for mobs spawning tamed that is meant, hold down sneak/shift to spawn a wild mob.

User avatar
sorcerykid
Member
Posts: 1500
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

Re: [Mod] Mobs Redo [1.50] [mobs]

by sorcerykid » Post

I just wanted to chime in to say I really appreciate the work that TenPlus1 has put into his mod, and esp. the dedication to maintaining it for so many years. Even despite some of its deficiencies and peculiaritiesse, Mobs Redo still does what it's intended to do and remains a suitable basis for mob development.

And I have to agree with TenPlus1's sentiment. If you really disapprove of something about Mobs Redo, then I think we could all benefit from an offer to help fix it rather than just pointing out everything that is wrong :P

MoNTE48
Member
Posts: 321
Joined: Sat Apr 06, 2013 11:58
GitHub: MoNTE48
In-game: MoNTE48
Location: Internet

Re: [Mod] Mobs Redo [1.50] [mobs]

by MoNTE48 » Post

To begin with, it would be cool if the mod leaves the most bugged git repo [notabug], becomes collective [minetest-mods, minetest-gamers etc], gets refactoring and cleaning...

User avatar
TenPlus1
Member
Posts: 2929
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mobs Redo [1.50] [mobs]

by TenPlus1 » Post

I'm using notabug.org as it works well for my needs and it's not Microsoft...

User avatar
runs
Member
Posts: 2060
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: [Mod] Mobs Redo [1.50] [mobs]

by runs » Post

"mobs_redo" is based in the very old "mobs". So a lot of compatibility in the code.
The customization is difficult, so this should be used per se.
But Minetest engine do not support a standard mobs API. Entities suck. So this is a particular solution. There are other solutions: MILA, mobkit... Each game developer should use them as he like or can.
🤑 Patreon |Minetest Element Chat | 👧 Samantha | ⛏️ Juanchi Game | 🐱 Petz

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests