Post your modding questions here

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Thu Mar 16, 2017 18:30

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.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

by Hybrid Dog » Thu Mar 16, 2017 20:24

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.
 

Nyarg
Member
 
Posts: 144
Joined: Sun May 15, 2016 04:32

Re:

by Nyarg » Fri Mar 17, 2017 02:00

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 ?
I am a noob. still yet. Not so noob ) [vml] WIP
"My english isn't well" I know. I'm sorry )
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Fri Mar 17, 2017 09:01

>How do I may abort that calculation ?

edit the source code
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Sat Mar 18, 2017 13:03

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?
 

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Sun Mar 19, 2017 05:58

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.
 

User avatar
pandaro
Member
 
Posts: 266
Joined: Sun Jan 08, 2012 21:34
GitHub: pandaro

Re: Post your modding questions here

by pandaro » Sun Mar 19, 2017 11:26

[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?
 

User avatar
cx384
Member
 
Posts: 249
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Sun Mar 19, 2017 13:40

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?
Can your read this?
 

User avatar
DS-minetest
Member
 
Posts: 707
Joined: Thu Jun 19, 2014 19:49
GitHub: DS-Minetest
In-game: DS

Re: Post your modding questions here

by DS-minetest » Sun Mar 19, 2017 13:42

@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.
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

Nyarg
Member
 
Posts: 144
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Sun Mar 19, 2017 17:17

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
I am a noob. still yet. Not so noob ) [vml] WIP
"My english isn't well" I know. I'm sorry )
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Mon Mar 20, 2017 08:15

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
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Mon Mar 20, 2017 08:19

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
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Mon Mar 20, 2017 08:29

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
 

Mwamba
Member
 
Posts: 19
Joined: Fri Feb 26, 2016 06:55
GitHub: mwambanatanga

Re: Post your modding questions here

by Mwamba » Mon Mar 20, 2017 08:40

  • 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)?
 

Nyarg
Member
 
Posts: 144
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Mon Mar 20, 2017 08:51

Is fog configurable now ?
I found something
+ Spoiler
but I am new on github and misunderstand do it means implemented or not.
I am a noob. still yet. Not so noob ) [vml] WIP
"My english isn't well" I know. I'm sorry )
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Mon Mar 20, 2017 10:03

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).
 

Mwamba
Member
 
Posts: 19
Joined: Fri Feb 26, 2016 06:55
GitHub: mwambanatanga

Re: Post your modding questions here

by Mwamba » Mon Mar 20, 2017 10:11

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...
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Mon Mar 20, 2017 10:32

Mwamba wrote:Still, is it possible to get player's wielded item

You can use player:get_wielded_item().
 

Nyarg
Member
 
Posts: 144
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Mon Mar 20, 2017 14:30

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 ?
I am a noob. still yet. Not so noob ) [vml] WIP
"My english isn't well" I know. I'm sorry )
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Post your modding questions here

by Byakuren » Mon Mar 20, 2017 15:43

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
Every time a mod API is left undocumented, a koala dies.
 

sofar
Member
 
Posts: 781
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Post your modding questions here

by sofar » Mon Mar 20, 2017 16:09

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".
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Mon Mar 20, 2017 17:16

@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()
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Mon Mar 20, 2017 18:20

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.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Tue Mar 21, 2017 10:21

Is is possible to profile on_timer with the builtin profiler?
 

Mwamba
Member
 
Posts: 19
Joined: Fri Feb 26, 2016 06:55
GitHub: mwambanatanga

Re: Post your modding questions here

by Mwamba » Thu Mar 23, 2017 10:58

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!!!
 

User avatar
mbb
Member
 
Posts: 162
Joined: Sat Jan 17, 2015 17:47
GitHub: mbblp
IRC: mBb
In-game: MBB

Re: Post your modding questions here

by mbb » Fri Mar 24, 2017 14:32

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 194 times
I like trains....and: minetest, blender, gaming, linux, cats, computers
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Fri Mar 24, 2017 16:06

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.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Sat Mar 25, 2017 00:09

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
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Sat Mar 25, 2017 02:33

Get_definition is slower as it needs to go into c++
 

User avatar
Philosoph228
New member
 
Posts: 1
Joined: Fri Mar 24, 2017 11:49
GitHub: Philosoph228
In-game: Philosoph228

Re: Post your modding questions here

by Philosoph228 » Sat Mar 25, 2017 08:43

How can I get the maximum and minimum heights of the world?
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 12 guests

cron