Mobkit - Entity API [mobkit][alpha]

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

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

by runs » Post

Termos wrote:
runs wrote:I think my problem is with 'self.object:set_properties':

Code: Select all

      self.object:set_properties("textures", "texture.png")
end
I'm surprised it doesn't crash, set_properties() is supposed to take a table as parameter, not strings.
maybe try something like:

local props = self.object:get_properties()
props.textures = {'texture.png'}
self.object:set_properties(props)

runs wrote: I mean that current run speed or follow is fast a lot.

Check it:
https://streamable.com/qlu0z
Dat look good! ;)

You mean their follow speed is too fast?
hq_follow uses maximum speed for mobs to try and keep up with the player. I you feel it's too fast, you might want to modify hq_follow, or just reduce entity walk_speed overall.
Ah, I understand now, walk_speed is max_speed :-D
Day 42 of the quarantine

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

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

by Lone_Wolf » Post

Termos wrote: I'm surprised it doesn't crash, set_properties() is supposed to take a table as parameter, not strings.
maybe try something like:

local props = self.object:get_properties()
props.textures = {'texture.png'}
self.object:set_properties(props)
IIRC you could just do this too: self.object:set_properties({textures = {"texture.png"}})

Termos
Member
Posts: 325
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Lone_Wolf wrote: IIRC you could just do this too: self.object:set_properties({textures = {"texture.png"}})
This is probably the case, in fact, 'zombies' uses it this way to set collisionbox alone.
One problem I noticed, it makes models blink white when set_properties is called, but only in 5.0.0

Termos
Member
Posts: 325
Joined: Sun Dec 16, 2018 12:50

Re: Mobkit - little Testserver

by Termos » Post

Gundul wrote: i set up a little server for testing in multi player enviroment:
gundul.ddnss.de Port 39155
Thanks Man, this is super cool!
I don't have an opportunity to set up my own server and test it online.

I was afraid it might be unplayable due to lag, but checked it out and it seems to work surprisingly well.

Unfortunately, i forgot to remove some last minute diag messages again, sorry for that.
I'm gonna fix it for the next time, if you want to get rid of them sooner
comment out the line 1028 in mobkit\init.lua, it says minetest.chat_send...

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

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

by runs » Post

That was the solution
self.object:set_properties({textures = {"texture.png"}})
Now it works!
https://streamable.com/5yppe
Day 42 of the quarantine

Gundul
Member
Posts: 1022
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia

Re: Mobkit - little Testserver

by Gundul » Post

Termos wrote: Thanks Man, this is super cool!
I don't have an opportunity to set up my own server and test it online.

I was afraid it might be unplayable due to lag, but checked it out and it seems to work surprisingly well.
You're welcome. I first tested your wildlife mod and that was really convincing. I have mobs_redo running on my bigger server "Jungle". It runs also on "lilly in the valley" but very restricted. But the behaviour of your mob
brains is much more natural. I still remember the wolve chasing the deers. That would be a very nice addition to Lilly's world :)
Termos wrote: Unfortunately, i forgot to remove some last minute diag messages again, sorry for that.
I'm gonna fix it for the next time, if you want to get rid of them sooner
comment out the line 1028 in mobkit\init.lua, it says minetest.chat_send...
Thanks, found it.
My servers: Jungle, Lilly in the valley, 3xile

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

Re: Mobkit - little Testserver

by Lone_Wolf » Post

Gundul wrote:I like that mobkit api very much already :) wildlife and zombies do show
very good what already is possible.

i set up a little server for testing in multi player enviroment:

gundul.ddnss.de Port 39155

kill as many zombies as you can and enter the leaderboard
type /score to see it.


No rules, just go crazy and kill them all, any chrashes will be reported here.
Minetest version is 5.1.0 dev
It was a lot of fun to play on. Although it could probably use some apple trees and the endless_apples mod :P

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

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

by runs » Post

I wonder why you put the 100 value assigned to 'death', instead of 0?

:-)
Day 42 of the quarantine

Termos
Member
Posts: 325
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

runs wrote:I wonder why you put the 100 value assigned to 'death', instead of 0?
When hp goes zero entities are instantly removed by the engine, and an ugly ass snowflake is displayed in their place.
There seems to be no way around this.

Treating a higher number as death is a quick and dirty workaround. Setting armor_groups to 'immortal' seems neater, but it requires custom handling all damage, also objects stop flashing when hit and that's kinda cool.

