[MOD] Tool ranks [toolranks]

KCoombes
Member
 
Posts: 403
Joined: Thu Jun 11, 2015 23:19
Location: SW Florida, USA
In-game: Knatt

Re: [MOD] Tool ranks [toolranks]

by KCoombes » Sun Jul 30, 2017 12:30

Is there a limit to how many levels a tool can gain?
 

User avatar
lisacvuk
Member
 
Posts: 274
Joined: Sat Jul 19, 2014 11:52
Location: Serbia, Užice
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Sun Jul 30, 2017 12:49

6, at 1600 nodes
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
 

User avatar
azekill_DIABLO
Member
 
Posts: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

ABJ
Member
 
Posts: 3015
Joined: Sun Jan 18, 2015 13:02
Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.
GitHub: ABJ-MV
In-game: ABJ
 

User avatar
TumeniNodes
Member
 
Posts: 2544
Joined: Fri Feb 26, 2016 19:49
Location: in the dark recesses of the mind
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes

Re: [MOD] Tool ranks [toolranks]

by TumeniNodes » Tue Aug 15, 2017 23:14

Love this. Definitely adds to gameplay : )
I'm not your buddy, guy...
 

auouymous
Member
 
Posts: 161
Joined: Sun Dec 07, 2014 09:39
GitHub: auouymous
IRC: air
In-game: auouymous

Re: [MOD] Tool ranks [toolranks]

by auouymous » Fri Sep 01, 2017 09:05

lisacvuk wrote:
Code: Select all
wear = digparams.wear / (1 + level / 4)

I simply brute-forced the above code. No idea how it works, but it seems about right in-game.


For levels 1-6 that code multiplies wear by 1.0, 0.67, 0.57, 0.5, 0.44, and 0.4. The following code is more balanced and offers more than just 6 levels and 1600 broken nodes to get a max level tool.

Code: Select all
toolranks = {
  -- these two settings can be tweaked by the server admin
  min_bits = 6, -- 64 nodes to get level 1
-- min_bits = 7, -- 128 nodes to get level 1
  max_level = 15
}
toolranks.min_nodes = math.pow(2, toolranks.min_bits)
toolranks.max_level_nodes = math.pow(2, toolranks.max_level+toolranks.min_bits-1)

function toolranks.get_level(uses)
  if uses < toolranks.min_nodes then return 0 end
  if uses >= toolranks.max_level_nodes then return toolranks.max_level end
  return 1 + math.log(math.floor(uses / toolranks.min_nodes)) / math.log(2)
end

-- the level>1 check is not needed
local wear = digparams.wear * (1 - (level / toolranks.max_level))


With 15 levels you get wear multipliers of 1.0, 0.93, 0.86, 0.8, 0.73, 0.67, 0.6, 0.53, 0.47, 0.4, 0.33, 0.26, 0.2, 0.13, 0.07 and 0.0. So a level 15 tool becomes unbreakable.

With min_bits=6 a level 15 tool must break 1,048,576 nodes (2,097,152 nodes for min_bits=7). Max level can be decreased to 10 and only require 32,768 or 65,536 nodes. Or it could be increased to 20 and require 33,554,432 or 67,108,864 nodes. Quite flexible.
 

User avatar
lisacvuk
Member
 
Posts: 274
Joined: Sat Jul 19, 2014 11:52
Location: Serbia, Užice
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Fri Sep 01, 2017 10:29

Okay, that seems to have took some effort. Thanks for your input.

There were some previous attempts at more levels on GitHub, but they aren't very much liked by server admins. 6 levels seems to be the best possible amount.

Only thing I might change is the number of nodes needed for levels. It doesn't take long for level 6 right now.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
 

auouymous
Member
 
Posts: 161
Joined: Sun Dec 07, 2014 09:39
GitHub: auouymous
IRC: air
In-game: auouymous

Re: [MOD] Tool ranks [toolranks]

by auouymous » Sun Sep 03, 2017 21:20

I haven't looked at the rest of the toolranks code but would it be possible to show something like "next level at N nodes" in the tooltip? It would let the player know if another level exists and how many nodes are needed to reach it.

lisacvuk wrote:There were some previous attempts at more levels on GitHub, but they aren't very much liked by server admins. 6 levels seems to be the best possible amount.


The new code below has an additional unbreakable_level setting that can be same as or higher than max_level. It controls the actual scale of the wear multiplier while max_level < unbreakable_level disables unbreakable tools.

With bits=7, max=5 and unbreakable=15 you get 6 levels with similar node counts but more balanced wear multipliers. Bumping max_level to 9 adds 4 more levels with level 9 requiring 32768 nodes and giving the same 0.4 wear multiplier your current level 6 gives. Bumping min_bits to 8 would double all the node counts. It allows admins to easily tweak node count and wear multiplier scales, and add more levels. It even has a debug mode to see the values for each level.
Code: Select all
lvl     nodes      wear multiplier
0       0          1
1       128        0.93
2       256        0.87
3       512        0.8
4       1024       0.73
5       2048       0.67  (current level 2 gives this wear)

