Time Nick Message 00:00 Taoki Can't be the same thing though... that's from 2010. No one would have left a bug like this unfixed for 3 years x.x 00:02 Taoki http://irrlicht.sourceforge.net/forum//viewtopic.php?p=212465 00:03 Taoki Wait... 00:03 Taoki PilzAdam: By any chance, does Minetest still send mapblocks each frame to the GPU when this is enabled? 00:03 Taoki Or only once when they're loaded or updated? 00:04 PilzAdam ummm.... 00:05 Taoki The last link I posted is a story about that. Seems it's not an Irrlicht bug, and someone else who got this was sending the mesh each frame while VBO was enabled 00:05 Taoki PilzAdam: Another interesting function is mentioned, also: driver->updateAllHardwareBuffers() It's said it might solve the issue if called at the right time 00:06 Taoki That might be better than the buffer loop we used at first (or together with it) 00:07 Taoki "updateAllHWBuffers is called in endScene, which means it is called at least once per frame, for RTTs even more often." ---- "But at least we don't have any mem leak here, since the link is automatically removed during the app run, or at least at the end in the driver destructor." 00:07 kahrl updateAllHardwareBuffers is a function in CNullDriver and it can't be called from outside 00:07 Taoki ahh :/ 00:08 Taoki No way to get cnulldriver in mapblock_mesh? 00:09 kahrl CNullDriver is the base class of every implementation of IVideoDriver 00:09 kahrl but you can't include its header file 00:09 kahrl you could walk the vtable by hand, I guess 00:09 Taoki ok 00:10 Taoki PilzAdam: So I think the first step is to check if Minetest still spams mapblocks every frame to the GPU (if yes that's likely it). Another thing to try is somehow calling updateAllHardwareBuffers which could be a likely fix, if we manage get to it 00:11 kahrl uhm 00:11 kahrl endScene calls that anyway so it wouldn't be a fix 00:12 Taoki It's not in the minetest source. The later thread described that as a fix I think 00:18 kahrl wait... how does this even work 00:18 Taoki kahrl: http://irrlicht.sourceforge.net/forum//viewtopic.php?p=212465 (someone who seems to have had our story, or at least similar) 00:19 kahrl I saw that 00:19 kahrl okay... someone explain to me how this works 00:20 Taoki Haven't fully understood it myself. But the guy at the end said that solved it so :P 00:20 kahrl animations such as torches make changes to the mesh every few frames 00:20 kahrl but nothing ever calls IMeshBuffer::setDirty 00:20 kahrl so the VBO would contain outdated mesh data 00:21 kahrl still, when I enabled the EHM_STATIC flag torches showed up fine 00:21 Taoki I think torches animate fine. I'll check 00:21 Taoki ah, ok 00:23 kahrl well this is a bad example because this only changes materials 00:23 kahrl which are handled outside of the VBO 00:23 kahrl (I think) 00:23 Taoki Animated torches and water work fine for me, so no issues there 00:24 kahrl does day-night transition work when shaders are disabled and VBO is enabled? 00:25 Taoki will check 00:25 PilzAdam only some blocks get darker 00:25 PilzAdam (only the ones that are more far away from the player) 00:26 PilzAdam (looks really weird) 00:26 PilzAdam when moving arround then the blocks get updated 00:26 Taoki Yep. It works but MUCH slower and some areas remain darker 00:27 PilzAdam Taoki, this means it doesnt work ;-) 00:27 Taoki I guess :P 00:29 Taoki I need to go now, pretty late. Anything else I can do before I leave to help with this? 00:29 Taoki Really wouldn't wanna see the feature not make it ;( 00:30 kahrl adding "buf->setDirty();" in the place where MapBlockMesh::animate() does day-night transition fixes it, as expected 00:31 Taoki Awesome! Means the memory leak is the only remaining issue 00:31 kahrl actually I guess that could have a EBT_VERTEX parameter 00:33 PilzAdam that doesnt fix the leak, though 00:34 kahrl right 00:34 kahrl anyway I tested "buf->setDirty(irr::scene::EBT_VERTEX);" and it works as well 00:36 Taoki PilzAdam: Random idea (3:30 am and more and more tired): Could you add a debug print specifying the memory of each map block? That could be used to determine if the memory leak is caused by that, if it prints out more and more memory entrioes 00:36 kahrl perhaps add a comment in animate() that tells people to add setDirty calls if they are needed 00:37 Taoki eg: If each mapblock call prints 10 MB each second, we know it leaked 100 mb in 10 seconds 00:37 kahrl Taoki: how would that number be calculated? 00:38 Taoki Right. If that's not possible, we can add a simple debug print. Then have the minetest console on one side, and the memory viewer in another. We can notice if the debug print is always printed the moment memory increase spermanently 00:38 kahrl irrlicht makes it hard to get the amount of video memory allocated for VBOs 00:38 Taoki *increases permanently 00:38 Taoki spermanently LOL 00:42 Taoki But interestingly, I feel the removeHardwareBuffer doesn't decrease the leaks for me. Maybe something is going wrong there, or something else is needed 00:43 Taoki Leaks seem to be the same for me both with and without that 00:47 PilzAdam are you sure about that? 00:47 Taoki Not 100% but I got that impression 00:47 Taoki I'll test once more before I leave 00:48 Taoki Seems that when I'm not removing the buffers, VBO improves performance even more 00:50 PilzAdam I think that the leak worse when not cleaning up the hardware buffer 00:50 PilzAdam +is 00:50 Taoki Ok, I think it is a little bit worrse without clearing the buffers 00:51 Taoki But for some reason, not clearing the buffers gives even faster FPS 00:52 Taoki Well no, it doesn't make it faster actually. Those things are hard to tell 00:52 Taoki Seems to be as fast in both cases. But yeah without the buffer clearing the leak is even worse, so I was wrong 00:53 Taoki Or maybe halfway wrong; When clearing the buffers, there's a very discrete jitter as you move around. 00:53 Taoki **look around 00:53 Taoki That's why it felt faster. It jitters a little bit, probabiy because of having to re-buffer every now and then 00:56 Taoki Time for me to head off. Night and good luck... I'm hopeful this has a solution that will soon be found 03:36 kaeza hmmmm, the sources related to Lua entities may be of help 03:37 kaeza i.e. you can store values in them (not directly, but thru the table returned by get_luaentity()) 03:37 kaeza and the `object' field of such table points back to the userdata 03:37 hmmmm hey, uh, can you call a zero-argument function without parentheses? 03:38 kaeza I don't think so 03:38 kaeza it would be ambiguous 03:39 VanessaE only if it's part of a callback e.g. on_place = foo, 03:39 hmmmm that's an assignment 03:39 VanessaE yep I know. 03:39 VanessaE only place I've ever seen it done though. 03:40 kaeza VanessaE, "foo = bar" != "foo = bar()" 03:40 kaeza the former increments a reference to a function 03:40 kaeza the latter assigns foo the value returned by the function call 03:40 hmmmm literally every single example i've read talks about how to assign methods 03:41 hmmmm i know how to do what i want to do, but it's really ugly 03:41 hmmmm set __index to my own handler, manually check for the fields i want to set, and so on 03:41 hmmmm okay, this turned out to not be worth it 03:42 hmmmm i'm doing all this stuff for basically no advantage except slightly uglier syntax 03:43 kaeza well, another way would be thru accessor methods 03:43 kaeza a-la Java 03:43 hmmmm that's what the consensus is 03:44 hmmmm if you need to get or set a member value, you use a method instead of setting the actual field of that object 03:44 hmmmm but yeah, i'm giving up on this.... i just blew like an hour reading lua documentation and i got almost nowhere 03:46 kaeza what are you trying to do? 03:46 hmmmm git checkout src/script/lua_api/l_vmanip.cpp 03:46 hmmmm that's what i'm doing 03:46 VanessaE hmmmm: if by 'documentation' you mean the PiL, I'm not surprised you had to give up. :) 03:47 hmmmm vanessae, i think what i'm trying to do is quite a bit more obscure as well 03:47 VanessaE perhaps 03:47 hmmmm wanted to directly get/set fields of the current class 03:47 hmmmm so you can do vm.data[index] = c or whatever 03:48 hmmmm instead of having to handle three return values from read_chunk 03:48 VanessaE if you're passing multiple fields, is there a reason you can't just pass/return a table? 03:50 hmmmm it just doesn't make sense from a style point of view as well as functional 03:50 VanessaE well I dunno about that. 03:50 VanessaE such a thing is quite easy to read and code for, from the Lua side anyway 03:50 kaeza hmmmm, so vm is the VoxelManip, and it's an userdata? 03:51 hmmmm yeah 03:51 kaeza how about: local t = vm:get_data(); vm:set_data(t) ? 03:51 hmmmm because that defeats the purpose of it all 03:52 kaeza ah derp 03:53 hmmmm i'm done with it, anyway 03:55 kaeza getting fields thru a metatable is no faster than calling a method 03:59 hmmmm also i dunno if anybody noticed it but my fast lighting makes water a shade too bright 04:00 VanessaE hmmmm: I have noticed unexplained variances in water lighting, yes. 04:00 VanessaE (whether your lighting code is the cause, I dunno) 04:05 kahrl VanessaE: I've seen those as well 04:05 kahrl example: go to an ocean, grab a water node with a bucket, place it back 04:05 VanessaE yes 04:05 VanessaE I've done/noticed that 04:06 VanessaE pointed it out once, with screenshot (probably in #minetest though) 04:06 VanessaE didn't file a github issue at the time probably out of frustration. 04:06 hmmmm frustration? it's really that horrible? 04:07 hmmmm it's a game 04:07 VanessaE hmmmm: not with the game, likely with someone or another in the channel at the time. 04:08 VanessaE you know how it is, someone pisses you off about some random subject (or just acts like an ass in general), you get distracted and opt not to do things you'd otherwise have done at the time. 10:08 Taoki Back. Seems the memory leak issue wasn't fixed since yesterday. I'll try to test it myself more just in case during today 10:09 Calinou I don't notice any memory leak when playing, personally 10:09 Calinou sapier fixed a lot recently 10:10 Taoki Calinou: We're testing a new feature which enables the use of vertex buffers and improves performance hugely 10:10 Taoki That's what's leaking and it didn't go upstream yet for that reason 10:16 Calinou oh, finally VBOs 10:16 Calinou there are, but it eats a lot of RAM, already tried 10:16 Calinou c-fifty-five told me that :P 10:22 Taoki Calinou: That's the problem we're trying to solve 11:54 Taoki PilzAdam: Can I ask a big favor regarding schematics? Would it be acceptable to add a third parameter to minetest.create_schematic() specifying angle? I'm adapting my structures mod to use this, and it works perfectly well but I can't use any angles. 11:54 Taoki 0, 90, 180 or 270 11:55 Taoki Surely other mods could use this too, there can be many cases in which you'll want to import schematics at various angles 11:55 PilzAdam I have nothing todo with it, ask hmmmm 11:55 Taoki Ah, ok 12:14 Taoki PilzAdam: When can we get to debugging that memory leak again, if you're not busy? 12:14 Taoki I have time about 2 hours from now until I have too go for a few hours, then I'll be back. So I can now 12:16 PilzAdam I read in the Irrlicht forums that it needs some time until the memory is freed 12:19 Taoki Interesting. So maybe it's normal that it works like that? Why is only Minetest getting such big memory usage with it and not other applications though? 12:20 Taoki There has to be something wrong and that can be fixed in Minetest too 12:20 PilzAdam client_unload_unused_data_timeout = 30 in minetest.conf seems to stop it 12:21 Taoki Hehe, it was that easy after all 12:21 Taoki I was partly right that Minetest still sending (or not lunloading) things on its own was a cause 12:22 Taoki PilzAdam: And reason why that can't be defaulted to 30? If it can it should all be fine then 12:22 PilzAdam this is not useable for laggy servers 12:23 Taoki 30 seconds is way more than enough to keep unused data in the client 12:23 Taoki hmm... 12:23 PilzAdam default is 10 minutes 12:23 Taoki That sounds more than enormous 12:24 Taoki How laggy would a server have to be to require clients keep unloaded data more than 30 seconds though? I don't think that would be any worse than just exploring in one direction after you log in, so it shouldn't make a difference 12:26 Taoki Many players go exploring for example, so for them the server lag applies either way. This only helps players that go back and forth a lot and roam around the same area for very long amounts of time. 12:26 Taoki It would be safe to assume that if someone leaves an area for a 60 seconds for example, they might not be coming back 12:29 VanessaE the solution to that is simple: have the client cache the map data that is received during the current session. The server sends change events anyway, right? 12:29 Taoki That could work too 12:29 VanessaE cache on disk I mean. 12:30 Taoki VanessaE: Imagine if we did that even after leaving a server, and the client would stor eper-server caches on drive. The world would load instantly when I'd come to your server, and only changes would be applied if needed :) 12:30 VanessaE yep 12:30 VanessaE create some kind of limit on the total size of the cache (google earth for example limits it to 2GB) and it should work. 12:31 Taoki PilzAdam: For now, would it be acceptable to commit the VBO setting (disabled by default) with a note that you must set client_unload_used_data to very low values? 12:32 Taoki PilzAdam: Or, in the Minetest code, we could add a limit to the unload values when the VBO option is enabled. Though that would kinda suck and the minetest.conf comment would be best 12:33 PilzAdam with 120 Minetest takes about 900 MiB RAM for me 12:34 Taoki Hmm... not bad I guess. Anyone woith a video card that properly supports VBO should have way more than $GB of ram at this day 12:34 Taoki *4GB 12:34 Taoki I prolly won't set that past 60 myself, don't see how it could help me even on a laggy server (theoretically I can, but not in practice) 12:36 Taoki Personally I'd say default it to a minute without any worries 12:37 VanessaE I'd opt for 20 seconds, perhaps even less, if the world were cached on the client. 12:38 Taoki I'd opt for 30 seconds even without client caching, but like PilzAdam said some servers can be laggy, so 60 should be fine in current circumstances 12:38 VanessaE true 12:38 Taoki I mean, if you leave an area for 60 seconds it's most likely you left it permanently / for a while 12:39 Taoki Not always the case, but I think that tends to be the more likely scenario 12:39 PilzAdam there is no reason to decrease that setting if vbo is off 12:39 Taoki PilzAdam: What about splitting the setting? One is applied with VBO, the other without it 12:40 Taoki client_unload_unused_data_timeout_normal, client_unload_unused_data_timeout_vbo 12:40 Taoki Not the prettiest way but it sounds like that works best 12:42 Taoki The real solution though would indeed be caching. Minetest shouldn't send every piece of unused data to the video card 14:26 Taoki PilzAdam: Got to go for an hour or two soon. Did you find a way to properly divide that setting? 14:26 PilzAdam we shouldnt devide that setting 14:26 PilzAdam no other settings do this 14:26 PilzAdam a note is enough, I guess 14:30 Taoki I agree 14:36 Taoki BBL in 1-2 hours or so. Will test this once I'm back if it's upstream (hopefully there are no more problems now and it should work at last) 14:37 Taoki Disabled by default of course 17:10 Taoki hmmm: I added support for using the schematics system to my structures mod. It's a lot faster, and this is even more correct for buildings than the upcoming voxel manipulator! So I'd like to use it permanently... but there are a few issues I was curious about. 17:10 Taoki Wall, mostly one that's urgent: Will minetest.place_schematic support different angles (0, 90, 180, 270)? 17:10 Taoki That's the main thing that's keeping me from being able to use it by default 17:16 sfan5 Taoki: you could rotate the schematic file before placing it with lua 17:17 sfan5 you would need LuaZlib to decompress and recompress the data however 17:17 Taoki sfan5: Doesn't work for what I need. If it requires editing or exporting the actual file itself that way 17:17 Taoki No, that would be a really bad way 17:23 celeron55 to me it sounds like rotations should be supported in some way, dunno how exactly 17:24 celeron55 there are also fun things like facedirs that go with it that hmmmm will hate to even think about 8) 17:24 hmmmm taoki, i already responded to this same question twice, and the answer is still yes 17:25 hmmmm there will only be 4 rotations supported, vertical rotations 17:25 Taoki Oh, ok. Yes, sounds great 17:25 hmmmm but see the thing is, i'm not doing that right now, i'm doing something different 17:25 Taoki hmmmm: There would be only one concern left: Will there be a way to know the size of a schematic before spawning it? That's a check I really need in my mid 17:26 Taoki that's ok :P 17:26 hmmmm nope 17:26 hmmmm i guess you could read the file directly 17:26 Taoki That works too, if there's a Lua function to do it 17:26 Taoki Or a mix that would work 17:26 hmmmm no, i am thinking completely lua 17:27 sfan5 the is v3s32 right? 17:27 sfan5 +size 17:27 hmmmm i am not going to add an api to do something as trivial as extracting the size 17:27 hmmmm why would it be v3s32? 17:27 sfan5 dunno 17:27 PilzAdam hmmmm, is the information about the size in the file uncompressed/directly readable? 17:27 sfan5 PilzAdam: yes 17:27 hmmmm pilzadam, the file format is clearly documented, and everything is easy to retreive except the actual compressed data 17:28 sfan5 only the node data is compresses 17:28 sfan5 -s +d 17:28 Taoki Nice. It should be possible to have a function that reads it from the file then 17:29 PilzAdam hmmmm, and where is that documentation? 17:29 hmmmm in the source, and somebody probably put it up on the developer wiki 17:29 PilzAdam "clearly documented" == "read the source"? ok, lets rm lua-api.txt then 17:29 Taoki That weird scenario where documentation means reading the source code :P 17:30 hmmmm it's meant to be opaque to lua, but maybe it shouldn't be if you'd like to do things such as this 17:31 hmmmm i guess it doesn't hurt to just make a page about minetest schematics on the developer wiki with the comment that describes the file format 17:34 Taoki PilzAdam: Oh, and do any of the devs actually want a skydome system upstream? Like I told RBA, I find the concept really bad. Mostly cuz if I remember right, it involved an inside-out sphere mesh following the player around. 17:34 Taoki Which is the scariest implementation for a sky ever 17:36 PilzAdam dunno 17:36 Taoki If we really want a skydome / cubemap sky, I believe it needs to be done properly; The shape (cube or sphere) should be generated in the code, no mesh file. It should also have no distance (unlimited distance) instead of following the player around 17:36 Taoki Ok. I'll talk to RBA about it again perhaps. 17:37 Taoki This is one of the few things I really wouldn't wanna see happening. Because the architecture and idea is very wrong. Even if again I appreciate RBA's work on it 17:38 Taoki Really really bad hack for a sky. We'd instead want a way to map the sky image to the background / nothingness of the Irrlicht scene 17:38 Taoki Which should be rather easy 17:38 Taoki Well, I think. Don't know exactly how Irrlicht does it 17:38 sfan5 Taoki: http://pastebin.com/g6r7YMJD 17:39 Taoki sfan5: Nice. That can read the X Y Z size of the schematic file? 17:39 sfan5 yes 17:39 sfan5 it "should" 17:39 sfan5 I haven't tested it 17:39 Taoki ok. Thanks 17:41 hmmmm do note that the node name table isn't too far away from what you just wrote 17:42 hmmmm you could iterate through that and search for a specific node you're interested in, such as one that requires metadata you'd like to preserve 17:42 Taoki Only need to know the box size of the schematic in this case 17:43 hmmmm i am envisioning a function, create_schematic_with_meta() that calls create_schematic() like normal, but right after, opens it up and searches through the nodes used and checks for ones that require metadata; if so, then this is a special case and we open up the same area in the voxelmanip and scan for nodes of that type 17:44 hmmmm then when we get the position, save the metadata to a separate file, like chest_meta.txt 17:44 Taoki Would be nice too 17:44 hmmmm when you go to place_schematic_with_meta(), you merely call place_schematic like that, and then check for any such _meta.txt files, and if so, set it back 17:45 hmmmm and this can be done entirely in lua without too much effort 17:45 sfan5 Taoki: i tested it now, it works 17:45 Taoki sfan5: Awesome... thanks 17:45 hmmmm what i'm saying is that i'm sick and tired of the knee-jerk reaction to put anything that might take more than 15 seconds of thought as an API into the engine 17:46 Taoki hmmmm: Any chance changes might be made to the shchematic format that could break the formula sfan5 found? 17:47 sfan5 wat... nautilus identifies .mts as video/mpeg 17:47 sfan5 Taoki: if changes are made you will probably find them here https://github.com/minetest/minetest/commit/c1b829077a3518f3a129eee11887b2358a53f20b#L1R658 17:47 sfan5 (not that url, but that file and line) 17:52 hmmmm taoki, no, steps will be taken to ensure strict backwards compatibility 17:53 Taoki oh, good 17:55 celeron55 byt the way, where is it specified? 17:55 celeron55 oh it was asked already 17:55 celeron55 well if that is the answer, i'll ask one thing 17:56 celeron55 hmmmm: it does have an explicit version field, right? 17:56 PilzAdam yes, it has 18:03 Taoki sfan5: Can I put that whole code in one Lua function? The one for checking schematic sizes 18:04 Taoki PilzAdam: Sorry if I'm being annoying, but were all issues fixed with the last VBO code? Still not seeing it in upstream and looking forward to test it properly 18:05 Taoki Going to bed earlier tonight too, waking up early tomorrow 18:08 thexyz how's ignore_world_loading_errors supposed to work? 18:09 thexyz *ignore_world_load_errors 18:10 thexyz shouldn't it regenerate block right after it fails to load? https://gist.github.com/anonymous/829da999ea1a4e80edbd/raw/010939daae2d51162bee6e0c387e973e27da11e1/gistfile1.txt 18:17 sweetbomber hi 18:17 sweetbomber i wanderes why does getId return CONTENT_IGNORE when a content name is not found... 18:18 sweetbomber why not return CONTENT_AIR or something similar? content ignore just makes things look glitchy 18:18 sfan5 Taoki: yes 18:18 sfan5 sweetbomber: if theres something wrong, it should be shown to the user not ignored 18:18 Taoki Thanks. Still trying to understand what it all means just to be safe :P 18:19 sweetbomber sfan5: then something like a "block unavailable" block should be used 18:19 PilzAdam sweetbomber, i.e. CONTENT_IGNORE 18:20 sweetbomber i mean, with a texture saying that 18:20 sweetbomber a block which allows seeing underground looks strange... 18:20 celeron55 what getId? 18:20 sweetbomber (correct me if im wrong, a content_ignore node makes underground visible, right? 18:21 sweetbomber at least to me it does) 18:21 celeron55 ignore is completely see-through for sure; it's as designed (that behavior is *needed* in where it is used) 18:21 sweetbomber CNodeDefManager::getId 18:21 celeron55 you should always check if CONTENT_IGNORE is returned if you work in C++ with a function that returns it rather than an exception 18:22 celeron55 there are no excuses for not doing so 18:22 sweetbomber celeron55: I agree with you 18:22 Taoki What does the numver in file:read(#) mean? 18:22 sweetbomber but when trying to get the ID of a block, given a content_name, it should not return content_ignore 18:22 celeron55 eh 18:22 celeron55 what should it return then? 18:22 sweetbomber it should return something like a default:unkown 18:23 sweetbomber which has as texture something that indicates that to the user 18:23 sweetbomber *unknown 18:23 celeron55 it's a design choice to use ignore as a "not found" return value 18:23 sfan5 Taoki: read n bytes from file "file" 18:23 celeron55 if you add yet another one, you just complicate everything 18:23 sfan5 s/n/n number of/ 18:23 celeron55 as it currently is, there are only two hardcoded ids, air and ignore, which is just about enough 18:24 sweetbomber ill put things on the perspective im dealing: 18:24 sweetbomber im implementing a structure generation system 18:24 Taoki How do you read n bytes from a file? It takes a string based on the file size? 18:24 thexyz no one talks to me =( 18:24 thexyz anyway, after that error (https://gist.github.com/anonymous/829da999ea1a4e80edbd/raw/010939daae2d51162bee6e0c387e973e27da11e1/gistfile1.txt) server started to eat ~8gb of ram 18:24 sweetbomber and one of the structures i used for debugging had content_names that i do not have (im using minimal) 18:24 celeron55 thexyz: highlight the one who has modified it last time 18:24 sfan5 Taoki: it takes a string, yes, but also a number 18:25 sweetbomber i was expecting those to be returned as content_air 18:25 sweetbomber but they were content_ignore 18:25 Taoki ah... it's the number of characters it reads 18:25 celeron55 sweetbomber: use the bool-returning getId, it sounds like that's more suitable for you 18:25 Taoki so file:read(5) would reat the first 5 characters from that line I assume 18:26 sfan5 Taoki: from the current position* 18:26 sfan5 (which is initially 0 obviously) 18:26 sweetbomber celeron55: sure, ill use some workaround, but changing getId, imho, would be a long-term fix 18:26 celeron55 you don't even need to check what it returns, just initialize the return-by-reference value beforehand to whatever you want to use as your arbitrary fallback node 18:26 sweetbomber it would be more elegant 18:26 celeron55 that way nobody has to change well-working interfaces and you are able to reliably set your own fallback node 18:27 thexyz okay 18:27 thexyz celeron55: looks like you did 18:27 celeron55 blerg 18:27 thexyz anyway, here's the patch that fixed that for me https://gist.github.com/anonymous/5623a49f1d5893ef48ff 18:28 thexyz "fixed" 18:28 celeron55 well it's on a to-do list somewhere that there should be a way for it to mark blocks invalid and not touch them afterwards 18:29 thexyz yup, right in the comment 18:30 celeron55 destroying the data on disk immediately after some error is seen is kind of a not a thing to do 18:30 celeron55 nobody expects that 18:30 thexyz right 18:30 thexyz I'm not saying we should include it as-is 18:31 thexyz there probably should be setting "destroy_my_data" or something 18:31 celeron55 the mapblock should be marked as invalid and not ever be saved, or something like that 18:31 celeron55 after it's created as a blank one 18:31 hmmmm celeron, why not? 18:31 thexyz in a long run it's a better idea, for sure 18:31 hmmmm if generated = false, we know it needs to be generated 18:31 thexyz but not when users are shouting "wtf" 18:32 hmmmm hmm 18:33 celeron55 sweetbomber: really a generic "error" node could be considered, but not now 18:33 hmmmm what is __gc equal to before it's explicitly set in LuaClass::Register? 18:33 celeron55 sweetbomber: it needs to be considered where it should be used and then everything intended to use such modified to use it like intended 18:33 hmmmm see, I need to disable garbage collection for this one thing i'm doing but it doesn't make sense to make an entire class 18:33 celeron55 sweetbomber: not spreading the code with random usage of ignore and error with no sanity 18:34 sweetbomber celeron55: then it is something worth thinking about, before too much fallbacks are designed 18:35 celeron55 sweetbomber: it's not like your code this time would matter in terms of that; it's just one thing in many to change 18:35 thexyz I wonder if there's a key-value store which can be backed up without the need to stop the process using it 18:36 sweetbomber getId looks like a good candidate to use an error node, because afaik its return value will always be used in an existing node 18:36 sweetbomber but ill leave that subject for now 18:36 hmmmm something this fundamental really doesn't need to be changed 18:37 hmmmm nobody else ever really had a problem with that 18:37 sweetbomber hmmmm: that happens because of two things: players can only place existing-name blocks 18:38 sweetbomber and lua (i dont know this for sure) maybe forbids someone to place a block with an unknown name... 18:38 PilzAdam sweetbomber, yes, it blocks placing content_ignore 18:39 celeron55 sweetbomber: Map::setNode forbids placing ignore 18:39 sweetbomber btw, hmmmm what fallback node did you use in your decoration system? 18:39 sweetbomber im planning to use content_air 18:39 hmmmm content_air 18:39 sweetbomber ok, nice 18:39 hmmmm if the node to be used is invalid, though, when appropriate i merely disable the use of that decoration 18:40 sweetbomber btw, i think i discovered a issue with furnaces generated in map-get, but ill inspect that latter 18:40 sweetbomber the default lua script blows in line 1423 18:40 sweetbomber but ill inspect if that has anything to do with my code first 18:41 sweetbomber *mapgen 18:41 sweetbomber the only thing i did was place a furnace 18:41 PilzAdam sweetbomber, placing nodes that use meta (like furnaces) breaks the nodes if on_construct() isnt called 18:41 sweetbomber ok 18:42 sweetbomber i was wandering if i could just place such "advanced" nodes just by placing, and not telling the system about them 18:42 sweetbomber PilzAdam: could you explain to me what should i do to regiter nodes with meta? 18:43 sweetbomber and how can i know if a block requires that special attention? 18:43 sweetbomber (you could just point me where can i find a usage of that on code) 18:43 PilzAdam nodes with meta require some init valuse being written, this happens in the on_construct() function in the node definition 18:45 sweetbomber ok, for what im seeing, i need to get the contentFeatures 18:45 PilzAdam used in ServerEnvironment::setNode() 18:45 celeron55 we decided that in the schematic placing thing a separate lua wrapper will be made that will take care of those when needed (actual viability of this is yet to be tested) 18:45 sweetbomber inspect the "has_on_construct" 18:46 sweetbomber and if true, call it 18:46 sweetbomber is this enough? 18:46 PilzAdam where do you want to do this? mapgen? 18:46 sweetbomber yes, im working on c++ 18:46 sweetbomber not lua 18:48 hmmmm guys, does this make sense? i create a new instance of an object with lua_newuserdata, set it to a pointer to the actual C++ object, luaL_getmetatable, lua_setmetatable, so then at this point i have created my userdata that is an instance of my class. then, i pushliteral//pushcfunction///lua_setmetafield on that userdata? 18:49 hmmmm the best part of all this is that i can't see what i'm doing wrong without feedback from other peopl 18:50 kaeza hmmmm, can I see the code? 18:50 sweetbomber PilzAdam: i cant find the on_construct method on MapNode... 18:51 sweetbomber PilzAdam: found an example in setNode 18:51 sweetbomber PilzAdam: i think i'm good for now 18:51 hmmmm kaeza, http://paste2.org/3K6mdnYj 18:52 PilzAdam hmmmm, http://dev.minetest.net/Development_troubleshooting maybe this helps? 18:53 kaeza hmmmm, looks good 18:53 hmmmm pilzadam, what helps? 18:53 kaeza though I suggest using luaL_newmetatable() 18:53 hmmmm kaeza, where? 18:53 kaeza instead of luaL_getmetatable() 18:53 PilzAdam hmmmm, there is something about Lua objects 18:54 hmmmm kaeza, that piece of code was copied from other class things; it works and i'd rather not change it because i don't completely understand it 18:54 hmmmm pilzadam, i wrote that entire wiki page 18:54 kaeza hmmmm, https://github.com/kaeza/cosmorpg/blob/master/src/crpglua/clua_object.c#L54 18:54 hmmmm nothing what i'm asking about 18:54 kaeza but well, if it works, it works :) 18:54 PilzAdam hmmmm, I know 18:55 hmmmm kaeza, just to make sure, if i set __gc to NULL like that, it'll default to the old __gc before it was set in the registration, correct? 18:55 * hmmmm crosses fingers 18:55 hmmmm hah it didn't crash 18:56 hmmmm this can't be right, maybe i used the wrong world 18:56 kaeza it should 18:56 hmmmm ah there we go, a nice crash 18:57 hmmmm hmm, that didn't work at all, it's still calling gc_object 18:59 kaeza derp 18:59 kaeza lua has no notion of "NULL" except nil 18:59 kaeza to "unset" the gc, you use lua_pushnil() 19:00 kaeza though it will be nil in that case and prolly cause a leak 19:00 hmmmm hooray 19:00 kaeza wait uhh 19:00 hmmmm it didn't crash at least 19:01 hmmmm ...at that point 19:01 hmmmm seems to crash at every other point though 19:01 kaeza lua_pushliteral(L, "__gc"); lua_pushcfunction(L, NULL); lua_setmetatable(L, -1); 19:01 kaeza this is wrong... 19:01 hmmmm lj_gc_step() -> gc_onestep() -> gc_finalize() ->gc_call_finalizer() -> lj_BC_FUNCC() -> 0x000000000000000 19:02 hmmmm yeah, I changed that bit to: luaL_getmetatable(L, "VoxelManip"); lua_pushcfunction(L, NULL); lua_setfield(L, -2, "__gc"); 19:02 kaeza that's better 19:02 hmmmm so if i'm guessing correctly, it actually tried to call NULL 19:03 kaeza yep, you pushed NULL as a cfunction 19:03 hmmmm I guess this means that in the register function, i need to save the __gc i'm replacing 19:04 hmmmm i thought NULL on the C side of things is translated to nil, and since it sees nil, it tries to get the field from the next object or something like that 19:04 hmmmm but i guess not 19:04 kaeza uhh no. generally, any "class" should have it's own metatable 19:04 hmmmm just to make sure this is doing what i think it's doing, i'm going to pass 0x1337 19:05 hmmmm excellent 19:06 kaeza works? O.o 19:06 hmmmm yup 19:07 hmmmm well, i'm guessing it memory leaks voxelmanipulator objects now since i got the metatable for VoxelManip and not the specific instance of the class that i created 19:07 kaeza look at the code I linked 19:07 kaeza I call luaL_newmetatable() to create a new "CRPG_Object" class 19:08 kaeza (in your case would be "VoxelManip") 19:08 kaeza if the metatable did not exist, it gets populated there 19:08 kaeza in any case, all objects of class "VoxelManip" ("CRPG_Object" in my code) have the same metatable 19:09 hmmmm that's the thing 19:09 hmmmm hm 19:10 hmmmm alright, what if i register a separate class without the __gc set and call it VoxelManip_nogc 19:10 hmmmm or something 19:10 hmmmm i know that would definitely work, but i'd rather avoid making a separate version 19:12 kaeza that could lead to some leaks 19:12 hmmmmm before i dropped i also said [03:11 PM] see, here when i set __gc, it'd be that same no-op __gc for every other new VoxelManip instance, regardless of whether or not i want it to gc 19:13 kaeza you are re-assigning the __gc field every time a new instance is created, which from some perspective, is wrong 19:14 kaeza the metatable must be created once and only once 19:14 hmmmmm right 19:14 kaeza where is it created initially? 19:14 hmmmmm LuaVoxelManip::Register() 19:14 hmmmmm okay, so the metatable is what's copied to all instances of these objects 19:14 hmmmmm it's what gets used if the field in the actual object isn't found 19:15 hmmmmm so i'd need to set the field __gc in the table i currently have, not the metatable 19:15 kaeza nope 19:16 kaeza the metatable is to change the object's behavior 19:16 kaeza (from the Lua standpoint) 19:16 hmmmmm oh, so the metatable is what overrides the table's own fields 19:16 kaeza it has nothing to do with the object itself 19:16 hmmmmm err 19:16 hmmmmm nevermind any of what i just said 19:16 kaeza let me explain it better 19:17 hmmmmm if that's the case, why do i use settable and not setmetatable in order to set __gc and such? 19:17 kaeza the object (userdata) has *no fields at all* 19:17 kaeza setmetatable() is to *set the entire metatable*, not a single field 19:18 hmmmmm ahh 19:18 hmmmmm i mean setmetafield 19:18 hmmmmm there is no such thing 19:18 hmmmmm setfield, setglobal, setmetatable, settable 19:19 kaeza nope, because metatables are just regular tables 19:19 kaeza the thing here, is you are creating the mt, then using setmetatable(), which pops it from the stack 19:20 hmmmmm settable and setfield are practically the same thing 19:20 khonkhortisan Death to __newindex! 19:20 kaeza yes, except setfield() is used with string indices 19:21 hmmmmm so i have one metatable 19:21 kaeza (which is prolly what you want here anyway) 19:21 hmmmmm alright hold on a minute 19:21 hmmmmm there is no way to do what i want to do without making another metatable with the variation i'd like 19:21 hmmmmm so i need to do *that* 19:21 kaeza what is "the variation" you want? 19:22 hmmmmm the one without a custom __gc 19:22 kaeza shouldn't VoxelManips worj all the same? 19:22 kaeza k* 19:22 hmmmmm well, no, that's the difference here. i need to make __gc the default so it doesn't try to delete the object 19:23 kaeza hmm.. 19:23 kaeza why shouldn't it delete the object? 19:24 kaeza ah I get it... you need to pass the same object to different on_generated() ? 19:24 hmmmmm yeah 19:24 hmmmmm alright, this ought to work now 19:24 * hmmmmm crosses fingers 19:26 kaeza so there is a version that gets passed successively to all on_generate() callbacks 19:26 hmmmmm yup 19:26 kaeza and another one that is "temporary" 19:27 hmmmmm this is what i ended up doing: http://pastebin.com/QNymfnpG 19:27 kaeza so then, you need to create (for example) "VoxelManip" and "VoxelManipTemp" tables 19:28 kaeza metatables* 19:31 hmmmmm oh i also need to fix checkobject 19:32 Taoki sfan5: Tried that code myself now. It seems to almost work, but it returns x size for z size 19:32 Taoki Well, for a building that's normally 25 16 19 I got 25 17 25 19:32 Taoki Wait... 19:33 Taoki Never mind, that's related to the schematics system, it saves it at that and it's correct, sorry 19:33 Taoki Ignore that, the code works fine :) Thanks 19:33 sfan5 tango_: paste the code, also abs()+1 is saved into the .mts file 19:33 sfan5 damnit 19:33 sfan5 ^ Taoki 19:33 sfan5 also, nvm 19:44 hmmmmm errm 19:44 hmmmmm luaL_checkudata() shouldn't crash if it fails.... 19:45 kaeza it shouldn't in stock Lua 19:45 kaeza are you using Jit? 19:47 Taoki PilzAdam: Need to go in 15 minutes. Any chance I can test the VBO in upstream tonight? I understood you finished it and have the ready code which is why I'm asking 19:50 hmmmmmm kaeza, it should return null but it's not... it's aborting instead 19:52 hmmmmm http://pastebin.com/mw104QtN 19:54 hmmmmm ah yes, that must be it, this is LuaJIT 19:59 kaeza hmmmmm, by default, stock Lua (not sure about Jit) calls abort() in case of unprotected errors 19:59 hmmmmm how do i 'protect' this error then? 19:59 kaeza I'm pretty sure luaL_check* raises an error 20:00 hmmmmm it shouldn't though.. it should return NULL 20:00 * Taoki assumes getting that code in is no longer important, right after the solutions were found after a lot of effort :P 20:01 kaeza hmmmmm, try something: just before the luaL_checktype() call, add printf("type: %s\n", lua_typename(L, narg)) 20:01 kaeza err... 20:01 hmmmmm ? i know it's the wrong type 20:01 hmmmmm i just want it to fail by returning NULL so the other possible type is checked 20:01 kaeza ah 20:01 kaeza so... 20:02 hmmmmm so i can avoid this by doing a comparison against luaL_checktype()? 20:02 kaeza "Functions called luaL_check* always throw an error if the check is not satisfied." 20:02 hmmmmm errm, i mean lua_typename 20:02 hmmmmm alright, makes sense i guess..... :/ 20:03 kaeza there's a workaround: 20:03 kaeza make a cfunction which in turn calls luaL_check* 20:03 kaeza push this cfunction on the stack, and call it with lua_pcall 20:04 kaeza or actually... 20:04 kaeza use lua_isuserdata() 20:04 kaeza it returns a bool 20:05 kaeza http://www.lua.org/manual/5.2/manual.html#lua_isuserdata 20:05 hmmmmm erm... nevermind that 20:06 hmmmmm i did what you said, printf("type: %s\n", lua_typename(L, narg)); 20:06 hmmmmm and guess what it prints out: boolean 20:06 PilzAdam kaeza, *5.1 20:06 hmmmmm userdata is a boolean apparently 20:06 hmmmmm but nevermind that, i don't really care about it being userdata, i want to know if the userdata is the certain class name 20:06 kaeza PilzAdam, should be the same 20:07 hmmmmm so how do i get the class name of the userdata without luaL_checkudata()? 20:07 kaeza I don't think you can 20:07 hmmmmm checkudata has to somehow... 20:08 kaeza yes, but that may be internal to the API 20:09 hmmmmm it shouldn't throw an error in the first place (not throwing is a much more sane behavior anyway): 20:09 hmmmmm Finally, luaL_checkudata checks whether the object at the given stack position is a userdatum with a metatable that matches the given name. It returns NULL if the object does not have the correct metatable (or if it is not a userdata); otherwise, it returns the userdata address. 20:09 hmmmmm according to http://www.lua.org/pil/28.2.html 20:09 hmmmmm so this is merely LuaJIT retardation 20:11 kaeza well, I just quoted the manual 20:12 kaeza hmmmmm, http://stackoverflow.com/questions/726958/query-lua-userdata-type-from-c 20:13 hmmmmm ahh 20:13 hmmmmm okay then 20:13 hmmmmm man, every time i do anything related to lua, it always takes hours and my browser has literally 50+ tabs open 20:13 hmmmmm am i incompetent, crazy, or is this perfectly normal1? 20:13 hmmmmm !?* 20:14 PilzAdam all of this :-p 20:17 kaeza hmmmmm, I guess the easiest approach would be to add a 'is_temporary' field to VoxelManip, and check if it's set in __gc 20:17 kaeza (a simple bool should do) 20:18 hmmmmm gfdghohthkso 20:18 hmmmmm that's true, why didn't i think of this 20:18 hmmmmm basically everything i did was a huge waste. 20:18 hmmmmm but i learned some more about lua and userdata. 20:18 kaeza then it's not a waste after all :) 20:18 hmmmmm thank you, that solution is 500x better than what i was doing 20:42 Taoki Time for me to head off, see you tomorrow 20:42 * Taoki hopes PilzAdam gets to click the git push button on that code till then :) 20:47 hmmmmm http://oi41.tinypic.com/2qkntcn.jpg 20:48 hmmmmm they may just be stupid spheres of mese, but they're MY stupid spheres of mese 20:48 hmmmmm so anybody notice that the shapes are distorted slightly farther back? 20:51 VanessaE barely so 21:20 hmmmmm https://github.com/kwolekr/minetest/commit/170af04fbe9d8c42ddc40d26b8e8d0d8c6784069 21:23 PilzAdam there is documentation about the members/functions of the objects 21:23 PilzAdam +missing 21:23 hmmmmm such as? 21:24 PilzAdam e.g. what do I do with a "voxelmanip"? 21:24 hmmmmm go look it up 21:24 proller PilzAdam, wish to stop and remove? 8) 21:25 PilzAdam hmmmmm, the correct place to look it up is lua-api.txt 21:25 hmmmmm PilzAdam, yep 21:25 hmmmmm ctrl+f "VoxelManip" 21:25 PilzAdam oh, have you added that in a previous commit? 21:26 hmmmmm you didn't really think i was able to fit all that in 188 additions, do you? 21:26 hmmmmm s/do/did/ 21:26 PilzAdam I have only looked at the lua-api.txt diff 21:29 PilzAdam the VoxelManip works with content ids only? 21:29 hmmmmm yup 21:30 PilzAdam and why? 21:30 hmmmmm speed. 21:30 hmmmmm names can be added later 21:30 PilzAdam its also not metadata-safe I guess? 21:30 hmmmmm this isn't like some horrible deficiency that makes this worthless 21:30 hmmmmm obviously not 21:33 PilzAdam "To be used only by VoxelManip objects passed to a callback" <- what does that mean? 21:33 PilzAdam only in on_generated? 21:34 hmmmmm i could've sworn i wrote on_generated there 21:34 PilzAdam I would write "only if gotten via minetest.get_mapgen_object()" 21:34 hmmmmm oh the older stuff 21:34 hmmmmm i'll add a separate commit to clarify the documentation 21:35 PilzAdam there could be more documentation of what "data" looks like 21:36 PilzAdam (e.g. how the indices are calculated) 21:37 hmmmmm i can do that, but i'm hoping to alleviate most confusion by doing the work for them; i think i'm going to add my voxelarea.lua helper class to builtin 21:37 PilzAdam and what exactly is the format of all the *map mapgen objects? 21:38 hmmmmm an array 21:38 hmmmmm a simple, flat array 21:39 PilzAdam and how is the index for e.g. x=5;z=4 calculated? 21:39 hmmmmm z * size.X + x 21:40 PilzAdam how do I know the size? 21:40 hmmmmm maxp.x - minp.x + 1 21:40 PilzAdam oh, right 21:41 PilzAdam does get_content_id() work with aliases too? 21:41 hmmmmm yep 21:41 PilzAdam so we finally have a (hacky) way to resolve aliases in Lua 21:42 hmmmmm what do you mean? 21:42 hmmmmm oh i see what you want to do 21:42 PilzAdam currently there is no way for Lua to get the real nodename if it gots the alias 21:42 hmmmmm local c = get_content_id(alias); local real_name = get_name_from_content_id(c); 21:42 PilzAdam yep 21:43 hmmmmm of course it'd only work after the registration period (when aliases come into effect) 21:59 hmmmmm and here we are 22:00 hmmmmm http://en.zimagez.com/full/66ccb569e65ed3ab329a618ec91320d437d5f6d293deb0a86924c0fb25bf0a9d85c1aa48560fefec7c600caa28a130bc.php 22:01 hmmmmm that is with singlenode 22:01 hmmmmm http://pastebin.com/4NkyM37K 22:01 PilzAdam paramat will be happy 22:02 hmmmmm of course it could be better 22:02 hmmmmm there's no visible difference in speed between this and a builtin mapgen 22:03 PilzAdam VoxelArea? 22:03 hmmmmm yes.. 22:03 PilzAdam thats not documented in lua-api.txt 22:03 hmmmmm thats not part of the api 22:04 hmmmmm not yet anyway 22:16 hmmmmm hm 22:16 hmmmmm it seems like it's only 4x slower than a builtin mapgen 22:16 PilzAdam I wonder if we should move the "math" mapgen to a mod instead of core 22:17 hmmmmm yeah, it certainly does seem like mod material... but that's a lot of work you realize 22:22 hmmmmm simple 3d based mapgen: http://pastebin.com/YSs2EhLD http://en.zimagez.com/full/748ca06f3bc1b7d3329a618ec91320d497eb1924cf532b926924c0fb25bf0a9df9a92f84a3bc059805249c83548d7a35.php 22:26 kaeza OMG 0.2.x all over again! :D 22:26 kaeza s/0.2.x/mgv5/ 22:28 hmmmmm eh, i am pretty sure mgv5 used a different algorithm 22:28 PilzAdam v5 had 3d perlin noise IIRC 22:28 iqualfragile we are at mgv7 right now, aren't we? 22:28 hmmmmm not quite 22:29 PilzAdam iqualfragile, higher number doesnt mean "better" 22:29 hmmmmm mgv7 is still under development 22:29 iqualfragile i know 22:29 PilzAdam getting v5 into the new mapgen system is in the TODO list 22:29 hmmmmm it might not look as snazzy as this, but you must understand that it's made to be interesting looking yet very playable 22:30 hmmmmm i specifically wanted a lot of mgv7 to be plainer terrain so you can actually build on it 22:30 kaeza mgv5 created awesome formations, but finding a flat place to build was a PITA 22:31 PilzAdam v6 is only flat near water or on cliffs 22:31 PilzAdam and it gets boring to build at that places after some time 22:31 hmmmmm v6 is mostly crap 22:32 hmmmmm it gets old quick, looks bad in the majority of places, has no flat terrain for building, and has very static biome support 22:32 Anchakor I liked the one which made huge spacy caves 22:32 PilzAdam AFAIK the reason to make v6 was speed 22:32 hmmmmm right 22:32 hmmmmm v6 is a tuned v2 actually 22:33 proller v8 planned on pure lua? 22:33 hmmmmm haha 22:33 hmmmmm don't bet on it