Gundul
Member
Posts: 1022
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia

Wildlife and zombies

by Gundul » Post

Your wildlife mod is not working with your current mobkit api ?
I was thinking like wildlife would be a nice addition to zombieworld and to
see what will happen if wolves, zombies and deers live together :)

But what happens is this :

Code: Select all

2019-06-08 11:29:55: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'wildlife' in callback luaentity_Step(): .minetest/mods/mobkit/init.lua:434: attempt to compare number with userdata
2019-06-08 11:29:55: ERROR[Main]: stack traceback:
2019-06-08 11:29:55: ERROR[Main]: 	.minetest/mods/mobkit/init.lua:434: in function 'queue_high'
2019-06-08 11:29:55: ERROR[Main]: 	.minetest/mods/mobkit/init.lua:862: in function 'hq_hunt'
2019-06-08 11:29:55: ERROR[Main]: 	.minetest/mods/wildlife/init.lua:28: in function 'brainfunc'
2019-06-08 11:29:55: ERROR[Main]: 	.minetest/mods/mobkit/init.lua:1147: in function </home/admin/.minetest/mods/mobkit/init.lua:1040>
2019-06-08 11:29:56: ACTION[Server]: Gundul leaves game. List of players: 
2019-06-08 11:29:56: ACTION[Main]: Server: Shutting down
My servers: Jungle, Lilly in the valley, 3xile

Gundul
Member
Posts: 1022
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia

Re: Mobkit - little Testserver

by Gundul » Post

Lone_Wolf wrote:
Gundul wrote: kill as many zombies as you can and enter the leaderboard
type /score to see it.


No rules, just go crazy and kill them all, any chrashes will be reported here.
Minetest version is 5.1.0 dev
It was a lot of fun to play on. Although it could probably use some apple trees and the endless_apples mod :P
There are apple trees now, and also a tiny treasure island :)

viewtopic.php?f=10&t=22667#p348945
My servers: Jungle, Lilly in the valley, 3xile

Termos
Member
Posts: 325
Joined: Sun Dec 16, 2018 12:50

Re: Wildlife and zombies

by Termos » Post

Gundul wrote:Your wildlife mod is not working with your current mobkit api ?
I was thinking like wildlife would be a nice addition to zombieworld and to
see what will happen if wolves, zombies and deers live together :)
No it isn't compatible, I haven't gotten around to it yet, but since there's demand, I'm on it.
Gundul wrote: 2019-06-08 11:29:55: ERROR[Main]: .minetest/mods/mobkit/init.lua:862: in function 'hq_hunt'
Punching wolves when they're busy chasing their prey are we? ;)

Gundul
Member
Posts: 1022
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia

Re: Wildlife and zombies

by Gundul » Post

Termos wrote:
Gundul wrote: 2019-06-08 11:29:55: ERROR[Main]: .minetest/mods/mobkit/init.lua:862: in function 'hq_hunt'
Punching wolves when they're busy chasing their prey are we? ;)
No, honestly :) I was just watching. Server crashed a few seconds after I logged in.
My servers: Jungle, Lilly in the valley, 3xile

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

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

by runs » Post

Some requests:
several random animations for stand, walk, run...
Behaviours for aquatic and flying mobs

:-)
Day 42 of the quarantine

Termos
Member
Posts: 325
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

runs wrote: several random animations for stand, walk, run...
You mean something similar to what minetest api does with sounds, like having 'walk1', 'walk2' etc. and when you use 'walk' it picks one randomly?

Haven't considered this before, typical MT models have two animations at the most.
I'll think about it.
runs wrote: Behaviours for aquatic and flying mobs
I have something planned out for the near future, no revealing yet though ;)

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

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

by runs » Post

Termos wrote:
runs wrote: several random animations for stand, walk, run...
You mean something similar to what minetest api does with sounds, like having 'walk1', 'walk2' etc. and when you use 'walk' it picks one randomly?

Haven't considered this before, typical MT models have two animations at the most.
I'll think about it
Like mobs_redo does. Usually, walk and run have only one animation and is enough. But when the mobs remain still, it would be cool to have more animations, this makes feel the mob more alive.
Day 42 of the quarantine

Termos
Member
Posts: 325
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

runs wrote: But when the mobs remain still, it would be cool to have more animations, this makes feel the mob more alive.
Allrighty then. It already can be done using custom behaviors, but having this on entity definition is much better.