6       4096       0.6
7       8192       0.53
8       16384      0.47
9       32768      0.4  (current level 6 gives this wear)


Code: Select all
toolranks = {
  -- these three settings can be tweaked by the server admin
--  min_bits = 6, -- 64 nodes to get level 1
  min_bits = 7, -- 128 nodes to get level 1
--  min_bits = 8, -- 256 nodes to get level 1
  max_level = 6,
  unbreakable_level = 15,
  debug = false -- set to true to view node counts and wear multipliers for each level
}
if toolranks.max_level > toolranks.unbreakable_level then
  minetest.log("error", "[toolranks] max_level("..toolranks.max_level..") must be less than or equal to unbreakable_level("..toolranks.unbreakable_level..")")
  toolranks.max_level = toolranks.unbreakable_level
end
toolranks.min_nodes = math.pow(2, toolranks.min_bits)
toolranks.max_level_nodes = math.pow(2, toolranks.max_level+toolranks.min_bits-1)

function toolranks.get_level(uses)
  if uses < toolranks.min_nodes then return 0 end
  if uses >= toolranks.max_level_nodes then return toolranks.max_level end
  return 1 + math.log(math.floor(uses / toolranks.min_nodes)) / math.log(2)
end

-- the level>1 check is not needed
local wear = digparams.wear * (1 - (level / toolranks.unbreakable_level))

-- or maybe get rid of debug setting and always display this info, without the error message
if toolranks.debug then
  print("[toolranks] DEBUG", toolranks.get_level(0), 0, 1)
  for i=1,toolranks.max_level,1 do
    local nodes = math.pow(2, i-1+toolranks.min_bits)
    -- current wear multiplier
--    local wear = 1 / (1 + (i+1) / 4)
    -- new wear multiplier
    local wear = 1 - (i / toolranks.unbreakable_level)
    print("[toolranks] DEBUG", toolranks.get_level(nodes), nodes, wear)
  end
  minetest.log("error", "[toolranks] DEBUG enabled")
end
 

User avatar
lisacvuk
Member
 
Posts: 274
Joined: Sat Jul 19, 2014 11:52
Location: Serbia, Užice
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Mon Sep 04, 2017 07:56

First of all, thank you for your interest in my mod, and for the effort of improving it. I know more levels sounds good to multiple players, but I'd like to keep this mod simple. The code looks good and is probably a lot cleaner then mine. I also don't think forum is a good way for developer communication, so I'd appreciate it if you could make a pull request next time.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
 

User avatar
ToyElf
Member
 
Posts: 13
Joined: Fri Apr 21, 2017 19:23
Location: Carboard Box
In-game: ToyElf Toy_Elf

Re: [MOD] Tool ranks [toolranks]

by ToyElf » Thu Sep 14, 2017 22:36

