[Mod] Petz [DEPRECATED] [petz]

The next Petz will be...

Deer (Prince Of The Forest)
9
31%
Vulture (King of the Death)
9
31%
Armadillo (Master in the Defense)
11
38%
 
Total votes: 29

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v13.2] [petz]

by runs » Post

acidzebra wrote:
Wed May 13, 2020 16:56
running petz on a server, I've been trying to bring down the system load of the mod. It's fine in singleplayer.

I see two main bottlenecks, in api_spawn.lua you register_globalstep and then check for a node to spawn a mob on every step; I think this could be toned down a little by adding a timer like in the example here https://dev.minetest.net/minetest.register_globalstep

Then in api_on_step.lua for every server step you run (assuming every option is set to true)
petz.init_tamagochi_timer(self)
petz.pregnant_timer(self, dtime)
petz.growth_timer(self, dtime)
petz.gallop(self, dtime)
petz.dreamcatcher_save_metadata(self)

I'm still digging through the code, but is it crucial these things are called every server step?

Just some suggestions, I'm an absolute beginner in lua.
I'm going to implement your ideas. :-)

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.2] [petz]

by runs » Post

v14.3

- The on_step functions are checked every 1 second now.
- Workaround for parrot perch issue in 5.3-dev.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.3] [petz]

by runs » Post

I see two main bottlenecks, in api_spawn.lua you register_globalstep and then check for a node to spawn a mob on every step; I think this could be toned down a little by adding a timer like in the example here https://dev.minetest.net/minetest.register_globalstep
I think that does not matter cos the mobkit function has a interval value for checking a spawn node.
Last edited by runs on Wed Jun 17, 2020 00:49, edited 2 times in total.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.3] [petz]

by runs » Post

I will implement a death function so that the petz will not be eternal. Especially the less intelligent ones. It may be useful in servers to control overcrowding.

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

Re: [Mod] Petz [v14.3] [petz]

by Termos » Post

runs wrote:
Tue Jun 16, 2020 21:20
I think that does not matter cos the mobkit function has a interval value for checking a spawn node.
Yup, there is a timer in the function, it doesn't do anything on most steps so it's really cheap unless something weird is done with it.

u18398

Re: [Mod] Petz [v14.3] [petz]

by u18398 » Post

I got a squirrel crash loop on my server jungle:

Code: Select all

2020-06-18 19:37:16: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'petz' in callback luaentity_Step(): .../mods/petz/petz/mobkit/bh_arboreal.lua:74: attempt to index a nil value
2020-06-18 19:37:16: ERROR[Main]: stack traceback:
2020-06-18 19:37:16: ERROR[Main]:       .../mods/petz/petz/mobkit/bh_arboreal.lua:74: in function 'func'
2020-06-18 19:37:16: ERROR[Main]:       /.minetest/mods/mobkit/init.lua:741: in function 'execute_queues'
2020-06-18 19:37:16: ERROR[Main]:       /.minetest/mods/mobkit/init.lua:959: in function 'stepfunc'
2020-06-18 19:37:16: ERROR[Main]:       ...rs/.minetest/mods/petz/petz/petz/squirrel_mobkit.lua:79: in function 'func'
It is not a true loop, but the player can't login anymore because server crashes when he logs in because of the squirrel.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.3] [petz]

by runs » Post

v14.4
- Solved crash with squirrel.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.3] [petz]

by runs » Post

Gundul wrote:
Thu Jun 18, 2020 17:49
I got a squirrel crash loop on my server jungle:

Code: Select all

2020-06-18 19:37:16: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'petz' in callback luaentity_Step(): .../mods/petz/petz/mobkit/bh_arboreal.lua:74: attempt to index a nil value
2020-06-18 19:37:16: ERROR[Main]: stack traceback:
2020-06-18 19:37:16: ERROR[Main]:       .../mods/petz/petz/mobkit/bh_arboreal.lua:74: in function 'func'
2020-06-18 19:37:16: ERROR[Main]:       /.minetest/mods/mobkit/init.lua:741: in function 'execute_queues'
2020-06-18 19:37:16: ERROR[Main]:       /.minetest/mods/mobkit/init.lua:959: in function 'stepfunc'
2020-06-18 19:37:16: ERROR[Main]:       ...rs/.minetest/mods/petz/petz/petz/squirrel_mobkit.lua:79: in function 'func'
It is not a true loop, but the player can't login anymore because server crashes when he logs in because of the squirrel.
Try the last version.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.4] [petz]

by runs » Post

v14.5

- Fixed regression with timers (cause of the on_step change): grow, pregnant...

Image

Lifetime Mode


You can set the lifetime for the petz in the 'petz-conf' file:

- lifetime = -1
-- General lifetime for all the petz. Set a value in seconds.
-- Set to -1 to disable

- You can configure individual lifetime for each type of petz, simply create a "_lifetime" setting. I.e.: "kitty_lifetime = 1200".
-- This particular setting overrides the general lifetime setting.
-- This also works if general lifetime is -1.
-- If you put this setting to -1, the lifetime general setting also would be overrided. You can use this to avoid some type of petz to die when general lifetime is set.

- A dreamcatcher in a petz disables all the lifetime.

- Some fine tunings:
-- lifetime_only_non_tamed = false
-- lifetime_avoid_non_breedable = false
Attachments
kawaii_skull.png
kawaii_skull.png (50.71 KiB) Viewed 943 times
Last edited by runs on Fri Jun 19, 2020 16:36, edited 13 times in total.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.4] [petz]

by runs » Post

...

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.5] [petz]

by runs » Post

v14.6

