Luanti logo

IRC log for #luanti, 2025-07-13

| Channels | #luanti index | Today | | Google Search | Plaintext

All times shown according to UTC.

Time Nick Message
00:08 SFENCE joined #luanti
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:17 jistr joined #luanti
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:38 Trifton joined #luanti
00:38 SFENCE joined #luanti
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.
01:01 SFENCE joined #luanti
01:35 SFENCE joined #luanti
02:09 SFENCE joined #luanti
02:33 aliasstilltaken joined #luanti
02:44 MTDiscord <corarona> 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
02:55 SFENCE joined #luanti
03:04 FileX joined #luanti
03:29 sparky4 joined #luanti
03:30 SFENCE joined #luanti
03:39 SFENCE joined #luanti
03:43 FileX joined #luanti
04:00 MTDiscord joined #luanti
05:36 FileX joined #luanti
05:41 MTDiscord <jordan4ibanez> 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 <jordan4ibanez> 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 <jordan4ibanez> Holy guacamole, lua is faster than C
05:51 MTDiscord <redundantcc> 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 <jordan4ibanez> 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 <redundantcc> If you're going to post code at least post the imports?
05:51 MTDiscord <jordan4ibanez> 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 <redundantcc> I don't want to go looking through the API for stuff that should just be in code blocks
05:52 MTDiscord <redundantcc> Well then it's optional content, and I'm not doing it
05:52 MTDiscord <jordan4ibanez> Exactly!! If you don't know how to time functions in lua then micro optimizations are probably a bad idea
05:53 MTDiscord <redundantcc> I was actually talking about the C code but whatever
05:53 MTDiscord <jordan4ibanez> Do not ever open a C file, you will become a C programmer. No one will recover from that
05:54 MTDiscord <redundantcc> 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:57 SFENCE joined #luanti
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:02 Loveaabb joined #luanti
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 <jordan4ibanez> Is this the same page? https://yanl.cc/luajit-wiki/Numerical-Computing-Performance-Guide.html
06:13 repetitivestrain I think so
06:14 MTDiscord <jordan4ibanez> 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:14 gregon joined #luanti
06:15 repetitivestrain where everything from noise to decorations is implemented in lua
06:31 SFENCE joined #luanti
06:34 [MatrxMT] <Blockhead256> the article mentions using the FFI, is that available to Luanti?
06:34 MTDiscord <jordan4ibanez> Absolutely not
06:34 repetitivestrain Yes, but mod security must be disabled
06:34 MTDiscord <jordan4ibanez> 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] <Blockhead256> 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 <jordan4ibanez> What about, something evil?
06:36 repetitivestrain NYI
06:36 repetitivestrain the jit compiler cannot compile any traces that allocate functions
06:38 MTDiscord <jordan4ibanez> 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 <jordan4ibanez> 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 <jordan4ibanez> 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] <Blockhead256> the chances of seeing mod security have another permisison added like HTTP has for the FFI must approach 0
06:47 [MatrxMT] <Blockhead256> you'd never see it on ContentDB anyway
06:47 MTDiscord <jordan4ibanez> It's probably negative lol
06:49 repetitivestrain Btw, whatever became of the ambient lighting branch?
06:50 MTDiscord <redundantcc> 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
07:06 SFENCE joined #luanti
07:10 jaca122 joined #luanti
07:21 YuGiOhJCJ joined #luanti
07:24 jaca123 joined #luanti
07:34 FileX joined #luanti
07:41 SFENCE joined #luanti
08:16 SFENCE joined #luanti
08:17 jaca122 joined #luanti
08:22 jaca122 joined #luanti
08:22 Warr1024 joined #luanti
08:25 jaca122 joined #luanti
08:36 SFENCE joined #luanti
08:43 jaca123 joined #luanti
08:47 Warr1024 joined #luanti
08:59 jaca122 joined #luanti
09:25 Cork joined #luanti
09:37 FileX joined #luanti
09:42 mrkubax10 joined #luanti
09:44 TheMaster joined #luanti
10:04 SFENCE joined #luanti
10:52 turtleman joined #luanti
10:52 SFENCE joined #luanti
11:12 jaca122 joined #luanti
11:12 SFENCE joined #luanti
11:57 mrkubax10 joined #luanti
12:07 SFENCE joined #luanti
12:10 mrkubax10 joined #luanti
12:13 SFENCE joined #luanti
12:15 Can0xfBows joined #luanti
12:19 jaca122 joined #luanti
12:29 cheek_pain joined #luanti
12:33 SFENCE joined #luanti
12:40 SFENCE joined #luanti
12:47 SFENCE joined #luanti
12:57 mrkubax10 joined #luanti
13:00 SFENCE joined #luanti
13:08 swee- joined #luanti
13:12 jaca122 joined #luanti
13:15 SFENCE joined #luanti
13:28 jaca122 joined #luanti
13:36 ineva joined #luanti
13:37 SFENCE joined #luanti
13:39 SFENCE joined #luanti
14:08 jaca122 joined #luanti
14:14 SFENCE joined #luanti
14:16 jaca122 joined #luanti
14:37 MTDiscord <sfence> 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.
14:43 SFENCE joined #luanti
14:47 SFENCE joined #luanti
15:09 jaca122 joined #luanti
15:12 MinetestBot [git] appgurueu -> luanti-org/luanti: Document & extend testing for rotation conventions (#16200) 23bf50a https://github.com/luanti-org/luanti/commit/23bf50a07c7f21408f9738d6fc53b5f37f5ca4b1 (2025-07-13T15:11:12Z)
15:34 MTDiscord <theidealist> 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)
15:53 Talkless joined #luanti
15:59 silverwolf73828 joined #luanti
16:04 SFENCE joined #luanti
16:10 MTDiscord <sfence> @theideegnhalist Using globalstep will require to have something like monoid for mobs too. So there is probably no easy solution.
16:21 SFENCE joined #luanti
16:28 SFENCE joined #luanti
16:34 sparky4 joined #luanti
17:06 SFENCE joined #luanti
17:10 mrkubax10 joined #luanti
17:15 Desour joined #luanti
17:21 ireallyhateirc joined #luanti
18:07 SFENCE joined #luanti
19:11 jaca122 joined #luanti
19:12 qqe joined #luanti
19:40 swee joined #luanti
19:45 SFENCE joined #luanti
19:54 SwissalpS joined #luanti
20:11 bracket joined #luanti
20:11 MinetestBot bracket: Jun-17 15:15 UTC <MTDiscord> hi
20:11 MinetestBot bracket: Jun-17 18:46 UTC <MTDiscord> 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
20:17 bracket joined #luanti
20:19 SFENCE joined #luanti
20:51 SFENCE joined #luanti
21:24 SFENCE joined #luanti
21:28 repetitivestrai- joined #luanti
21:49 SFENCE joined #luanti
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:02 ireallyhateirc joined #luanti
22:03 kimapr joined #luanti
22:24 SFENCE joined #luanti
22:34 panwolfram joined #luanti
22:36 cheapie advtrains but it's on a budget: https://cheapiesystems.com/media/2025-07-13%2017-35-03.webm
22:58 SFENCE joined #luanti
23:05 Eragon joined #luanti
23:27 SFENCE joined #luanti
23:33 FileX joined #luanti
23:39 Sompi joined #luanti

| Channels | #luanti index | Today | | Google Search | Plaintext