Time Nick Message 17:21 IceDragon Has anyone thought of using Luau in minetest yet? https://luau-lang.org/ it would be interesting to get proper type information in various apis 17:21 MTDiscord luau's source code is not available 17:22 MTDiscord at least not at the time I checked 17:22 MTDiscord oh no wait it is open source now, yay! 17:25 MTDiscord yes, it would be very interesting to see how compiling minetest with luau would change things 17:43 Chompy That could be cool 17:57 IceDragon trying to compile minetest with Luau at the moment, I'll let you guys know if it works out of the box (after I butcher the cmake files) 17:57 MTDiscord I'd love to see if there'll be some sort of performance difference between PUC or LuaJIT 17:58 IceDragon From the site, it should be faster than PUC and competitive with LuaJIT 18:01 celeron55_ it seems it doesn't have JIT which would mean it won't perform well in the kind of bare number crunching done by some mapgens or such 18:01 celeron55_ quite interesting though 18:03 IceDragon If it could transpile luau to lua, we could use it to have linting and analysis, but keep the runtime on luajit 18:18 erlehmann celeron55_ it is interesting how *fast* lua stuff can actually be if the code is good. i optimized the tga encoder in mcl2 today and got it from no compression and taking about 0.1s to RLE-compressed bitmaps made in 0.005s, which is about as fast as minetest.encode_png() … the culprit was appending a string to the encoded data for every pixel instead of using a table and table.concat() at the end 18:19 erlehmann i.e. lua string creation is so slow that just avoiding them gave a 20 times speedup 18:20 erlehmann i bet slow mapgen stuff is usually similarly badly optimized 18:21 celeron55_ well, i bet no 18:21 erlehmann i mean, cora got rid of the mapgen lag in mineclonia on her server just by moving village generation around in the code 18:21 erlehmann maybe mcl2 and related mods are a special case 18:22 erlehmann what i'm saying, usually the number crunching isn't the issue?! 18:22 erlehmann maybe it's different in most mapgens 18:22 erlehmann or maybe it can be *much* faster even and i have no idea of that 18:22 erlehmann bc all lua mapgen dog slow, is it that, celeron55_ ? 18:22 celeron55_ yes, usually no. but the problem is, sometimes the only option is to do serious number crunching, and those cases are why JIT is needed 18:23 celeron55_ JIT doesn't really help code that's structured wrongly or uses a bad algorithm 18:23 MTDiscord From my experience, LuaJIT is smart enough to optimize the string appending pattern 18:23 erlehmann yeah 18:23 MTDiscord (you shouldn't rely on that though) 18:24 erlehmann luatic creating an ever longer string is shitty anyway 18:24 MTDiscord I wouldn't say it's the number crunching. It's the looping. 18:24 MTDiscord With immutable strings it is 18:25 erlehmann aren't all lua strings immutable? 18:25 MTDiscord They are 18:25 MTDiscord Which is why I avoid string concatenations in loops like the plague :) 18:25 celeron55_ it's actually a bit silly to say "lua string creation is slow"... it's just as fast as in any language, it's just that you always create a new string 18:25 celeron55_ doesn't differ from eg. python though 18:25 celeron55_ and everyone knows how to work around it 18:26 MTDiscord IIRC V8 had some unholy opimizations for that too 18:26 erlehmann well, apparently a bunch of ppl didn't, or else i wouldn't have been able to speed up their encoder 18:26 erlehmann luatic wait you maintain modlib right? 18:26 MTDiscord It's a bit slower compared to other languages, as Lua does string intering besides copying the memory 18:26 MTDiscord yes I do 18:28 erlehmann luatic could you test with os.clock() before and after how long the png encoder there takes for an 128x128 8 bit RGB image? 18:29 MTDiscord Random colors? 18:29 MTDiscord (the V8 optimization for instance was that the "new" immutable string would actually be a slice in order to save memory & time) 18:29 MTDiscord (downside was a waste of memory, as long strings were kept around if only a tiny substring pointed to them) 18:29 erlehmann luatic, no, random colors is the worst case for any predictor. try a map image. 18:30 erlehmann luatic wait, i send you one i made just now 18:30 MTDiscord Predictor? Does your encoder support filtering? 18:30 erlehmann i thought you had compression? 18:31 MTDiscord I have compression, but I don't use filtering 18:31 erlehmann i only do RLE, bc the mcl2 devs said that their issue is encoding speed, not filesize (but i wanted to reduce the filesize anyway) 18:31 erlehmann wait, i upload the pic 18:31 erlehmann so we can compare 18:31 MTDiscord Filtering is used to further improve the deflate compression 18:34 erlehmann luatic https://mister-muffin.de/p/lrNr.bin is a 128x128 RGB 8pp RLE TGA 18:34 erlehmann ok it's maybe BGR or something, i don't care. little-endian, big-endian, this that. 18:35 erlehmann luatic lots of water to give a chance for compression ;) 18:37 erlehmann i mean this is still unreasonably big 18:37 erlehmann filesize-wise 18:37 erlehmann bc to make the map art you actually have to have a palette entry for each node 18:37 erlehmann not reusing this for the actual picture is wasteful 18:39 erlehmann but as i said, they care about encoding speed 18:39 MTDiscord 2.7e-3 secs 18:39 erlehmann wdym 18:39 erlehmann pls use dotted decimal notation 18:40 MTDiscord 0.0027 18:40 erlehmann well 18:40 erlehmann how big is your output file? 18:40 erlehmann is it about 4kb? or smaller? 18:41 MTDiscord 746 bytes 18:41 erlehmann LOL 18:41 erlehmann luatic with that kind of runtime behaviour, this is much better than what hecktest made? 18:41 erlehmann like, about the same speed, much smaller filesize 18:41 MTDiscord No, hecktest made effectively the same thing but in C++ 18:42 erlehmann well if it is about the same 18:42 erlehmann why does the C++ thing exist at all 18:42 MTDiscord https://cdn.discordapp.com/attachments/749727888659447960/905889842318163978/lrNrEnc.png 18:42 MTDiscord good question 18:43 MTDiscord as my username indicates, I'm generally in favor of writing things in Lua ;) 18:43 erlehmann like honestly 18:43 erlehmann i see only downsides if it is possible to have it equally good in lua 18:43 erlehmann does your thing crap out on bigger images? 18:43 MTDiscord erlehmann: it's most likely so small because I used compression level 9 (the highest) 18:44 erlehmann luatic ig the devtest checkerboard texture is not 20 times the size it should be then? 18:44 IceDragon Well it doesn't compile out of the box, getting some type errors on luaL_Buffer and such (luau) 18:44 MTDiscord performance-wise, the only bottleneck I see is my CRC calculation 18:45 IceDragon Ah I see what it did, nevermind going to have to convince it not to load the main lua header as well 18:45 MTDiscord But that'll be fixable to after #9847 is merged 18:45 ShadowBot https://github.com/minetest/minetest/issues/9847 -- Add bitop library by Lejo1 18:45 MTDiscord too* 18:45 erlehmann luatic, the thing is, if you don't have any quadratic blowup, this is fine 18:45 erlehmann uh no 18:45 erlehmann then it becomes worse again 18:45 erlehmann the beauty of a pure lua implementation is the backwards compat 18:45 MTDiscord Why would I have quadratic blowup? 18:46 erlehmann no idea, everyone has it nowadays 18:46 MTDiscord The code I have written is all linear time. I'm not quite sure about deflate, but it's probably fast too. 18:46 MTDiscord don't worry, I'd leave my XOR polyfill in 18:46 erlehmann remember when someone attached 100k signatures to a pgp key and some software crapped its pants? 18:46 erlehmann good 18:46 erlehmann so yeah, why isn't your stuff in minetest proper? 18:47 erlehmann celeron55_, and idea? 18:47 erlehmann any 18:47 MTDiscord #11427 is the only Lua PR I've opened so far 18:47 ShadowBot https://github.com/minetest/minetest/issues/11427 -- Redo serialize.lua by appgurueu 18:48 MTDiscord Apart from the URL escaping fix... 18:49 erlehmann luatic does the performance of your thing depend on lua interpreter maybe? 18:49 MTDiscord Most likely 18:50 erlehmann well what's the worst that could happen 18:50 MTDiscord Oh, annoyance of the today: Minetest will happily create it's database.test.sqlite or whatever it's called in your current working directory 18:50 erlehmann what kind of database is that? 18:51 MTDiscord worst is still linear time 18:51 MTDiscord but with a larger factor 18:51 erlehmann nah i mean encoding wise 18:51 MTDiscord erlehmann, we need to talk. 18:51 MTDiscord currently I have no Lua interpreter specific code though 18:51 erlehmann josiah_wi about testing i guess? 18:52 MTDiscord Yes. 18:52 MTDiscord If you have history of #minetest-dev I discussed it there. 18:52 erlehmann i can look it up. which days? 18:54 MTDiscord Today. Last few messages. 19:13 IceDragon After fighting with cmake and my system headers for awhile, I've made some progress 19:13 IceDragon But minetest is using both luaL_checkint and luaL_checkinteger the former isn't available in the Luau headers (even as a alias) 19:13 IceDragon so that would need to change if we plan to support it 19:52 IceDragon Oh wtf, I can't even file a bug report to luau, their lua_error is incompatible with any other 5.1 implementation 20:01 sfan5 they didn't say that the API would be compatible did they? 20:04 IceDragon Nope, but I kinda expected some compliance 20:04 IceDragon Anyway I've reached a roadblock 20:04 IceDragon completely missing functions lua_getstack and luaL_loadbuffer 20:06 IceDragon One major change I did was unifying the lua*.h includes into a single local header file 20:06 IceDragon My compiler kept including luajit, puc lua or whatever the heck it felt like 20:09 IceDragon https://github.com/IceDragon200/minetest/commit/33874d5a684eaf9945f1b7c1bcb8a3dc015fd5d4 20:09 IceDragon So the verdict for now: it doesn't work 22:18 josiah_wi Hello. I do not have access to Discord right now, so I'm looking for modding help on the IRC here. 22:18 josiah_wi Is this the right channel to do that in? 22:21 calcul0n_ josiah_wi, yes it's the right place 22:22 calcul0n_ and this channel is bridged with discord anyway 22:22 josiah_wi My friend and I are trying to register an arrow with the mobs API. We've created and exported a b3d mesh, but we can't figure out how to register the mesh for the arrow to use. 22:23 josiah_wi We want the arrow to be its own item, but we aren't sure how to sync that up with the arrow registration either. 22:23 erlehmann josiah_wi look in mineclonia source code for it ig 22:24 josiah_wi Ok, thank you! 22:24 erlehmann we got it from mcl2 ofc, but fixed some bugs 22:25 erlehmann on second thought, not sure if that helps 22:25 erlehmann you'll figure it out ig 22:27 calcul0n_ in mobs_redo arrows are defined like entities, i guess you need visual="mesh", mesh="model.obj" 22:28 calcul0n_ for the second part i can't tell 22:28 josiah_wi That's the one thing we've tried so far, and it failed to load the mesh. Checking now for spelling typos. 22:30 josiah_wi It says mesh not found: "" so I think mesh is nil. 22:31 josiah_wi There's no mesh field specified in the mobs API reference, so maybe it's not forwarding that to the mesh loader properly. 22:34 calcul0n_ hmm, right, looks like register_arrow only uses textures, not mesh 22:34 josiah_wi So it may not be supported. That would explain it. 22:35 calcul0n_ yep, probably 23:02 independent56 Is 64 n/s too fast for a realistic high speed train mod  based of advtrains? 23:04 independent56 It is equal to 155 mph, the minimumm for category 1 of high speed rail. 23:06 independent56 Follow up question: Give me a rating for my stratergy to decode the Advtrains code: https://pastebin.com/EjFU1vDH 23:08 definitelya decode free software? 23:08 definitelya jk 23:09 independent56 I mean reading the source code 23:09 independent56 My jokes are the worst 23:10 definitelya 64 n/s seems realistic to me tho. 23:10 definitelya ahah 23:12 independent56 In minetest, "50 n/s is relativistic speeds" according to another IRCgoer 23:14 definitelya well, when chunks can't load fast enough... just add teleportation to the code and call it a day? 23:15 independent56 They have handled it; i once went through unloaded chunks on a train journey in advtrains 23:16 independent56 https://pastebin.com/aG87uvuk Here is what i wish to change 23:16 definitelya did you pop in and out of the void? 23:16 independent56 I went into the void, waited at a signal, and then went back in 23:19 independent56 (i am using tiddlywiki syntax; tiddlywiki helps me work better) 23:23 definitelya Have to go, cya. 23:35 independent56 thanks 23:47 IceDragon so close to getting a working copy of minetest with luau now, just need the linker to behave itself 23:57 IceDragon I should have taken the hint that since loadfile and loadbuffer were missing it also meant the dofile and friends were probably not implemented either