Time Nick Message 17:37 GreenDimond Why does the night and day values of a mapnode being equal mean that it is near the surface? (Referencing https://github.com/minetest/minetest/blob/5.1.1/src/clientiface.cpp#L335) 17:40 Krock GreenDimond: it means that it's exposed directly to sun light 17:40 Krock no torches around 17:41 GreenDimond But couldnt they be equal in other situations? 17:41 GreenDimond Oh right no 17:41 GreenDimond day bank is always 15 if exposed to the sky regardless of time 17:41 Krock yes 17:42 Krock it's true unless the mapblock light is corrupted 17:42 GreenDimond Does the time of day affect the night lightbank? 17:42 Krock no, the time of day is only used to calculate light levels for a certain node in-game 17:43 GreenDimond That.. doesnt answer my question 17:43 Krock > no 17:44 GreenDimond Followed by > used to calculate light levels for a certain node in-game 17:44 Krock *only* used 17:44 GreenDimond the light levels in each node are made up of a day and night lightbank 17:44 Krock yes, and these are used to calculate the brightness of faces, and for the Lua API 17:45 GreenDimond Right 17:45 Krock light banks are only caches which are later used to calculate the current light value 17:46 GreenDimond Yes 17:46 GreenDimond So time of day affects the light banks? How? 17:46 GreenDimond Or am I seriously misunderstanding 17:46 Krock No, it doesn't. 17:46 GreenDimond Ok so light banks are independent of time of day 17:46 Krock daylight + nightlight + time of day = current light of a node 17:47 GreenDimond and time of day is factored in when doing the shading 17:47 Krock day and night light are timeless 17:48 GreenDimond Alright, I think I get it now. 17:48 GreenDimond Also, why is it called a "bank"? They should be LightTypes, no? 17:48 Krock different programmers, different terminologies. 17:48 Krock there's actually a class to properly implement those, but it's only used in a few places 17:49 Krock what bothers me is that the "current light level" and the banks are both u8 values, hence easy to confuse 17:51 GreenDimond Yeah im currently rewriting the lighting system 17:51 GreenDimond and adding support for colored lighting 17:51 GreenDimond I would like to know where this class is .. should I be converting everything to use those? 17:54 Krock content_mapblock.h LightPair 17:54 Krock but I suspect that's for already transformed light levels 17:55 Krock after the 0..15 value is calculated for the current time, it's then looked up in an array to get a value from 0..255 for screen brightness 17:55 Krock and it's again an u8 17:58 GreenDimond Yeah thats client side 17:58 GreenDimond But I will be changing that too 18:04 GreenDimond Currently im still working on changing the server side stuff 18:06 GreenDimond I've changed the LightBank to a LightType enum of LIGHTTYPE_SKY/R/G/B, rather than day and night. Once I change getLightBanks and getLightBlend, ill work on making changes to all the files where the light touches (ha). 18:06 GreenDimond Also, param1 will now be a u16 with the first 4 bits for sky light and the last 16 for color 18:07 GreenDimond Which means I get to do some conversions to prevent breakage 18:07 DS-minetest the last 12* 18:08 GreenDimond yes sorry 20:02 GreenDimond How do I enable tracebacks? 20:03 sfan5 "enable"? 20:03 GreenDimond Im getting a bad alloc exception but it doesnt tell me where from 20:04 sfan5 from Lua or what? 20:04 sfan5 in either case use a debugger 20:05 GreenDimond The engine 20:06 GreenDimond alright, will try that 20:12 GreenDimond Maybe this is a stupid question, but how am I supposed to use the information GDB gives me? All I got was a bunch of threads and at the end a method and file:line. Is the method and line number what I should be looking at? Because I havent even remotely touched the file its giving me. 20:14 sfan5 which gdb command did you enter? 20:14 GreenDimond run 20:16 GreenDimond I may be using GDB entirely wrong-- I've never used a debugger before. 20:21 sfan5 oh I misinterpreted your description 20:22 sfan5 the method and file:line at the end is the place it crashed 20:22 jonadab There are other, more advanced things you can do with a debugger, but start with getting a backtrace, and then with learning how to interpret a backtrace. 20:22 sfan5 but since std::bad_alloc means it ran out of RAM, that is not necessarily the place where too much memory was allocated 20:23 GreenDimond got a completely different file:line the second time 20:23 GreenDimond backtrace doesnt seem very helpful 20:24 GreenDimond (I mean the command is helpful but the result doesnt help me) 20:25 GreenDimond Though I might know why its running out of memory 20:26 GreenDimond The crash happens when I place a light source, so the light spread is probably doing something screwy 20:27 GreenDimond Ooh. I placed a light source in a smaller room and it didnt crash (but it did take a long time to place) 20:27 jonadab There are some types of bugs where backtrace is of limited assistance, granted. 20:28 jonadab There's also valgrind. 20:28 jonadab If you suspect a memory leak, valgrind is how you track those down. 20:28 jonadab Learning to use valgrind is "fun". 20:28 p_gimeno sounds like a very deep recursion 20:29 GreenDimond I think the light spread is checking something that I changed and isnt satisfied properly 20:35 GreenDimond Also I messed up the natural vs artificial lighting but Ill fix that *after* I fix the light spreading 20:48 GreenDimond I fixed it! 20:48 GreenDimond Was missing a handler in getLightr 20:48 GreenDimond -r