I run into this error whenever i try to play with this mod. I changed the name of the folder to toolranks, and i DID launch the game, but whenever I broke any node it instantly crashed the game. Any ideas? :(
Attachments
000326.png
(58.51 KiB) Not downloaded yet
 

User avatar
kingoscargames
Member
 
Posts: 216
Joined: Fri Jul 28, 2017 12:06
Location: Netherlands
GitHub: kingoscargames
In-game: kingoscargames

Re: [MOD] Tool ranks [toolranks]

by kingoscargames » Thu Sep 14, 2017 22:56

You are using a outdated minetest version so try updating that.
 

User avatar
Napiophelios
Member
 
Posts: 940
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [MOD] Tool ranks [toolranks]

by Napiophelios » Thu Sep 14, 2017 23:16

ToyElf wrote:I run into this error whenever i try to play with this mod. I changed the name of the folder to toolranks, and i DID launch the game, but whenever I broke any node it instantly crashed the game. Any ideas? :(


make a blank file called--> mod.conf
open it with a text editor and write this:

Code: Select all
name = toolranks


place your new mod.conf file
inside the mod folder (next to the init.lua file)
and see if it helps

edit: never mind.
why do you have that screen shot if you know that's not the problem?

kingoscargames wrote:You are using a outdated minetest version so try updating that.

yeah...what he said :)
 

User avatar
lisacvuk
Member
 
Posts: 274
Joined: Sat Jul 19, 2014 11:52
Location: Serbia, Užice
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Fri Sep 15, 2017 06:05

ToyElf wrote:I run into this error whenever i try to play with this mod. I changed the name of the folder to toolranks, and i DID launch the game, but whenever I broke any node it instantly crashed the game. Any ideas? :(

Rename the mod dir to 'toolranks'
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
 

User avatar
kingoscargames
Member
 
Posts: 216
Joined: Fri Jul 28, 2017 12:06
Location: Netherlands
GitHub: kingoscargames
In-game: kingoscargames

Re: [MOD] Tool ranks [toolranks]

by kingoscargames » Fri Sep 15, 2017 08:08

lisacvuk wrote:Rename the mod dir to 'toolranks'

ToyElf wrote:I changed the name of the folder to toolranks,
 

User avatar
the_raven_262
Member
 
Posts: 315
Joined: Mon Sep 22, 2014 09:30
GitHub: theraven262
IRC: the_raven_262 Raven262 Corvus262 corvus
In-game: the_raven_262 Raven262 Nevermore

Re: [MOD] Tool ranks [toolranks]

by the_raven_262 » Fri Sep 15, 2017 08:12

ToyElf wrote:I run into this error whenever i try to play with this mod. I changed the name of the folder to toolranks, and i DID launch the game, but whenever I broke any node it instantly crashed the game. Any ideas? :(


You've got outdated minetest, as others already said. It is wise to update at least when a new release is out.
[amber] [conjuration] [warzone] | Why is #minetest-mod-dev so empty?
 

User avatar
lisacvuk
Member
 
Posts: 274
Joined: Sat Jul 19, 2014 11:52
Location: Serbia, Užice
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Fri Sep 15, 2017 08:13

kingoscargames wrote:
lisacvuk wrote:Rename the mod dir to 'toolranks'

ToyElf wrote:I changed the name of the folder to toolranks,

Kill me
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
 

User avatar
the_raven_262
Member
 
Posts: 315
Joined: Mon Sep 22, 2014 09:30
GitHub: theraven262
IRC: the_raven_262 Raven262 Corvus262 corvus
In-game: the_raven_262 Raven262 Nevermore

Re: [MOD] Tool ranks [toolranks]

by the_raven_262 » Fri Sep 15, 2017 08:14

lisacvuk wrote:Kill me

Sure thing.
[amber] [conjuration] [warzone] | Why is #minetest-mod-dev so empty?
 

User avatar
ToyElf
Member
 
Posts: 13
Joined: Fri Apr 21, 2017 19:23
Location: Carboard Box
In-game: ToyElf Toy_Elf

Re: [MOD] Tool ranks [toolranks]

by ToyElf » Tue Sep 19, 2017 00:44

Yup, updating fixed it, thanks! I didn't even realise i was using an outdated version >_> Cheers guys!
 

User avatar
azekill_DIABLO
Member
 
Posts: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [MOD] Tool ranks [toolranks]

by azekill_DIABLO » Tue Sep 19, 2017 16:28

the_raven_262 wrote:
lisacvuk wrote:Kill me

Sure thing.

will help too! a little bucket of lava?
 

User avatar
lisacvuk
Member
 
Posts: 274
Joined: Sat Jul 19, 2014 11:52
Location: Serbia, Užice
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Tue Sep 19, 2017 16:40

azekill_DIABLO wrote:
the_raven_262 wrote:
lisacvuk wrote:Kill me

Sure thing.

will help too! a little bucket of lava?

Image
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
 

User avatar
azekill_DIABLO
Member
 
Posts: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

User avatar
lisacvuk
Member
 
Posts: 274
Joined: Sat Jul 19, 2014 11:52
Location: Serbia, Užice
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Tue Sep 19, 2017 17:06

azekill_DIABLO wrote:Cool! Barman? 2 buckets of lava for me and my friend!

Image

I am honored to warrant a custom MS paint artwork, good sir.
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
 

User avatar
azekill_DIABLO
Member
 
Posts: 7460
Joined: Wed Oct 29, 2014 20:05
Location: OMICRON
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [MOD] Tool ranks [toolranks]

by azekill_DIABLO » Tue Sep 19, 2017 17:09

that not mein work, found it on image sections xD i'm better at drawing (hmm wait no, it would be worst.)
 

einarromero
New member
 
Posts: 5
Joined: Wed Sep 20, 2017 02:04

Re: [MOD] Tool ranks [toolranks]

by einarromero » Thu Sep 21, 2017 02:03

I had an issue, game said:
Code: Select all
/home/einar/.minetest/mods/toolranks/init.lua:30: attempt to concatenate local 'uses' (a nil value)
stack traceback:
/home/einar/.minetest/mods/toolranks/init.lua:30: in function 'create_description'

Someone can help me?
 

User avatar
lisacvuk
Member
 
Posts: 274
Joined: Sat Jul 19, 2014 11:52
Location: Serbia, Užice
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: [MOD] Tool ranks [toolranks]

by lisacvuk » Thu Sep 21, 2017 06:28

einarromero wrote:I had an issue, game said:
Code: Select all
/home/einar/.minetest/mods/toolranks/init.lua:30: attempt to concatenate local 'uses' (a nil value)
stack traceback:
/home/einar/.minetest/mods/toolranks/init.lua:30: in function 'create_description'

Someone can help me?

I don't see how could that happen. There is a check to prevent it.
1. What mods have you got enabled?
2. What is your MT version?
It's lisac, not lisa.
400 character limit? Am I writing a book?
Administrator on Craig's server. Minetest player.
"The enemy pales when they see the face of Dazzle!" ~ Dazzle obviously.
I live in Serbia.
Steam | OpenDOTA
My mods:
Tool ranks
I appreciate donations in TF2 items. :)
 

PreviousNext

Return to Mod Releases



Who is online

Users browsing this forum: Piezo_ and 4 guests

cron