- Now the lifetime of a petz is shown in its form (tab "Other") (if applies).
- Fix to avoid a crash: Now an opened formspec is automatically closed when a petz dies.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.6] [petz]

by runs » Post

Be Cautious when you define and use the Lifetime Mode

Or you could get some or all the petz dead. I recommend you to test it in a test server.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.6] [petz]

by runs » Post

v14.7
- Added the lifetime_variability (0.2 by default) to add some individual variety in the lifetime. This means that the lifetime can change +-20% for each individual entity.

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [Mod] Petz [v14.7] [petz]

by LMD » Post

For increased intuitivity, I would rather recommend something like lifetime_min and lifetime_max.
My stuff: Projects - Mods - Website

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.7] [petz]

by runs » Post

LMD wrote:
Fri Jun 19, 2020 22:11
For increased intuitivity, I would rather recommend something like lifetime_min and lifetime_max.
Probably it would be a better approach.

Bastrabun
Member
Posts: 211
Joined: Mon Nov 04, 2019 19:48

Re: [Mod] Petz [v14.7] [petz]

by Bastrabun » Post

A player reported there's a duplicate crafting recipe of the shears of mobs_redo and petz. Could you add a recipe that lets players exchange them, when both mods are installed? There may be other duplicate recipes that we haven't come across yet
Whatever I say is CC0

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.7] [petz]

by runs » Post

Bastrabun wrote:
Sun Jun 21, 2020 21:03
A player reported there's a duplicate crafting recipe of the shears of mobs_redo and petz. Could you add a recipe that lets players exchange them, when both mods are installed? There may be other duplicate recipes that we haven't come across yet
Maybe set the default shear as with the lasso.

You should use an advanced craft/inventory, those allow multiple same recipes (duplicates), simply you select the output you want.
Last edited by runs on Sun Jun 21, 2020 21:27, edited 4 times in total.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.7] [petz]

by runs » Post

v14.8

- Now you can define the shears to use in "petz.conf".

Bastrabun
Member
Posts: 211
Joined: Mon Nov 04, 2019 19:48

Re: [Mod] Petz [v14.8] [petz]

by Bastrabun » Post

17 minutes from bug report to fix. Awesome :)

You could also let the mobs_redo shears be crafted from the petz shears and vice versa. I am using unified inventory, it does not seem to have such an option you mentioned?
Whatever I say is CC0

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.8] [petz]

by runs » Post

v14.9
- Fixed crash with the parchment in 5.3-dev

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.8] [petz]

by runs » Post

Bastrabun wrote:
Sun Jun 21, 2020 21:49
17 minutes from bug report to fix. Awesome :)

You could also let the mobs_redo shears be crafted from the petz shears and vice versa. I am using unified inventory, it does not seem to have such an option you mentioned?
I use the addon: unified_inventory_plus

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.2] [petz]

by runs » Post

Bastrabun wrote:
Mon Jun 15, 2020 13:33
- I can reproduce the model-too-big issue. Having wieldview, 3darmor and petz enabled, as soon as I sit on a pony and change the item I wield, my model grows n times in size
I checked and I have not the issue.

Make 2 things:

- Test 1: Download the last 3D Armor (it is not the official one= outdated): https://github.com/minetest-mods/3d_armor

- Test 2: Move the 3darmor mod to another location and check without it.

User avatar
shazen
Member
Posts: 20
Joined: Sat Apr 18, 2020 18:11

Re: [Mod] Petz [v14.9] [petz]

by shazen » Post

Hi, Just found a bug with server crash and when the player reconnect that crash the server again.

Code: Select all

2020-06-28 11:27:06: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'petz' in callback luaentity_Step(): .../mobkit/init.lua:1495: attempt to index local 'node3' (a nil value)
2020-06-28 11:27:06: ERROR[Main]: stack traceback:
2020-06-28 11:27:06: ERROR[Main]: 	.../mobkit/init.lua:1495: in function 'is_in_deep'
2020-06-28 11:27:06: ERROR[Main]: 	.../petz/petz/mobkit/br_aquatic.lua:58: in function 'logic'
2020-06-28 11:27:06: ERROR[Main]: 	.../mobkit/init.lua:958: in function 'stepfunc'
2020-06-28 11:27:06: ERROR[Main]: 	.../petz/petz/petz/dolphin_mobkit.lua:81: in function <.../petz/petz/petz/dolphin_mobkit.lua:80>

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.9] [petz]

by runs » Post

shazen wrote:
Sun Jun 28, 2020 09:48
Hi, Just found a bug with server crash and when the player reconnect that crash the server again.

Code: Select all

2020-06-28 11:27:06: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'petz' in callback luaentity_Step(): .../mobkit/init.lua:1495: attempt to index local 'node3' (a nil value)
2020-06-28 11:27:06: ERROR[Main]: stack traceback:
2020-06-28 11:27:06: ERROR[Main]: 	.../mobkit/init.lua:1495: in function 'is_in_deep'
2020-06-28 11:27:06: ERROR[Main]: 	.../petz/petz/mobkit/br_aquatic.lua:58: in function 'logic'
2020-06-28 11:27:06: ERROR[Main]: 	.../mobkit/init.lua:958: in function 'stepfunc'
2020-06-28 11:27:06: ERROR[Main]: 	.../petz/petz/petz/dolphin_mobkit.lua:81: in function <.../petz/petz/petz/dolphin_mobkit.lua:80>
It is a mobkit error. I will report it.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Petz [v14.9] [petz]

by runs » Post

This can be solved changing the line 1494 of the mobkit's init.lua to:

if node1 and node2 and node3 and node1.drawtype=='liquid' and (node2.drawtype=='liquid' or node3.drawtype=='liquid') then

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests