Page 124 of 125

Re: Post your modding questions here

PostPosted: Thu Mar 16, 2017 18:30
by sofar
Nyarg wrote:500000 nodes = 30 FPS
10500 entities = 3 FPS

W.T.H. is does exactly MT render or engine when draw simple node Versus simplest entity ?
entity simple single side plate (without any material assigned in blender)


nodes are rendered into a "mesh" together. So 500k nodes can end up being only a few hundred meshes. 10k entities is 10k meshes, full stop. Plus entities need to be serviced every step to update position and calculate physics, so, they're really resource consuming to both client and server.

PostPosted: Thu Mar 16, 2017 20:24
by Hybrid Dog
You could abort position and physics calculation of entities and particles after a specific amount of time exceeded (e.g. 1/60) to reduce only the object and particle fps instead of the aggregate fps rate.

Re:

PostPosted: Fri Mar 17, 2017 02:00
by Nyarg
sofar wrote:nodes are rendered into a "mesh" together. .

I am trying attach entities success but have no effect in FPS.

sofar wrote:entities need to be serviced every step .
Is there a way to block every step calculation for entities (even may be globalTable editing) ?
Hybrid Dog wrote:You could abort position and physics calculation of entities and particles .
How do I may abort that calculation ?

Re: Post your modding questions here

PostPosted: Fri Mar 17, 2017 09:01
by Hybrid Dog
>How do I may abort that calculation ?

edit the source code

Re: Post your modding questions here

PostPosted: Sat Mar 18, 2017 13:03
by burli
Is voxelmanip always faster than get_node? I noticed that the hopper mod uses voxelmanip just to get two neighbour nodes.

Is this really better?

Re: Post your modding questions here

PostPosted: Sun Mar 19, 2017 05:58
by sofar
burli wrote:Is voxelmanip always faster than get_node? I noticed that the hopper mod uses voxelmanip just to get two neighbour nodes.

Is this really better?


yes and no. It can sometimes mean only doing a single lua-to-C call, which is likely cheaper than two get_node() calls. But if it's not performance critical, you shouldn't worry too much.

Re: Post your modding questions here

PostPosted: Sun Mar 19, 2017 11:26
by pandaro
[CSM] client side modding explanation
I'm following the evolving of minetest, i see this new feature.
I need to know:
For such purposes has made this class of API?
On what occasions it is best to use a client mod and in which it is supposed to use a server side mod?

Re: Post your modding questions here

PostPosted: Sun Mar 19, 2017 13:40
by cx384
pandaro wrote:[CSM] client side modding explanation
I'm following the evolving of minetest, i see this new feature.
I need to know:
For such purposes has made this class of API?
On what occasions it is best to use a client mod and in which it is supposed to use a server side mod?

Do you want to see this?

Re: Post your modding questions here

PostPosted: Sun Mar 19, 2017 13:42
by DS-minetest
@pandaro:
There is a client lua api.
Client side mods are good to handle the information that you get from the server. Server side mods are used to add features and CO. to every player on a server.

Re: Post your modding questions here

PostPosted: Sun Mar 19, 2017 17:17
by Nyarg
Next code rise error
+ Spoiler
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_punchnode( ...
       minetest.register_entity( modName .. ":efRB", eObjRB )
...
end )


But if I make simple stub in minetest-0.4.14\builtin\game\register.lua like
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function check_modname_prefix(name)
...
---   local expected_prefix = core.get_current_modname() .. ":"
      local expected_prefix
      if core.get_current_modname()==nil then expected_prefix = "lumpmg"
      else expected_prefix = core.get_current_modname()
      end
      expected_prefix = expected_prefix .. ":"
...

All works fine and new entity creating after loadTime now, wow !

Question:
What problem do it may cause and where (if change stub with proper code) ?

*have dreaming about like above backdoor for node register same way

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 08:15
by burli
How can I add "shift click" to move item stacks between inventories like in the chest? I can't find any reason why it works for a chest, but not in my mod

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 08:19
by Linuxdirk
burli wrote:How can I add "shift click" to move item stacks between inventories like in the chest? I can't find any reason why it works for a chest, but not in my mod

You need to set up a list ring in your formspec definition.

viewtopic.php?f=18&t=12629

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 08:29
by burli
Linuxdirk wrote:
burli wrote:How can I add "shift click" to move item stacks between inventories like in the chest? I can't find any reason why it works for a chest, but not in my mod

You need to set up a list ring in your formspec definition.

viewtopic.php?f=18&t=12629

Ah, thanks. Will try this now

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 08:40
by Mwamba
  • Any good way to find out if player's wielded item is a tool (and not a block)?
  • Any good way to find out which of the registered items are tools (basically, get a list of available tools)?

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 08:51
by Nyarg
Is fog configurable now ?
I found something
+ Spoiler
but I am new on github and misunderstand do it means implemented or not.

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 10:03
by Linuxdirk
Mwamba wrote:
  • Any good way to find out if player's wielded item is a tool (and not a block)?
  • Any good way to find out which of the registered items are tools (basically, get a list of available tools)?

There is minetest.registered_tools which is a table of all the registered tools. You can read this table to get, well, all registered tools. You can also iterate over the table and compare to the currently wielded item.

Something like this (untested):

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local wielditem_is_tool = function(player)
    local registered_tools = minetest.registered_tools
    local wielded_item_name = player:......... -- whatever you have to do when
                                               -- you want to get the currently
                                               -- wielded item name

    for name,definition in pairs(registered_tools) do
        if name == wielded_item_name then return true end
    end

    return false
end

Call with wielditem_is_tool(player) to get either true (wielded item is a registered tool) or false (wielded item is not a registered tool).

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 10:11
by Mwamba
Linuxdirk wrote:There is minetest.registered_tools
Oh, great! This perfectly answers my second question. Thank you!

Still, is it possible to get player's wielded item and check for it's parameters? All I discovered up to this point is that tools have a tool_capabilities parameter, but I can't figure out how to check whether it's set...

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 10:32
by Linuxdirk
Mwamba wrote:Still, is it possible to get player's wielded item

You can use player:get_wielded_item().

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 14:30
by Nyarg
I don't see particle rotation property (something like angleStartByX etc or angleStaticX)
am I missing it somewhere ?

And what about glow and blend ? Where is it's description described ?

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 15:43
by Byakuren
Linuxdirk wrote:
Mwamba wrote:
  • Any good way to find out if player's wielded item is a tool (and not a block)?
  • Any good way to find out which of the registered items are tools (basically, get a list of available tools)?

There is minetest.registered_tools which is a table of all the registered tools. You can read this table to get, well, all registered tools. You can also iterate over the table and compare to the currently wielded item.

Something like this (untested):

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local wielditem_is_tool = function(player)
    local registered_tools = minetest.registered_tools
    local wielded_item_name = player:......... -- whatever you have to do when
                                               -- you want to get the currently
                                               -- wielded item name

    for name,definition in pairs(registered_tools) do
        if name == wielded_item_name then return true end
    end

    return false
end

Call with wielditem_is_tool(player) to get either true (wielded item is a registered tool) or false (wielded item is not a registered tool).


Iterating over the table is a waste, better to do
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
return minetest.registered_tools[wielded_item_name] ~= nil

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 16:09
by sofar
Nyarg wrote:I don't see particle rotation property (something like angleStartByX etc or angleStaticX)
am I missing it somewhere ?


No, it does not exist. Particles are either - always facing the player no matter the angle, or - always facing the player but vertical (rotating horizontal).

Nyarg wrote:And what about glow and blend ? Where is it's description described ?


Glow is implemented, blend was cut and is not implemented.

See lua_api.txt. Just search for "glow".

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 17:16
by orwell
@nyarg, on your pos on the previous page
You are registering an entity inside a callback. You should never do this.
Because you misuse the API, you get an error.
I think you rather want to add an entity into the world at this place.
minetest.add_entity()

Re: Post your modding questions here

PostPosted: Mon Mar 20, 2017 18:20
by Linuxdirk
Byakuren wrote:Iterating over the table is a waste, better to do
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
return minetest.registered_tools[wielded_item_name] ~= nil

Yep. Better solution.

Re: Post your modding questions here

PostPosted: Tue Mar 21, 2017 10:21
by burli
Is is possible to profile on_timer with the builtin profiler?

Re: Post your modding questions here

PostPosted: Thu Mar 23, 2017 10:58
by Mwamba
Byakuren wrote:Iterating over the table is a waste, better to do
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
return minetest.registered_tools[wielded_item_name] ~= nil
Oh, yeah, that's what I need. Thank you!!!

Re: Post your modding questions here

PostPosted: Fri Mar 24, 2017 14:32
by mbb
how i can generate some decorations like bushes?
my mapgen.lua dosesn´t works
here is my mod
Forestos_plants.zip
(5.75 KiB) Downloaded 440 times

Re: Post your modding questions here

PostPosted: Fri Mar 24, 2017 16:06
by Hybrid Dog
mbb, have a look at code of other mods:
https://github.com/D00Med/moreplants/bl ... t.lua#L681
https://github.com/D00Med/moreplants/bl ... t.lua#L905

l think you did a typo in the first line of init.lua:
dofile(minetest.get_modpath("flowers") .. "/mapgen.lua")
your mapgen.lua isn't loaded…

And l guess you don't need to use the flowers table.

Re: Post your modding questions here

PostPosted: Sat Mar 25, 2017 00:09
by kaeza
Mwamba wrote:
  • Any good way to find out if player's wielded item is a tool (and not a block)?

An alternative and probably faster:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local stack = player:get_wielded_item()
local def = stack:get_definition()
if def.type == "tool" then
  -- do something
end

Re: Post your modding questions here

PostPosted: Sat Mar 25, 2017 02:33
by rubenwardy
Get_definition is slower as it needs to go into c++

Re: Post your modding questions here

PostPosted: Sat Mar 25, 2017 08:43
by Philosoph228
How can I get the maximum and minimum heights of the world?