Time |
Nick |
Message |
00:02 |
|
GreenXenith joined #minetest |
00:02 |
GreenXenith |
The 2024 Luanti GAME JAM approval window is closed, it's time for GAME RATING! Go to https://jam.luanti.org/rating where everyone can view and sort submissions (and choose some "Best-of" categories)! Thank you to everyone who submitted games! Take a break and relax for a bit after a job well done! Results at the end of the month! |
00:28 |
|
Galisma joined #minetest |
00:31 |
|
v-rob joined #minetest |
01:16 |
|
Thermoriax joined #minetest |
01:26 |
|
liceDibrarian joined #minetest |
01:31 |
[MatrxMT] |
<Blockhead256> The forums require a "zip download link" for mods to get moved to releases |
01:32 |
[MatrxMT] |
<Blockhead256> would you all agree that (an approved) ContentDB link counts for that? |
01:32 |
MTDiscord |
<wsor4035> works for me |
03:43 |
|
m33 joined #minetest |
04:21 |
|
chilledfrogs joined #minetest |
04:29 |
|
yezgromafic joined #minetest |
04:31 |
|
m33 joined #minetest |
05:00 |
|
MTDiscord joined #minetest |
05:12 |
|
lemonzest joined #minetest |
06:16 |
|
vampirefrog joined #minetest |
07:27 |
|
Glaedr joined #minetest |
07:56 |
|
grorp joined #minetest |
07:56 |
MinetestBot |
grorp: Nov-10 20:13 UTC <erle> i'll take “unpleasant” or “rude”. but what did you consider “unhelpful”? i found a regression, identified the commit(s), the reason (wrong assumptions about filtering) and managed to convince people that they were wrong. what more could i have done? |
08:00 |
|
MacroFaxSax joined #minetest |
08:22 |
|
Talkless joined #minetest |
08:39 |
|
TomTom joined #minetest |
09:12 |
|
jaca122 joined #minetest |
09:28 |
|
shinbet joined #minetest |
09:51 |
|
Eragon joined #minetest |
10:11 |
|
MacroFaxSax joined #minetest |
10:22 |
|
gregon joined #minetest |
10:40 |
|
gregon joined #minetest |
10:59 |
|
tarsovbak joined #minetest |
11:00 |
|
Talkless joined #minetest |
11:33 |
|
SFENCE joined #minetest |
11:44 |
|
ireallyhateirc joined #minetest |
12:04 |
|
SFENCE joined #minetest |
12:16 |
|
Desour joined #minetest |
12:22 |
|
SFENCE joined #minetest |
12:27 |
|
SFENCE joined #minetest |
12:47 |
|
Desour joined #minetest |
12:54 |
|
SFENCE joined #minetest |
13:37 |
|
Baytuch_2 joined #minetest |
13:46 |
|
silverwolf73828 joined #minetest |
14:10 |
runxiyu |
is the minetest network protocol documented anywhere? |
14:15 |
Krock |
runxiyu: doc/ |
14:42 |
runxiyu |
I see, I'll see how much this corresponds to the modenr protocol |
14:46 |
yezgromafic |
what would be the optimal approach for making something like minecraft's stackable snow layers? |
14:47 |
MTDiscord |
<csperson> Nodeboxes maybe? |
14:47 |
yezgromafic |
thought so too but given that they render non visible faces i cant imagine that would fare too well performance wise |
14:48 |
MTDiscord |
<theidealist> layered nodeboxes probably |
14:48 |
|
lmat joined #minetest |
14:48 |
MTDiscord |
<theidealist> with layered paramtype and all that |
14:50 |
ireallyhateirc |
@Warr1024, would shelves from NodeCore be easy to port to other games? If so, where exactly is the code for putting entities into the shelves? |
15:02 |
ireallyhateirc |
I dug into "nc_api_storebox" |
15:07 |
MTDiscord |
<warr1024> I wouldn't expect it to be "easy" but it's probably possible. |
15:13 |
ireallyhateirc |
at first glance the code is dispersed all over the place |
15:23 |
[MatrxMT] |
<🇬regon> @yezgromafix Maybe look in Mineclonia code? |
15:23 |
[MatrxMT] |
<🇬regon> @yezgromafic Maybe look in Mineclonia code? |
15:27 |
yezgromafic |
hey not a bad idea, thanks |
15:38 |
|
Desour joined #minetest |
15:39 |
|
tarsovbak joined #minetest |
15:49 |
|
Krock_ joined #minetest |
16:05 |
|
Oblomov joined #minetest |
16:12 |
|
cheek_pain joined #minetest |
16:34 |
runxiyu |
There are people saying that increasing the viewing range causes more mobs to load, etc. |
16:34 |
runxiyu |
I'm rather confused because I see nothing in increaseViewRange in cilent/game.cpp that tells the server anything |
16:35 |
sfan5 |
the client informs the server about the wanted fov |
16:36 |
sfan5 |
whether the server actually uses that for deciding active blocks I don't remember |
16:37 |
* runxiyu |
is grepping for viewing_range |
16:39 |
sfan5 |
https://github.com/minetest/minetest/blob/4faa16fe0ddf98659bfa3f852cb1d9b8ff95eb93/src/serverenvironment.cpp#L369 here you go |
16:41 |
sfan5 |
the claim is true |
16:41 |
runxiyu |
thank you |
16:41 |
runxiyu |
maybe i should use unlimited viewing range less |
16:48 |
[ |
Would a patch that makes fov and other client camera settings settable at runtime be accepted? There's a comment that says "TODO: Add a callback function so these can be updated when a setting changes. At this point in time it doesn't matter (e.g. /set is documented to change server settings only)" but that's not true (CSMs can change settings) |
17:17 |
|
jluc joined #minetest |
17:39 |
|
peterz joined #minetest |
17:52 |
|
Sokomine joined #minetest |
18:01 |
|
Wuzzy joined #minetest |
18:08 |
|
Eragon joined #minetest |
18:20 |
sfan5 |
sure |
18:32 |
|
jaca122 joined #minetest |
18:37 |
|
MacroFaxSax joined #minetest |
19:08 |
|
erle joined #minetest |
19:26 |
ireallyhateirc |
How do I save custom data into an entity? |
19:26 |
ireallyhateirc |
I mean a particular instance |
19:27 |
Krock |
on_activate and deactivate callbacks |
19:27 |
Krock |
* get_staticdata is called before deactivate |
19:27 |
erle |
ireallyhateirc you can look at how mods that do entities with inventories do it, e.g. chest boat in mineclonia |
19:27 |
Krock |
Ctrl+F in lua_api.md |
19:28 |
ireallyhateirc |
staticdata is per-instance data right? |
19:31 |
erle |
ireallyhateirc make sure the data you save is not too large so the game does not crash on unload. originally sfan5 guessed the maximum possible item entity serialization size that would not lead to a crash as 65530 bytes, but anon5 calculated it to be actually 65487 bytes. This has been experimentally verified by me in 2021. |
19:32 |
ireallyhateirc |
I'm saving only size and item name |
19:32 |
erle |
ireallyhateirc also if you are thinking about “fixing” the “crash on unload” thing in the engine, don't. not crashing there leads to a multitude of harder-to-fix bugs. |
19:32 |
erle |
(crashing makes the game devs fix their item meta) |
19:32 |
ireallyhateirc |
are object properties the same as staticdata? |
19:32 |
erle |
wait that was only for item entities |
19:32 |
erle |
disregard what i said |
19:33 |
erle |
i would limit the item name though, if it is settable by a user |
19:34 |
MTDiscord |
<luatic> ireallyhateirc: no |
19:34 |
MTDiscord |
<luatic> object properties are generally not persisted |
19:35 |
MTDiscord |
<luatic> staticdata is a string that is persisted |
19:35 |
ireallyhateirc |
so in this callback: on_activate = function(self, staticdata, dtime_s) end, |
19:35 |
ireallyhateirc |
self is object properties and staticdata is persistent? |
19:36 |
erle |
ireallyhateirc for the boat example, look here: https://codeberg.org/mineclonia/mineclonia/src/branch/main/mods/ENTITIES/mcl_boats/init.lua#L170 |
19:36 |
erle |
when entity is loaded, staticdata is the thing you need |
19:37 |
MTDiscord |
<luatic> self is a luaentity. self.object is an object ref. self.object:get_properties() lets you get object properties, self.object:set_properties{...} lets you set them. staticdata is the string that was returned by get_staticdata() and then saved to disk when the entity was unloaded. |
19:37 |
erle |
and then properties are set based on what you get out of staticdata |
19:37 |
erle |
like this: self.object:set_properties({textures = data.textures}) … where data is the result of minetest.deserialize(staticdata) |
19:38 |
erle |
ireallyhateirc here you can see how staticdata was set for the boat https://codeberg.org/mineclonia/mineclonia/src/branch/main/mods/ENTITIES/mcl_boats/init.lua#L195 |
19:39 |
ireallyhateirc |
that's quite convoluted and the API doc doesn't appear to explain it |
19:39 |
ireallyhateirc |
First the code does this: |
19:39 |
ireallyhateirc |
ent:set_properties({ |
19:39 |
ireallyhateirc |
wield_item = itemstack:get_name(), |
19:39 |
ireallyhateirc |
visual_size = vector.new(1, 1, 1) * size, |
19:39 |
ireallyhateirc |
}) |
19:39 |
erle |
it is explained here: https://rubenwardy.com/minetest_modding_book/en/map/objects.html#entities |
19:39 |
ireallyhateirc |
so how do I read this in on_activate ? |
19:40 |
erle |
well first you have to do a get_staticdata implementation similar to the boat one. serialize the things you want to save. |
19:40 |
erle |
return that |
19:41 |
Krock |
https://github.com/minetest/minetest/blob/master/builtin/game/item_entity.lua#L77-L101 copy and paste from here |
19:41 |
erle |
my understanding is that on unloading (or whenever it wants to) the engine will call get_staticdata() and save whatever is returned |
19:41 |
erle |
and then later on_activate gets that staticdata when the entity is reloaded |
19:41 |
ireallyhateirc |
Ok this should help |
19:42 |
ireallyhateirc |
I'm basically modifying the itemshelf mod |
19:42 |
ireallyhateirc |
to make it more general and fix bugs |
19:47 |
|
Verticen joined #minetest |
19:50 |
ireallyhateirc |
So object properties = can't be custom, the client reads that |
19:51 |
ireallyhateirc |
static data = custom properties |
19:52 |
erle |
ireallyhateirc how do you test this kind of code? |
19:53 |
erle |
like, full-blown automated engine test? |
19:53 |
erle |
or manually |
19:53 |
ireallyhateirc |
no, I'm hacking together the itemshelf mod |
19:53 |
ireallyhateirc |
the code is convoluted so I wrote a minimal reproducer |
19:54 |
erle |
https://content.luanti.org/packages/zorman2000/itemshelf/ this one? |
19:54 |
ireallyhateirc |
yeah but I made a fork: https://codeberg.org/perfect_city_game_studio/itemshelf_api |
19:54 |
Desour |
if you need non-persistent per-object lua values, you can store them in the luaentity table |
19:54 |
MTDiscord |
<luatic> yep that's what you should do. naming convention dictates these should start with an underscore. |
19:55 |
MTDiscord |
<luatic> personally my convention is self._name for non-persistent data, self._ is a table of persistent data. this means there's a lot of self._.name for persistent data in my code :D |
19:56 |
ireallyhateirc |
what kind of non_persistent are we talking about? |
19:56 |
MTDiscord |
<luatic> data that only exists while the entity is loaded |
19:56 |
ireallyhateirc |
My problem is that the buggy mod uses local variable magic to store item names instead of saving them in the object |
19:57 |
Desour |
luatic: isn't the _custom_field only for fields in the registered_entities table? |
19:57 |
MTDiscord |
<luatic> Desour: both have the potential for collisions with future engine names... |
19:58 |
Desour |
well, yes |
19:58 |
MTDiscord |
<luatic> ireallyhateirc: if you mean closures, those are no magic and if used properly very nice |
19:58 |
ireallyhateirc |
I'm familiar with closures, this code is simply spaghetti |
19:59 |
ireallyhateirc |
the functions are too long and don't don't do one thing and do it well |
20:00 |
ireallyhateirc |
also no, they're not closures. Simply two variables with local scope outside of function body |
20:01 |
ireallyhateirc |
So two variables with file scope used by several functions across the file |
20:01 |
ireallyhateirc |
no encapsulation |
20:02 |
Desour |
such variables are called upvalues. and the functions that use them are closures |
20:03 |
Desour |
idk why you'd want extra useless capsules |
20:04 |
Desour |
(but I havent seen the code, maybe in your case it's bad *shrug*) |
20:05 |
ireallyhateirc |
when a function is 400 LoC and I can't understand how it works then it's bad |
20:05 |
ireallyhateirc |
do multiple things and do them badly |
20:12 |
MTDiscord |
<luatic> ireallyhateirc: is file scope the proper scope for these variables? file scoped variables can't really work if you need per-entity variables. |
20:13 |
ireallyhateirc |
I'm not sure honestly, but it doesn't matter. The old code works fine (if you ignore some bugs), but it's an absolute mess. I'm extracting minimal pieces that work and trying to reproduce the basic functionality of the code while making it simpler. |
20:13 |
ireallyhateirc |
I'm almost there |
20:45 |
|
Verticen joined #minetest |
20:48 |
|
Talkless joined #minetest |
20:54 |
MTDiscord |
<jordan4ibanez> There's a fork on your shelf |
20:55 |
MTDiscord |
<jordan4ibanez> Lol store your local variables on disk so they never go out of scope |
20:57 |
MTDiscord |
<jordan4ibanez> https://tenor.com/view/big-brain-markiplier-gif-14835823 |
20:58 |
MTDiscord |
<jordan4ibanez> I wish we had a server api where everyone could store local variables on some kind of server, and everyone simply agrees to not overwrite anyone else's variables |
20:58 |
|
gregon joined #minetest |
21:05 |
MTDiscord |
<et086> that exists |
21:06 |
|
gregon joined #minetest |
21:07 |
MTDiscord |
<jordan4ibanez> No no no, I mean, for every server in every game |
21:07 |
MTDiscord |
<jordan4ibanez> Just some huge web server that can store variables |
21:11 |
MTDiscord |
<et086> well https://pandorabox.io/kv |
21:22 |
[MatrxMT] |
<🇬regon> Page with nothing? |
21:27 |
|
TheSilentLink joined #minetest |
21:29 |
ireallyhateirc |
Okay I managed to get the code to work, but it behaved really weird |
21:29 |
ireallyhateirc |
ly |
21:30 |
ireallyhateirc |
Question: when spawning an entity with "minetest.add_entity" do I need to provide staticdata as the third argument? |
21:30 |
ireallyhateirc |
If I don't do that, get_staticdata doesn't save anything to disk |
21:33 |
ireallyhateirc |
The original code did this: https://codeberg.org/perfect_city_game_studio/itemshelf_api/src/commit/ad237470ce7585e8d790fb30145a751f8fc6866f/api.lua#L124 |
21:34 |
ireallyhateirc |
Hmmmmmmm I think I know what happens. First "minetest.add_entity" initializes the object but then on_activate overwrites everything |
21:39 |
MTDiscord |
<jordan4ibanez> I didn't think this would actually be a real thing because this was a joke, but I'm horrified and intrigued |
21:40 |
ireallyhateirc |
I think the author of the original mod confused object properties with static data |
21:40 |
ireallyhateirc |
they added a huge pile of boilerplate mode to initialize the wield_item for the object |
21:40 |
ireallyhateirc |
but it obfuscated the fact that nothing gets saved in the first place |
21:42 |
ireallyhateirc |
I can't blame the guy for confusing the two as the documentation is meh |
22:06 |
|
shinbet joined #minetest |
22:07 |
|
sinvet joined #minetest |
22:30 |
|
NQN joined #minetest |
23:18 |
|
NQN joined #minetest |
23:33 |
|
panwolfram joined #minetest |
23:37 |
cheapie |
ireallyhateirc: ...are you starting to see why I use static_save = false so often yet? :P |
23:38 |
ireallyhateirc |
well, I discovered it's esoteric knowledge |
23:38 |
Mantar |
agreed on the documentation sucking |
23:38 |
ireallyhateirc |
cheapie, what does static_save = false do? |
23:38 |
cheapie |
Makes it never save it to disk, it just vanishes |
23:38 |
Mantar |
entities/objects are fiddly and overcomplicated |
23:38 |
ireallyhateirc |
but I want to save some stuff to disk |
23:39 |
ireallyhateirc |
but the first save is janky |
23:39 |
cheapie |
You're making stuff that goes on a shelf node, right? If I was writing it I'd store the data in the node and just have an LBM that spawns the entities. |
23:40 |
ireallyhateirc |
cheapie, I could do that, but I already managed to hack together the original code |
23:40 |
ireallyhateirc |
The solution was to do this: local ent = minetest.add_entity(current_pos, "itemshelf_api:item", staticdata) |
23:41 |
ireallyhateirc |
so basically pushing all values I want preserved to staticdata |
23:41 |
cheapie |
Having the node manage it also allows them to respawn after a /clearobjects |
23:41 |
ireallyhateirc |
using env:set_properties() was weird |
23:42 |
ireallyhateirc |
how to make the node aware if objects are there after /clearobjects ? |
23:43 |
cheapie |
If the entities use static_save = false, then it doesn't have to, it just spawns new ones the next time it's loaded anyway. |
23:44 |
cheapie |
So it's not an instant respawn or anything, but it makes it not be a case of "someone did /clearobjects and now all shelf contents are permanently gone" |
23:44 |
ireallyhateirc |
sounds fair |
23:44 |
cheapie |
Some mods try to implement commands that search all loaded mapblocks for entities that should be respawned, I've never bothered with that myself. |
23:47 |
MTDiscord |
<luatic> everybody agrees about the documentation sucking, it's just that too few do something about it unfortunately since it's quite a chore (and there are often more immediately pressing issues) |
23:47 |
MTDiscord |
<luatic> we tried a while ago with the minetest_docs project but that ultimately failed to gain traction (though it may gain traction again? we'll see, every now and then it looks like someone might want to pick it back up again) |