Time Nick Message 00:13 ilikecats The Luanti API docs say "A palette is a texture, which can contain up to 256 pixels.", 00:13 ilikecats but also "These nodes can have 256 different colors. The palette should contain 256 pixels." 00:14 ilikecats Does this mean that I need to have 256 different blocks? 00:15 ilikecats I'm trying to register blocks from a palette, but I want to be able to have as many or few blocks as I want, and to be able to count how many. 00:35 ilikecats Just to add, what I'm going for here is just a bunch of solid colored blocks that I can generate from a palette, and I need to know how many blocks are made. 00:47 ilikecats Oohhh I understand now, the palette will be expanded to 256 colors, but you only need however many you want. 00:47 ilikecats I still need to know how many colors are in the palette though. 02:44 MTDiscord no it's all going to be one node, the color is then determined by the color of the palette at the position of the node's param2 05:41 MTDiscord When you see those benchmark repos, just know, they're going to misguide you 05:42 repetitivestrain luatic: LuaJIT is generally much faster than V8 05:43 repetitivestrain i have a benchmark of a cuboid region library with tests that was translated from C into Java, LuaJIT, and JavaScript, in a straightforward line-to-line manner, and the LuaJIT version's tests complete in half the runtime required by the JavaScript version 05:44 repetitivestrain (and roughly 5x the runtime of the C/Java versions, needless to say) 05:47 repetitivestrain there is also a library named https://github.com/misode/deepslate implementing the same minecraft world generator i implemented as a Lua mapgen, and whose noise and terrain generation routines i benchmarked out of curiosity under Node.JS, yielding runtimes also roughly 4x inferior to the LuaJIT version 05:49 repetitivestrain however, i would assume that writing well-optimized LuaJIT code is far more difficult than passable Javascript which the V8 engine can optimize 05:50 MTDiscord lua static_timer.start() local x = 0 for i = 1,1000000 do x = x + 1 end static_timer.clockAndPrint() c int main() { timer_start(); int x = 0; for (int i = 0; i < 1000000; i++ { puts(" "); i++; } clock_and_print(); } 05:50 MTDiscord Holy guacamole, lua is faster than C 05:51 MTDiscord Sorry where did you import timer? 05:51 repetitivestrain e.g. a fast LuaJIT program must never have lambdas in hot paths, or calls to functions defined in C (including those with recording hooks) in positions that may yield tail calls if their callees may find themselves in a root trace 05:51 MTDiscord But also, did they happen to test that well optimized luajit code translated to fortran and compiled with flang on max opts? Things gonna get crazy 05:51 MTDiscord If you're going to post code at least post the imports? 05:51 MTDiscord I didn't import, and I'm not going to, because that's not the point of what I'm saying. And saying it is a side quest 05:51 MTDiscord I don't want to go looking through the API for stuff that should just be in code blocks 05:52 MTDiscord Well then it's optional content, and I'm not doing it 05:52 MTDiscord Exactly!! If you don't know how to time functions in lua then micro optimizations are probably a bad idea 05:53 MTDiscord I was actually talking about the C code but whatever 05:53 MTDiscord Do not ever open a C file, you will become a C programmer. No one will recover from that 05:54 MTDiscord Not if it takes me 20 minutes to compile it. 05:54 repetitivestrain hence: local function x (j) return floor (j + 0.5) end is not acceptable if x (j) might appear within a root trace, because the return from a built in to an interpreter frame will abort the entire trace and at worst prompt the containing function, and subsequently loop, to be blacklisted 05:55 repetitivestrain if you can persuade your program to run with over 95% of all code successfully compiled (as measured by -jv and which my lua mapgen does attain), its performance is guaranteed to be competitive in comparison to any other dyanmic language 05:58 repetitivestrain but the median minetest mod does not, because it will allocate closures left and right, call minetest built-in functions which require traces to be aborted and stitched (and amongst other things prevents allocation sinking, which is the foremost issue with core.get_node), and also produce copious amounts of garbage by overusing the vector API, triggering garbage collection, which gravely impacts performance 06:01 repetitivestrain you must also avoid overusing local variables and manually hoist the likes of array bounds checks out of loops with unpredictable control flow, because side traces that begin within a loop can only return to its prologue, and luajit has a novel approach to loop optimization where it unrolls one iteration of each loop to eliminate invariants, with a first prologue that is far more expensive than the remainder 06:03 repetitivestrain and also because luajit's bytecode register allocator is either poor or nonexistent and the compiler cannot join traces if it cannot assign registers to all live stack slots in both parties 06:03 repetitivestrain i.e. "NYI: register coalescing too complex" 06:04 repetitivestrain https://web.archive.org/web/20190309163035/http://wiki.luajit.org/Numerical-Computing-Performance-Guide 06:04 repetitivestrain and as it says, do ... end is very helpful in this respect too 06:13 MTDiscord Is this the same page? https://yanl.cc/luajit-wiki/Numerical-Computing-Performance-Guide.html 06:13 repetitivestrain I think so 06:14 MTDiscord Okay good. I just don't want you to have to look into the waybackmachine over and over :) 06:14 repetitivestrain this is effectively second nature to me now having struggled for months with preventing performance regressions from appearing in a lua mapgen 06:15 repetitivestrain where everything from noise to decorations is implemented in lua 06:34 [MatrxMT] the article mentions using the FFI, is that available to Luanti? 06:34 MTDiscord Absolutely not 06:34 repetitivestrain Yes, but mod security must be disabled 06:34 MTDiscord with mod security 06:34 repetitivestrain And Luajit must be configured with the FFI, which goes without saying 06:34 repetitivestrain however the ffi's 64 bit integer arithmetic is available to all mods 06:35 [MatrxMT] and is the system even set up to call into Luanti's C++ with it? or is it your own code only? 06:35 repetitivestrain your code only 06:36 repetitivestrain and that's just as well too, since the FFI is really inefficient if your code does fail to compile, and considering that even table.copy allocates lambdas i don't think most luanti mods are exactly well optimized for the jit 06:36 MTDiscord What about, something evil? 06:36 repetitivestrain NYI 06:36 repetitivestrain the jit compiler cannot compile any traces that allocate functions 06:38 MTDiscord What if you load a C pthread library and have threads in your terrain generation? so you can break up your on_generated into 5x5x5 worker threads 06:39 repetitivestrain I already use multiple emerge threads 06:39 repetitivestrain the bottleneck is now firmly luajit itself, because the control flow can become quite complex 06:39 MTDiscord I think I am accidentally suggesting to write C code to have a C world generator, run from luajit, sent to C++ 06:40 MTDiscord Control flow, BLEH 06:40 repetitivestrain https://codeberg.org/mineclonia/mineclonia/pulls/2425 e.g. the liquid system in this PR received a very substantial uplift from simply eliminating all local functions, enabling the jit compiler to compile the liquid transformation loop 06:41 repetitivestrain https://codeberg.org/attachments/1cb07d0a-c924-43e5-8a64-cdeb690bf45b 06:41 repetitivestrain Anyway, the issue with native code is one of distribution 06:41 repetitivestrain You cannot download a game with native libraries dependencies from ContentDB and expect it to function out of the box 06:42 repetitivestrain the other bottleneck is this deceptively innocuous aquifer loop 06:42 repetitivestrain https://codeberg.org/mineclonia/mineclonia/src/commit/mineclonia_mapgen/mods/MAPGEN/mcl_levelgen/aquifer.lua#L568 06:43 repetitivestrain since the input is random, fix_distances drives the jit up the wall with large unroll factors as it attempts to compile every possible combination it encounters 06:44 repetitivestrain and with a smaller unroll factor (which impacts noise and rng functions that do require large unroll factors to compile successfully) the jit succeeds in compiling it as a loop, but loop invariant optimizations are effectively useless (array bounds checks, and suchlike) because every iteration takes a side trace that returns control flow to the first iteration where none of the invariants have yet been established 06:45 repetitivestrain which all combines to render this function responsible for 17% of all map generation runtime 06:46 repetitivestrain implementing the very same function in C (just this one sorting function) and copying the results to and from lua with the FFI renders the overhead negligible, but it will be a cold day in hell when mod security is no longer a requirement... 06:47 [MatrxMT] the chances of seeing mod security have another permisison added like HTTP has for the FFI must approach 0 06:47 [MatrxMT] you'd never see it on ContentDB anyway 06:47 MTDiscord It's probably negative lol 06:49 repetitivestrain Btw, whatever became of the ambient lighting branch? 06:50 MTDiscord Sorry they're messing with the rendering engine again, didn't they already do that before the feature freeze? 06:50 repetitivestrain i am growing impatient of waiting for ambient lighting to appear upstream and I have a rudimentary prototype of ambient lighting with functional face shading and AO locally, which I intend to expose to my CSM 06:50 repetitivestrain i couldn't find any means of packing all the necessary information into existing S3DVertex 06:51 repetitivestrain the existing S3DVertex vertex format* 06:51 repetitivestrain so instead i replaced the format utilized by MapBlock meshes with an S3DVertex2TCoords (with SMeshBufferLightmaps to match) 06:52 repetitivestrain packing day and night light levels in the extra two "UVs" and moving AO into the node color's alpha in their place 06:53 repetitivestrain AO and face shading, that is 06:59 repetitivestrain which is not elegant but surprisingly virtually the same format that Minecraft employs for their nodes, even though minecraft bakes AO and shading directly into their node colors as they have no distinction between day/night AO levels 14:37 MTDiscord I am trying to do a node which will multiply fall damage when somebody fall to it and slow somebody walking over him and allows jumping. Is it possible? I am able to slow player and mobs by setting liquid_viscosity, multiply fall damage by fall_damage_add_percent group, but jumping looks to be impossible. not matter if node is walkable or not or if move_resistance is used instead liquid_viscosity. 15:12 MinetestBot 02[git] 04appgurueu -> 03luanti-org/luanti: Document & extend testing for rotation conventions (#16200) 1323bf50a https://github.com/luanti-org/luanti/commit/23bf50a07c7f21408f9738d6fc53b5f37f5ca4b1 (152025-07-13T15:11:12Z) 15:34 MTDiscord instead of using liquid_viscosity, you could try making it solid and setting the move_speed of players walking over it with a globalstep (preferably with a monoid to allow compatibility with other movement slowing things) 16:10 MTDiscord @theideegnhalist Using globalstep will require to have something like monoid for mobs too. So there is probably no easy solution. 20:11 MinetestBot bracket: Jun-17 15:15 UTC hi 20:11 MinetestBot bracket: Jun-17 18:46 UTC try using the "restore default settings" option in the bios boot screen. It should be f9 according to this old forum post. If not leave the both the cmos and laptop battery's out for a day and after hold the power button for 30s to drain every drop of juice and check to see if that help remove the power from the memory chip. 20:12 bracket ouch that is old 21:52 ilikecats Is there a way to get the minimap zoomed out really far, and locked to only view a specific place? 21:54 ilikecats Or any other map, for that matter. 21:55 ilikecats Never mind, I figured it out. 22:36 cheapie advtrains but it's on a budget: https://cheapiesystems.com/media/2025-07-13%2017-35-03.webm