Time |
Nick |
Message |
01:36 |
repetitivestrain |
!tell lhofhansl: as regards: https://github.com/luanti-org/luanti/pull/16339#issuecomment-3168986708 increasing the mapblock timeout is not sufficient unless the timeout is increased to truly extrodinary values, for it appears that mapblock usage counters are incremented when they are queued rather than when the emerge thread does in fact get around to generating them, so that even a modest amount of processing in on_generated is |
01:36 |
MinetestBot |
repetitivestrain: Do not put an : at the end of nickname |
01:36 |
repetitivestrain |
sufficient to induce generation failures if the mapblock queue is sufficiently large. furthermore block emerging should be reliable, refcounting is reliable, and a timer is not. there should never be instances of chunks being generated twice and overwriting player or mod-placed structures. |
01:37 |
repetitivestrain |
!tell lhofhansl as regards: https://github.com/luanti-org/luanti/pull/16339#issuecomment-3168986708 increasing the mapblock timeout is not sufficient unless the timeout is increased to truly extrodinary values, for it appears that mapblock usage counters are incremented when they are queued rather than when the emerge thread does in fact get around to generating them, so that even a modest amount of processing in on_generated is |
01:37 |
MinetestBot |
repetitivestrain: I'll pass that on when lhofhansl is around |
01:37 |
repetitivestrain |
sufficient to induce generation failures if the mapblock queue is sufficiently large. furthermore block emerging should be reliable, refcounting is reliable, and a timer is not. there should never be instances of chunks being generated twice and overwriting player or mod-placed structures. |
01:52 |
|
Swissa1pS joined #luanti |
02:07 |
repetitivestrain |
this line in BiomeGenOriginal::calcBiomeFromNoise is not possible to replicate in lua, as LuaPcgRandom casts the provided seed (a double) directly to an unsigned integer: const u64 seed = static_cast<s64>(pos.Y + (heat + humidity) * 0.9f); |
02:08 |
repetitivestrain |
the result of such a conversion (in LuaPcgRandom::create_object), and i think it ought to be defined to precisely this |
02:16 |
|
aliasstilltaken joined #luanti |
02:20 |
|
Can0xfBows_ joined #luanti |
02:46 |
cheapie |
Hmm... on one hand I'm back to sort of wishing there was an easy way for mods to temporarily flag their own on_globalstep stuff as "disabled" so it just gets skipped over without even entering Lua (as opposed to getting there and then returning immediately), then re-enable them when needed... but if the profiler is anything to go by, I'm chasing single-digit µs at this point, so probably not worthwhile :P |
02:47 |
cheapie |
(down under 100µs average lag with no players now, specifically it's showing 58µs... but now that it's close to 50 I want to see it under that too :P) |
02:49 |
cheapie |
This is after I modified four globalstep functions in celevator to make them return immediately if they have no work to do, instead of loading and iterating over an empty table. Shaved off a few dozen µs that way. |
04:00 |
|
MTDiscord joined #luanti |
04:49 |
|
v-rob joined #luanti |
05:49 |
|
SFENCE joined #luanti |
06:29 |
|
gregon joined #luanti |
06:29 |
|
gregon left #luanti |
06:47 |
SwissalpS |
sounds great cheapie |
08:00 |
sfan5 |
repetitivestrain: casting to double is just a math.floor tho |
08:02 |
repetitivestrain |
sfan5: sure, but the result of a math.floor is still a double, and converting a negative double into a u64 in LuaPcgRandom::create_object is undefined behavior |
08:03 |
sfan5 |
is it? isn't that just 2's-complement? |
08:03 |
repetitivestrain |
"When a finite value of real floating type is converted to an integer type other than _Bool, the fractional part is discarded (i.e., the value is truncated toward zero). >>If the value of the integral part cannot be represented by the integer type<<, the behavior is undefined" |
08:04 |
repetitivestrain |
from n1256.pdf, 6.3.1.4 |
08:04 |
sfan5 |
that's not what we're doing |
08:05 |
sfan5 |
there's a cast to s64 first, and then to u64 as soon as the variable is assigned |
08:05 |
repetitivestrain |
It is: "u64 seed = luaL_checknumber (L, 1);" |
08:05 |
repetitivestrain |
in LuaPcgRandom::create_object (lua_State *L) |
08:05 |
sfan5 |
<repetitivestrain> this line in BiomeGenOriginal::calcBiomeFromNoise is not possible to replicate in lua, as LuaPcgRandom casts the provided seed (a double) directly to an unsigned integer: const u64 seed = static_cast<s64>(pos.Y + (heat + humidity) * 0.9f); |
08:05 |
sfan5 |
I am replying to this |
08:05 |
repetitivestrain |
the excerpt i posted is from the biome system, which performs the conversion correctly |
08:06 |
repetitivestrain |
yes, that's from BiomeGenOriginal, which is implemented correctly and hence in a manner i can't reproduce in lua |
08:06 |
repetitivestrain |
because the conversion in LuaPcgRandom::create_object is undefined |
08:06 |
[MatrxMT] |
<birdlover32767> you can also use core.get_translated_string and core.strip_colors for that |
08:07 |
sfan5 |
ah, I see |
08:08 |
sfan5 |
feel free to send a patch then |
08:08 |
sfan5 |
but I don't volunteer to forward it |
08:36 |
|
SFENCE joined #luanti |
08:50 |
|
SFENCE joined #luanti |
08:57 |
|
YuGiOhJCJ joined #luanti |
09:08 |
|
Trifton_ joined #luanti |
09:24 |
|
Trifton_ joined #luanti |
09:41 |
|
mrkubax10 joined #luanti |
10:05 |
pgimeno |
repetitivestrain: undefined how? |
10:05 |
repetitivestrain |
"When a finite value of real floating type is converted to an integer type other than _Bool, the fractional part is discarded (i.e., the value is truncated toward zero). >>If the value of the integral part cannot be represented by the integer type<<, the behavior is undefined" |
10:05 |
repetitivestrain |
it is simply undefined |
10:06 |
repetitivestrain |
or as the expression used to read, liable to evoke demons in your nose |
10:07 |
pgimeno |
oh sorry, I thought it had an intermediate signed int |
10:07 |
repetitivestrain |
no, i was speaking of the Lua PcgRandom interface |
10:08 |
repetitivestrain |
the conversion in the biome system is performed correctly, and it is what i cannot reproduce in lua without also reimplementing PcgRandom in lua, which i am understandably loath to do |
10:09 |
sfan5 |
you will find that 90% of effort is needed to bridge the 10% gap between "good enough" to "it's exactly the same" |
10:10 |
repetitivestrain |
i'm aware, and i speak from plenty of experience with these undertakings, having just completed attaining "exactly the same" with _minecraft's_ map generator in lua |
10:10 |
pgimeno |
what's the range of numbers expected in that luaL_checknumber? are negative seeds accepted? |
10:11 |
repetitivestrain |
by comparison with which Luanti is a walk in the park |
10:11 |
repetitivestrain |
when all of the source code is available and my only concern is reducing duplication |
10:12 |
repetitivestrain |
pgimeno: negative seeds are definitely provided to the C++ PcgRandom (after being cast to u64) |
10:12 |
|
mrkubax10 joined #luanti |
10:13 |
pgimeno |
well, that doesn't mean you need to support them, I guess you can do with supporting positive seeds and doing a best effort at guessing what most compilers will do with negative seeds |
10:15 |
repetitivestrain |
pgimeno: the problem is that a negative two's complement integer cannot be represented in unsigned form as a lua_Number without incurring loss of precision |
10:15 |
|
YuGiOhJCJ joined #luanti |
10:15 |
sfan5 |
neither can an s64 for that matter |
10:16 |
repetitivestrain |
correct, but the seed for the biome sampler's PcgRandom is real anyway |
10:16 |
pgimeno |
repetitivestrain: well, I'd add a caveat that due to UB, negative seeds are not guaranteed to give the same results, and call it a day |
10:17 |
repetitivestrain |
pgimeno: i'd apply this: https://paste.debian.net/1390492 (untested) |
10:18 |
pgimeno |
that wouldn't solve anything for your case |
10:18 |
pgimeno |
it would solve the UB |
10:18 |
repetitivestrain |
why wouldn't it? it's precisely what calcBiomeFromNoise does |
10:18 |
pgimeno |
but a seed of -1 would still result in a number that can't be represented in a double |
10:18 |
|
jaca122 joined #luanti |
10:19 |
repetitivestrain |
oh, i would not have to represent two's complement integers as doubles with this change at all |
10:20 |
repetitivestrain |
i'd simply create a PcgRandom (roundf32 (posy + (heat + humidity) * roundf32 (0.9))) |
10:31 |
pgimeno |
I'm struggling to see what difference the patch makes with respect to this: <repetitivestrain> pgimeno: the problem is that a negative two's complement integer cannot be represented in unsigned form as a lua_Number without incurring loss of precision |
10:31 |
pgimeno |
also, I wouldn't accept that patch as is |
10:32 |
repetitivestrain |
pgimeno: the ability to pass a negative value to the PcgRandom constructor and have it truncated towards zero, e.g. PcgRandom (-1.0004) = PcgRandom (-1L) |
10:32 |
repetitivestrain |
-1LL* |
10:39 |
|
mrkubax10 joined #luanti |
11:32 |
|
Desour joined #luanti |
13:21 |
|
definitelya joined #luanti |
13:28 |
|
jaca122 joined #luanti |
13:38 |
|
___nick___ joined #luanti |
13:59 |
|
mrkubax101 joined #luanti |
14:26 |
|
___nick___ joined #luanti |
14:29 |
|
___nick___ joined #luanti |
15:01 |
|
silverwolf73828 joined #luanti |
15:58 |
|
Noisytoot joined #luanti |
16:26 |
|
zleap joined #luanti |
16:43 |
|
fluxionary joined #luanti |
17:27 |
|
illwieckz_ joined #luanti |
17:35 |
cheapie |
These fancy electronic speed limit signs don't seem very reliable: https://cheapiesystems.com/media/2025-08-09%2012-31-56.webm |
17:54 |
|
v-rob joined #luanti |
18:02 |
|
gregon joined #luanti |
18:05 |
|
gregon left #luanti |
19:27 |
|
v-rob joined #luanti |
19:30 |
|
chilledfrogs joined #luanti |
19:34 |
|
SFENCE joined #luanti |
19:36 |
|
SFENCE joined #luanti |
20:09 |
|
SFENCE joined #luanti |
20:11 |
|
SFENCE joined #luanti |
20:39 |
|
SFENCE joined #luanti |
22:03 |
|
Kimapr_ joined #luanti |
22:07 |
|
Trifton2 joined #luanti |
22:18 |
|
ireallyhateirc joined #luanti |
22:32 |
|
panwolfram joined #luanti |
22:35 |
|
bdju joined #luanti |
23:05 |
|
Eragon joined #luanti |