Mobkit - Entity API [mobkit][wip]

Re: Mobkit - Entity API [mobkit][wip]

Postby Termos » Tue Mar 26, 2019 10:26 pm

Working on a new simple mod example

Image

Planned: some wildlife that go about minding their own business and simple spawning logic that doesn't involve the dreaded ABM.
Termos
Member
 
Posts: 68
Joined: Sun Dec 16, 2018 12:50 pm

Re: Mobkit - Entity API [mobkit][wip]

Postby texmex » Wed Mar 27, 2019 8:36 am

I wonder, why do mobs need to jump to climb nodes? Why not just increase stepheight to 1.1 and let them smoothly climb node edges?
texmex
Member
 
Posts: 1293
Joined: Mon Jul 11, 2016 9:08 pm
GitHub: tacotexmex
In-game: texmex

Re: Mobkit - Entity API [mobkit][wip]

Postby Termos » Wed Mar 27, 2019 9:44 pm

texmex wrote:I wonder, why do mobs need to jump to climb nodes? Why not just increase stepheight to 1.1 and let them smoothly climb node edges?

Good question, short answer is I don't think setting stepheight that high makes much sense.

Firstly, it's extremely glitchy, I've tested it with similar values, the result is anything but smooth.

Secondly, even if it was functioning properly, to say that teleporting instantly one meter upwards is what can be called smooth is debatable at the least.

Thirdly, as I've said one of my goals is to keep it consistent. Players do have to jump full nodes by default, and I don't see a good reason for mobs to behave differently.
Termos
Member
 
Posts: 68
Joined: Sun Dec 16, 2018 12:50 pm

Re: Mobkit - Entity API [mobkit][wip]

Postby Lone_Wolf » Wed Mar 27, 2019 9:55 pm

Termos wrote:
texmex wrote:I wonder, why do mobs need to jump to climb nodes? Why not just increase stepheight to 1.1 and let them smoothly climb node edges?

Good question, short answer is I don't think setting stepheight that high makes much sense.

Firstly, it's extremely glitchy, I've tested it with similar values, the result is anything but smooth.

Secondly, even if it was functioning properly, to say that teleporting instantly one meter upwards is what can be called smooth is debatable at the least.

Thirdly, as I've said one of my goals is to keep it consistent. Players do have to jump full nodes by default, and I don't see a good reason for mobs to behave differently.

IMO they look more intelligent when they jump instead of use stepheight
Lone_Wolf
Member
 
Posts: 2151
Joined: Sun Apr 09, 2017 5:50 am
GitHub: LoneWolfHT
In-game: Lone_Wolf

Re: Mobkit - Entity API [mobkit][wip]

Postby runs » Sun Mar 31, 2019 9:33 pm

When you complete it, my Petz mod will support your engine/API as an alternative to mobs_redo.
runs
Member
 
Posts: 386
Joined: Sat Oct 27, 2018 8:32 am
GitHub: runsy

Re: Mobkit - Entity API [mobkit][wip]

Postby ShadMOrdre » Mon Apr 01, 2019 4:11 pm

The stepheight issue can also be mitigated by using the Natural_Slopes mod, or one similar. This mod replaces all edge nodes with a stair node or, if desired, a slope node. Not only does it smooth the terrain, nice effect, but it also means I can walk without having to jump every other node, as long as the node I am stepping to has been "smoothed" to a slope or stair. A side effect of the mod is that for the nodes that are not converted, it roughens the terrain.

However, in all this, the mobs_redo mobs still have issues walking around. Is this mod compatible, or usable, with mobs_redo? Burlis' pathfinder mod works with mobs_redo by changing a line or two in mobs_redo api. Is this in some way also a drop in replacement to mobs_redo default behaviour, since it seems to be the dominant mobs mod?
ShadMOrdre
Member
 
Posts: 297
Joined: Mon Dec 29, 2014 8:07 am
GitHub: ShadMOrdre
In-game: shadmordre

Re: Mobkit - Entity API [mobkit][wip]

