I kind of did the same thing with Minetest, just for fun. And it turned out to be really cool!
Let me explain.
One of the fundamental assumptions of Minetest is that better pickaxes always mine faster. So steel will always mine faster than wood, and mese than steel.
I was playing around with LUA the other night, and just for fun, I made it all random...
- Code: Select all
-- Initialize the Psuedo-random generator
math.randomseed( os.time() )
RANDOMWOOD = math.random()
RANDOMSTONE = math.random()
RANDOMSTEEL = math.random()
RANDOMMESE = math.random()
RANDOMDIAMOND = math.random()
RANDOMOBSIDIAN = math.random()
Then in the code for the pickaxes, I modified the digging times to (x^y) where x is a long time (but incrementally shorter for each higher range of pick - so wood has the longest increment of 50, but mese has an increment of 25). This doesn't necessarily mean mese is faster though. So for example, a wood pick...
- Code: Select all
minetest.register_tool("random:pick_wood", {
description = "Wooden Pickaxe",
inventory_image = "default_tool_woodpick.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level=0,
groupcaps={
cracky = {times={[3]=50^RANDOMWOOD}, uses=10, maxlevel=1},
},
damage_groups = {fleshy=2},
},
})
And a mese pick looks like this!
- Code: Select all
minetest.register_tool("random:pick_mese", {
description = "Mese Pickaxe",
inventory_image = "default_tool_mesepick.png",
tool_capabilities = {
full_punch_interval = 0.9,
max_drop_level=4,
groupcaps={
cracky = {times={[1]=40^RANDOMMESE, [2]=30^RANDOMMESE, [3]=20^RANDOMMESE}, uses=20, maxlevel=3},
},
damage_groups = {fleshy=5},
},
})
So, how does this affect the game?
Well, here's how it works. A Pseudo-random seed is generated every time you open a Minetest world that uses this mod. This seed in turn generates new random numbers, and those in turn affect the speed of the pick.
Now this makes Minetest a little more interesting, because instead of a mad dash to get the best pick at the beginning of the game, you have to experiment with each type of pick to determine which is the best. Sometimes, wood picks will be amazingly fast, but mese picks slow. Sometimes steel is like greased lightning, and sometimes steel takes 30 seconds to mine a node. It's all variable!
So the question is, if wood is like greased lightning, will you use wood picks even though they don't last long? Or will you take your time and use other pick types because they can mine more nodes even though they may be slower?
- Code: Select all
math.randomseed( os.time() )
And if you close the game, it experimentation starts over... Because the pseudo-random number is based on the OS time of the computer, every time you open a Minetest world that uses this mod, the pick times change! Which means you need to experiment again. LOL!
I love being random.
If anyone wants a copy of this mod, let me know...