I came up with something like this:

Code: Select all

animation = {
	walk={range={x=41,y=101},speed=30,loop=true},
	idle={
		{range={x=0,y=9},speed=1,loop=true},
		{range={x=10,y=19},speed=2,loop=true},
		{range={x=20,y=29},speed=30,loop=true},
		},
	}
variant animation must be an array of tables.
In the example, 'idle' animation will be chosen randomly out of the three.
mobkit.animate function call remains unchanged.

Please let me know if this is more or less what you had in mind.

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

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

by runs » Post

Termos wrote:
runs wrote: But when the mobs remain still, it would be cool to have more animations, this makes feel the mob more alive.
Allrighty then. It already can be done using custom behaviors, but having this on entity definition is much better.

I came up with something like this:

Code: Select all

animation = {
	walk={range={x=41,y=101},speed=30,loop=true},
	idle={
		{range={x=0,y=9},speed=1,loop=true},
		{range={x=10,y=19},speed=2,loop=true},
		{range={x=20,y=29},speed=30,loop=true},
		},
	}
variant animation must be an array of tables.
In the example, 'idle' animation will be chosen randomly out of the three.
mobkit.animate function call remains unchanged.

Please let me know if this is more or less what you had in mind.
Yes, it was my idea.
Day 42 of the quarantine

Termos
Member
Posts: 325
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Release 0.10.1
A minor update.

changes:

- both xample mods: zombies and wildlife are now bundled in

- wildlife: spawn parameters can be modified via the settings menu

- wildlife: new herbivore sounds added

- zombies: spawn parameters can be modified via the settings menu

- mobkit: fixed crash when 'unknown objects' present

- mobkit: walk_speed renamed to max_speed

- mobkit: random variant animations support added

- mobkit: dir_to_rot() function added
  • handy for aquatic and flying animals, projectiles etc.
- mobkit: get_nodes_in_area() function added
  • May not seem like much, but this function is quite helpful
    and essential for moving big entities
    (think like 2 by 3 meters collisionbox, dinosaurs etc.)
- mobkit: get_spawn_pos_abr() function added
  • An abstraction of example mod spawn algorithm
    Also can be used alongside other mods instead of inefficient ABM spawning method.
See mobkit_api.txt for details.

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

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

by runs » Post

Cool. How mobkit: dir_to_rot() works?
Day 42 of the quarantine

Gundul
Member
Posts: 1022
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia

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

by Gundul » Post

Termos wrote:Release 0.10.1
A minor update.
Cool thanks, Server software is updated. Now with deers and wolves, too :)
viewtopic.php?f=10&t=22667
My servers: Jungle, Lilly in the valley, 3xile

Gundul
Member
Posts: 1022
Joined: Thu Aug 27, 2015 10:55
GitHub: berengma
IRC: Gundul
Location: Europe/Asia

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

by Gundul » Post

I think like predators and prey should be able to swim through little rivers. Especially if prey is
fleeing and predators are hunting like in the situation in the picture below.

Image

Maybe prey would avoid rivers if fleeing, but the wolve like in the picture would swim to get his
food.
My servers: Jungle, Lilly in the valley, 3xile

Termos
Member
Posts: 325
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

Gundul wrote:I think like predators and prey should be able to swim through little rivers. Especially if prey is
fleeing and predators are hunting like in the situation in the picture below.
I concur ;) It would be nice if there were more behaviors. Priorities, priorities...

A behavior as described is possible, but it's probably more tricky than it sounds,
for example, the problem with rivers generated by Valleys mapgen is they are often impassable, so a mob would have to find a viable landing spot on the other side before they decide to jump in.

Termos
Member
Posts: 325
Joined: Sun Dec 16, 2018 12:50

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

by Termos » Post

runs wrote:Cool. How mobkit: dir_to_rot() works?
It converts a 3d vector into another that corresponds to an entity facing that vector, and can be passed to minetest.set_rotation()

obj:set_rotation(mobkit.dir_to_rot(v,rot))
  • v - a 3d vector (velocity for example)
  • rot - Current rotation (optional). Pass it if you want to preserve entity rotation in case some v components go zero (e.g. entity stops). Ignore if you want to make the check yourself beforehand or you don't care.

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

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

by runs » Post

I have an issue when a mob dies, lays one node above ground.

Image
Day 42 of the quarantine

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], gpcf and 5 guests