Postby Termos » Mon Apr 01, 2019 9:19 pm

ShadMOrdre wrote:The stepheight issue can also be mitigated by using the Natural_Slopes mod, or one similar. This mod replaces all edge nodes with a stair node or, if desired, a slope node.

This is one way of dealing with such issues. However mobkit is dependency free by design so it won't rely or even be aware of any specific mods.
Also this is a for-fun project, so I'd rather embrace the blockiness and appreciate the challenges it offers.

ShadMOrdre wrote: Is this mod compatible, or usable, with mobs_redo?

Probably.
Mobkit has no dependencies and the example mod I'm working on cares only about entities registered by itself, so if Redo also keeps to its own stuff they may work alongside each other out of the box.
But I'm not actively trying to ensure compatibility with any existing mods.
Termos
Member
 
Posts: 68
Joined: Sun Dec 16, 2018 12:50 pm

Re: Mobkit - Entity API [mobkit][wip]

Postby Termos » Wed Apr 03, 2019 9:47 pm

Preview Update
Wildlife edition

Image

It is still a preview, as I don't feel it deserves any Greek letter in its current state.
I don't recommend using the API for development yet, cause it will get better.

There's an example mod included, 'wildlife'. It's quite simple, but functional.
In his journeys, player will sometimes encounter some wild animals, and may observe the Darwinian principle in action.

What's inside:

herbivore mob:
    will flee from predators and players

predator mob:
    will chase and try to kill nearby herbivores
    when idle, will try to repel player if they come too close
    will attack player if they ignore the warning for too long or come closer still

spawn function:
    stealthy: it's difficult to see it in action, all spawns happen in active block range distance from the nearest player
    lightweight: ABM free and spawns for different players are done in different engine steps, so it doesn't put any noticeable load on the server.
    self adjusting: the more entities in range, the less likely it is for new spawns to happen.

Download link in the post #1
Termos
Member
 
Posts: 68
Joined: Sun Dec 16, 2018 12:50 pm

Re: Mobkit - Entity API [mobkit][wip]

Postby R-One » Thu Apr 04, 2019 9:06 am

Hi, again I find your job super cool.

I tested and look at the code in a hurry, the examples like that really allow to understand the principles, thank you very much.

If I understand correctly, the spawn will be managed by the mods and not the API.
Besides, how do you make a spawn on a specific type of block?

And if not, when is it from the animation of mobs and loots to their death?

Once again thank you very much for the answers in advance.
R-One
Member
 
Posts: 105
Joined: Wed Dec 20, 2017 11:06 pm

Re: Mobkit - Entity API [mobkit][wip]

Postby Termos » Fri Apr 05, 2019 11:33 am

R-One wrote:If I understand correctly, the spawn will be managed by the mods and not the API.
Besides, how do you make a spawn on a specific type of block?

There are countless ways to do spawns, many of them right, so I don't think it's API's job to implement any specific one of them

As to the question, after mobkit.get_terrain_height(pos) has been called, you know if you can spawn there, terrain height at that point and if it is dry land.
You can calculate the position of interest, which is pos.x,height,pos.z and this is all you need in most scenarios. Then you can use the position to minetest.get_biome_data or to mobkit.nodeatpos().groups for example, and determine if you can spawn there and what to spawn according to specific mod requirements.

R-One wrote:And if not, when is it from the animation of mobs and loots to their death?.

I'm considering if MC style drop isn't too specific. Anyway, you can edit hq_die, call minetest.add_item and spawn anything you need.
In my mod I would probably spawn a leveled carcass node instead, which could be butchered for resources or eaten by preds, and maybe give off the buzzing flies sound.

As for animations, the truth is I've yet to teach myself rigging, and I'm not sure when I will (priorities, priorities)
If anyone would offer to give me a hand rigging, I'd probably accept.
Termos
Member
 
Posts: 68
Joined: Sun Dec 16, 2018 12:50 pm

Re: Mobkit - Entity API [mobkit][wip]

