Time Nick Message 00:50 MTDiscord not that i know of 00:50 MTDiscord you could make a mod that teleports them on login 00:54 Alias2 Or you could edit the database where their logout position in saved 08:03 erlehmann sfan5, FYI: https://git.minetest.land/MineClone2/MineClone2/issues/1846 08:04 erlehmann sfan5, regarding “point them at the packet counter feature”, less lag and less crashes are the main reason mineclonia exists 08:05 erlehmann everything else (better banners) is just something nice to have 08:07 mazes_83 about detached inventory id, I see people maintain manufacturing_number, would it be reasonable to use: minetest.get_current_modname() .. ":" .. string.format("%05x-%05x-%05x-%05", math.random(1048575), math.random(1048575), math.random(1048575), math.random(1048575)) 08:09 mazes_83 that would give a 16^20 collision space, and could save a table for current mod to check if the string is already in use 08:10 erlehmann mazes_83 what exactly are you trying to do here 08:11 mazes_83 generate a unique id for detached inventories 08:12 erlehmann mazes_83 be more specific please. why would you want to do that? 08:13 mazes_83 from what I understood detached name have to get a unique id ? 08:13 mazes_83 s/name/inventory 08:14 mazes_83 I see in the mod I edit, maintains a table on disk to get the next free id 08:15 mazes_83 I just try to look for another way 08:17 erlehmann why would you want to do that? 08:18 erlehmann why detached inventories 08:18 erlehmann for what 08:19 mazes_83 I see people adding features on the mod I edit introduced errors on this disk table, so I try to find another way 08:19 mazes_83 detached inventories are per entities this case 08:19 mazes_83 per entity 08:31 sfan5 erlehmann: good to know that MCL2 devs are aware and I don't need to feel bad for not bothering to open an issue 08:32 sfan5 however the "just move it to the client" stance seems short-sighted. even if you move the code there the data still has to get there, at which point you have to solve an identical problem 08:41 erlehmann sfan5 knowing and caringn are different things sadly. they sometimes port the fixes from mineclonia, after months. 08:43 erlehmann sfan5 the “just move it to the client” thing bothers me more because someone who writes code that updates a texture 66,6 times per second on the server will do the same thing on the client. the result: lag. 12:48 mazes_83 erlehmann: what are main differences between "mineclone 5" and mineclonia ? 12:52 erlehmann mazes_83 mineclone 5 was made because new features were not added. mineclonia was made because of the horrible lag that mineclone 2 (and mineclone 5) have and bc the devs kept adding new bugs. 12:52 erlehmann for example, in mineclone 2 and mineclone 5 for months now all mobs that are not in extra_mobs have regressions compared to mineclone2 0.71. 12:53 erlehmann like, missing AI and stuff 12:54 erlehmann mazes_83 naturally, mineclonia gets new features slower than mineclone 5. but you can, for example, run mineclonia and install the copper mod i think. 12:57 erlehmann mazes_83 if you play singleplayer, the lag will most likely not be noticeable. for multiplayer, i'd suggest to figure out if you want to run mineclonia. it will not have the new nether mapgen ofc. 12:58 erlehmann the broken mobs are a bit frustrating. they can wear armor though, that's a plus lol 13:31 IceDragon mazes_83: For unique ids, I would suggest something like ulid https://github.com/ulid/spec 13:31 IceDragon Granted you would need a stable time source of some kind 13:32 IceDragon Maybe a globalstep service that just increments a counter and is saved to disk somewhere so it survives world reloads 13:32 IceDragon Since the system time can drift 13:39 sfan5 just appending a random number to the current gametime seems decent 13:44 IceDragon As long as its monotonic any time would work methinks 13:54 mazes_83 sfan5: how to get the gametime, this is the kind of entropy I need (despite the 16^20 space I use) ? 13:57 mazes_83 for now I just use strformat("%s:%x-%x-%x-x", minetest.get_current_modname(), math.random(1048575), math.random(1048575), math.random(1048575), math.random(1048575)) 13:58 mazes_83 I also maintain a table of already used "seed", to guarantee my seed hasn't already been used 13:59 IceDragon `minetest.get_gametime()` 14:01 mazes_83 oups, I could have find this alone, sorry 14:02 IceDragon With ULIDs unless you're somehow generating billions of ids per second, you should never run into conflict 14:02 IceDragon So it can eliminate the 'seen' or seed table 14:03 IceDragon If it brings you any comfort, it's the id format I use at work for messaging and cdrs 14:06 mazes_83 I think I'll stick to the simple solution I found, I think it's also kind of robust to collision 15:15 Fixer sfan5: thaaaaaaaaaanks 15:40 erlehmann sfan5, mazes_83 how random is math.random btw? 15:41 Krock minetest initializes the seed somewhere in builtin, so it's okayish random 15:44 erlehmann can i steal the inv somehow? 15:44 erlehmann if i know the id 16:25 mazes_83 yes ofc, but id were even more easy to guess before this random 16:27 mazes_83 they just followed this pattern: entity_name .. ":" .. manufacturing_number 16:27 mazes_83 were manufacturing number is a sequential 16:30 mazes_83 I should put the id table to local instead, would be more sane 17:08 MTDiscord Krock: Yes, Minetest seeds the random. But it uses os.time(), meaning servers started the same second will have the same sequence. Minetest does not pop a few random numbers, leading to rather poor first random numbers. 17:18 IceDragon Any chance of adding a higher precision timer to the lua api so we can at least get millisecond accurate time? 17:19 IceDragon That would also allow for a better random seed 17:20 Mineclone2coolga I also developed Ark survival evolved for minetest very big game because 3 giga but I don't know how to post it how to do? 17:20 MTDiscord Mineclone2coolga: Troll somebody else. 17:20 MTDiscord IceDragon: I use minetest.get_us_time() which, as the name suggest, offers microsecond precision 17:21 MTDiscord For the seed, you can alternatively add os.time() and os.clock() 17:21 sfan5 IceDragon: good suggestion, in fact so good that such a function was added more than 3 years ago 17:21 sfan5 ;) 17:21 Mineclone2coolga [19:10:59] this ark minetest it contains all the maps such as 17:21 Mineclone2coolga [19:10:59] the island 17:21 Mineclone2coolga [19:10:59] scorched earth 17:21 Mineclone2coolga [19:10:59] aberration 17:21 Mineclone2coolga [19:10:59] extinction 17:21 Mineclone2coolga [19:10:59] genesis part 1 17:21 IceDragon How did I miss that looking over the lua api, I feel stupid 17:21 MTDiscord If you really did build such a large game, you would sure know how to publish it. 17:22 Mineclone2coolga no 17:22 MTDiscord But in case you have done something, perhaps built maps: Either find a way to reduce your file size, or find a free hoster which accepts such large files. 17:32 Mineclone2coolga because minetest will not hold all this? 17:32 MTDiscord well minetest doesn't have built-in file hosting capabilities 17:33 MTDiscord unless... you'd host a server from it 17:33 MTDiscord but if you want others to download it and play it locally you can't do it by hosting a minetest server 17:34 Mineclone2coolga ok bye 17:41 erlehmann IceDragon you won't get secure random numbers out of minetest ig 18:08 IceDragon erlehmann: My comment on a better random seed was in response to Krock mentioning the use of os.time which is only accurate up to a second 18:09 IceDragon If I really wanted strong random numbers I would load up openssl through ffi 18:10 erlehmann any use of os.time() as the sole seed is ridiculous 18:10 sfan5 no need for openssl either https://github.com/minetest/minetest/blob/6fedee16f098549ffaee188b02b777239513abc3/doc/lua_api.txt#L6986-L6997 18:13 IceDragon I really need to look through the lua_api more 18:13 IceDragon I completely forgot about SecureRandom 18:15 MTDiscord Wait we have secure random? 18:15 MTDiscord The Minetest feature tree is a very odd one 18:15 sfan5 since 2015-08-06 yes 18:17 IceDragon the minetest api has all kinds of nice things, they're just tucked away in corners of the document sometimes 19:00 IceDragon So I was messing around with ItemStack, I did a benchmark, where I created 4 million item stacks, it took 30+ seconds, if I ditch the constructor and leave just a basic table ({name, count, wear}) it takes 1 second for all the stacks 19:01 IceDragon Now what I'm wondering, what exactly goes on in the ItemStack constructor that would make it that slow 20:27 sfan5 IceDragon: https://github.com/minetest/minetest/blob/master/src/script/lua_api/l_item.cpp#L430-L443 20:29 IceDragon From a glance the only culprit I could think of is the read_item, I should be able to find the function unless you already know where it is 20:30 sfan5 probably in cpp_api/c_content.cpp 20:32 IceDragon Yep that's where it was 20:32 IceDragon Doesn't look like it would be that inefficient, unless I'm missing something 20:34 IceDragon wait a second, the itemstack is being returned by value, which implies a copy 20:34 sfan5 https://en.cppreference.com/w/cpp/language/copy_elision nah 20:36 IceDragon I guess one way would be to just benchmark creating 4 million C++ itemstacks and see what it does 20:48 IceDragon okay gonna try something different, changing the m_aliases to a regular map (from unordered_map) and running the benchmark again 20:48 IceDragon I doubt it would make a difference 20:49 sfan5 do you create empty item stacks or ones with name? 20:49 sfan5 also you should profile this properly, for example with perf 20:50 IceDragon ones with names 20:50 IceDragon C++ isn't my strong point so don't expect much of me there P: 21:05 IceDragon The struggles of crappy mobile internet 21:16 IceDragon sfan5: How do I use perf, that aside I split my test into different types, empty item stacks complete in 1.7~ seconds, itemstrings take 11, tables take 8, tables with a blank name take 7, since my initial test was doing all four at once this gives an idea of the issue 21:17 sfan5 I'd suggest this https://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html 21:18 sfan5 I tried this on the entire client yesterday: 21:18 sfan5 perf record -F 400 -a --call-graph dwarf -- ./bin/minetest --go --worldname test 21:18 sfan5 perf script | /tmp/FlameGraph/stackcollapse-perf.pl | /tmp/FlameGraph/flamegraph.pl > graph.svg 21:18 sfan5 but that didn't work so well, what you want to do is minimize the testcase so only your benchmark code ever runs 21:20 IceDragon yeah that's gonna be hard since it's in lua land right now 21:20 IceDragon I could always stick it in a single mod under a clean world 21:20 IceDragon since all it needs to do is create the item stacks 21:23 sfan5 yeah maybe try that first 22:31 IceDragon Okay sorry about the delay something work related came up 22:31 IceDragon I have the perf.data so now I'm gonna read the flame graphs 22:56 IceDragon Okay I've tested, empty stacks, itemstring, table and itemstack from another itemstack, all graphed up as svg 23:09 erlehmann IceDragon, why are you creating 4 million itemstacks in the first place 23:10 IceDragon I was testing a inventory serializer, in order to ensure that it performs well I ran it with an absurd number of times and noticed that it took way longer than expected 23:10 IceDragon Basically: I had to hammer the code to get noticeable benchmark numbers 23:11 IceDragon under normal circumstances I wouldn't care, but because it seemed to be taking a little too long I wanted to figure out why 23:11 IceDragon If I can create 1 million tables under a second, I can't fathom why an ItemStack takes 10x that 23:26 IceDragon https://share.druid.space/2021-09-16/minetest/itemstack-graphs/ 23:26 IceDragon I uploaded the result from my perf tests 23:32 sfan5 I wonder why time is spent on Toolcaps when there aren't any 23:33 IceDragon Not sure if it's worth fixing since this is an extreme (test) case, but seems like there is room for optimization 23:35 MTDiscord i think i have an idea why 23:35 MTDiscord all tools correct fallback to the players hand definition of ":" 23:35 MTDiscord in other words it's templating every itemstack 23:36 MTDiscord to copy the default hand tool props 23:37 MTDiscord this includes craftitems, tools with no defined properties, nodes 23:37 sfan5 that would be stupid 23:37 MTDiscord i mean this is minetest 23:37 MTDiscord stupid seems to be the norm 23:38 erlehmann second hand when