Astera-org / minetest

Minetest is an open source voxel game engine with easy modding and game creation
https://www.minetest.net/
Other
0 stars 0 forks source link

Expose player metadata #83

Closed mickvangelderen closed 1 week ago

mickvangelderen commented 1 week ago

Retrieves the player metadata that is set by mods and exposes it through Cap'n Proto to the gymnasium environment through the info dict returned by the step function.

Also addresses an ever growing memory allocation because of how we used Cap'n Proto, see https://github.com/capnproto/capnproto/issues/2181#issuecomment-2474649454. Instead of keeping the AllocMessageBuilder around, we recreate one every step. This comes at the cost of new memory allocations which we could minimize but this is simple and it probably doesn't matter.

~Works great but now things sometimes lag, I suspect the env lock...~ already lagging on master, not sure what's going on

mickvangelderen commented 1 week ago

@garymm I don't know how to properly implement buffer re-use concisely.

You would want to:

I don't think it matters, every time a mod sets or reads the metadata, there is a string to float / int conversion... There are probably many inefficiencies and while we don't need to add to it, I value the simplicity more than the efficiency in this case.