Postby Termos » Mon Apr 08, 2019 7:57 pm

Perpetuum Mobile
Image

One of obstacle courses I set up to test the new refined movement code (post-update, if you try this with the preview code they'll probably fall).
The clip is realtime, speed is 6 m/s (players is 4) which means mobs can keep up with the player most of the time, and outrun them easily on flattish terrain (given they don't use cheats ofc).

They can do faster, but the greater the speed, the greater the probability of failure due to occasional excessive engine step duration events, which inevitably happen sometimes.
Termos
Member
 
Posts: 68
Joined: Sun Dec 16, 2018 12:50 pm

Re: Mobkit - Entity API [mobkit][wip]

Postby R-One » Mon Apr 08, 2019 8:09 pm

hello, your work is really impressive ... look forward to see more!

I find your idea of carcass during the deaths really great.

There are a lot of people who hack a bit like me who will need examples and docs to take in hand like me the thing.

I still wonder how to handle the spwan in the right way in an external mod :-/

Thanks again for this new API
R-One
Member
 
Posts: 105
Joined: Wed Dec 20, 2017 11:06 pm

Re: Mobkit - Entity API [mobkit][wip]

Postby Termos » Fri Apr 12, 2019 7:32 pm

R-One wrote:I still wonder how to handle the spwan in the right way in an external mod :-/

I'd like to help you with this, but really, what's wrong or right depends mainly on what your mod is supposed to do.

As far as the usual MC approach goes, you mentioned spawning on specific nodes. I think in MT version 5.x this makes sense only if ABM is used because they take node names and groups as parameters, but then, using ABMs for spawns is not right imo.


I suggest starting with the example - spawnstep() function, the most important bit is this:

local height, liquidflag = mobkit.get_terrain_height(pos2,32)

If height ~= nil then you know you can potentially spawn there, update the position

pos2.y = height

This position can be used e.g. to get biome data, the simplest scenario could be just heat

minetest.get_biome_data(pos2).heat

Your mobs should have a parameter corresponding to this, something like heat={min=?,max=?).
Then you would iterate over minetest.registered_entities table and put all the egligible mobs' names into a temporary table.
Then the simplest scenario would be if all mobs had equal chances to spawn, so you could do

if #tmptab > 0 then minetest.add_entity(pos2,tmptab[math.random(#tmptab)])

That's about it. If you wanted MC style monsters, then you could do the following first:
minetest.get_node_light(pos2)
and if it's dark enough spawn a monster instead.

This is overall pretty trivial stuff, the most tricky part is determining terrain height at (x,z) but there's a function for that already.
Much more fun problem to solve would be for example, if you built a wall around a fairly large area (larger than active block range) and wanted to prevent mobs from spawning inside. This would require approaching the problem from the opposite end.
Termos
Member
 
Posts: 68
Joined: Sun Dec 16, 2018 12:50 pm

Re: Mobkit - Entity API [mobkit][wip]

Postby R-One » Sat Apr 13, 2019 8:41 am

First of all thank you for taking the time to answer, I remind you, I am just a novice who does not have much time to do what he wants.

I have several uses:

1- the mod of mobs with a running operation: the sorting of the spawn will be done by biome, altitude, brightness, scarcity of spwan.

2- Another NPC style mod. The npc spwan works from one or more blocks already generated in the world.

As usual, thank you very much for your work
R-One
Member
 
Posts: 105
Joined: Wed Dec 20, 2017 11:06 pm

Re: Mobkit - Entity API [mobkit][wip]

Postby Termos » Wed Apr 24, 2019 6:16 pm

Coming up next: buoyancy and water based behaviors

Image
One of the advantages of physics based approach, this effect didn't take any additional coding. That they still die if they hit water surface with high enough velocity is an emergent outcome of buoyancy, liquid resistance and acceleration based fall damage.
Termos
Member
 
Posts: 68
Joined: Sun Dec 16, 2018 12:50 pm



Return to WIP Mods



Who is online

Users browsing this forum: Yandex Bot [Bot] and 0 guests