[Items] What's the cost in making book_written hold 60000

Post Reply
User avatar
bhree
Member
Posts: 169
Joined: Tue Jun 19, 2018 07:45
GitHub: bhree
IRC: bhree
In-game: bhree
Location: Alone In The Wild Land
Contact:

[Items] What's the cost in making book_written hold 60000

by bhree » Post

The default book can only store max 10000 characters, I made it 6x the original capacity so I can place large amount text inside each book. I write in markdown format so plain text file is just okay as I can pretty render using many apps (of course outside Minetest). Sometimes I found writing inside Minetest world is pleasing with all of ambient sound, I run the server 24/7 so I can visit just to write something and watch the day pass by. Spend the day mine/building something, fighting mobs, chatting with strangers (not many) and write a book in the night, I sleep only for creating spawn point. But what will be the consequence especially impact to storage and RAM? Is it still allowed to store inside world database?

Thanks.

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Items] What's the cost in making book_written hold 6000

by ChimneySwift » Post

I was interested to know too...

So I tested on a brand new singleplayer world.

Unfortunately I crashed my computer before I posted so I don't have the exact numbers, but map file increase was negligible after writing 60000 characters to a book and placing it in a chest (in the player inventory it's stored in the player database), and I observed a 30mb decrease in RAM with it open. The only performance degradation I noticed was a more sluggish cursor movement, but still entirely usable.

Until you get into the millions of characters I doubt you'd notice any performance issues.
A spoon is basically a tiny bowl with a stick on it

User avatar
bhree
Member
Posts: 169
Joined: Tue Jun 19, 2018 07:45
GitHub: bhree
IRC: bhree
In-game: bhree
Location: Alone In The Wild Land
Contact:

Re: [Items] What's the cost in making book_written hold 6000

by bhree » Post

So I think it has nothing to worry until many players start writing many books. It may be useless for most player, but I'm thinking a text editor with search feature. I found it may have potential as it accept copy and paste from/to outside minetest.

User avatar
rubenwardy
Moderator
Posts: 6977
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Items] What's the cost in making book_written hold 6000

by rubenwardy » Post

High. Don't do this

The book's content will be sent to players whenever they load a chunk which has a chest with the book in, and when they have it in their inventory This can cause quite a lot of transfer and excess bandwidth usage.

It would be better to store the contents separately, maybe in its own file, then refer to it in the item meta data using a token / primary key. It'll be a lot harder to work out if the book has been deleted though, so you may end up with book content stored which is never used. This shouldn't be too much of a problem, especially if you compress the contents (I think Minetest has a function for this, not sure)

That being said - if your server isn't popular you probably don't need to care about this so much, and can just increase the limit. Just don't complain about slow map loading and such :)
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
bhree
Member
Posts: 169
Joined: Tue Jun 19, 2018 07:45
GitHub: bhree
IRC: bhree
In-game: bhree
Location: Alone In The Wild Land
Contact:

Re: [Items] What's the cost in making book_written hold 6000

by bhree » Post

I'm still in progress reading your modding book and figuring out how minetest works. Inside minetest I'm taking my books everywhere, and store some in chest in several places to see the effect. I also monitor bandwidth and cpu dynamics and planning to have one or two bookshelves full of books. Yes it almost no one plays so I'm not sure about the impact.
There is a text editor mod but it is said to be insecure.
[Edit] Can your text editor mod modified to prevent executing codes?

I'm still very limited but connecting book to a text file is interesting to avoid player carry or store loaded books. I guess the size will be the same as regular txt file. Compression or simple encryption is nice, but well I need enlightenment here.

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Items] What's the cost in making book_written hold 6000

by ChimneySwift » Post

60000 characters is only about 0.06mb. I doubt you'd notice a significant bandwidth hog just from these books unless you want to store an entire library in Minetest... There are certainly faster and less annoying ways of lagging out a server if that's the intended purpose.

If you want to keep the books off the server entirely though, there are CSM which let you write ingame at no performance cost to the server.
A spoon is basically a tiny bowl with a stick on it

User avatar
bhree
Member
Posts: 169
Joined: Tue Jun 19, 2018 07:45
GitHub: bhree
IRC: bhree
In-game: bhree
Location: Alone In The Wild Land
Contact:

Re: [Items] What's the cost in making book_written hold 6000

by bhree » Post

Hi chimney,

Can you show me the CSM this is really interesting. I can really learn something from both client/server mod.

[edit] my server is survival with mobs, it will be busy here to make books from papyrus.

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Items] What's the cost in making book_written hold 6000

by ChimneySwift » Post

bhree wrote:Hi chimney,

Can you show me the CSM this is really interesting. I can really learn something from both client/server mod.

[edit] my server is survival with mobs, it will be busy here to make books from papyrus.
Try the Notebooks CSM:

Code: Select all

**Author:** DS-minetest
**License:** CC0
**Depends:** worldstorage

[Download](https://github.com/DS-Minetest/notebook/archive/master.zip)
[GitHub](https://github.com/DS-Minetest/notebook)
Or the Notes CSM:

Code: Select all

Usage
`.notes: Ingame notes`

**Author:** TalkLounge
**License:** LGPL v2.1+
**Depends:** None

[Download](http://github.com/TalkLounge/notes/archive/master.zip)
[GitHub](http://github.com/TalkLounge/notes/)
Unfortunately these don't have the ability to have separate notebooks... But it would be fairly simple to make or modify one to allow for multiple.
A spoon is basically a tiny bowl with a stick on it

User avatar
bhree
Member
Posts: 169
Joined: Tue Jun 19, 2018 07:45
GitHub: bhree
IRC: bhree
In-game: bhree
Location: Alone In The Wild Land
Contact:

Re: [Items] What's the cost in making book_written hold 6000

by bhree » Post

Thanks I will refer to them, i'm still learning and studying codes really helpful.

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Items] What's the cost in making book_written hold 6000

by orwell » Post

If you want to see how minetest works internally, just put said book into your player inventory and then open your player data file at world-folder/players/
Item metadata is stored inside the inventory, and is, as rubenwardy said, sent to the clients with the inventory.
It should be not that difficult to put the contents of the book into a text file somewhere in the world directory, link that to an ingame 'book' item and then read the book ingame. It's a very good beginner project for people willing to learn minetest modding...
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
bhree
Member
Posts: 169
Joined: Tue Jun 19, 2018 07:45
GitHub: bhree
IRC: bhree
In-game: bhree
Location: Alone In The Wild Land
Contact:

Re: [Items] What's the cost in making book_written hold 6000

by bhree » Post

Hi orwell, Thank you for the direction, i'm still amazed with all minetest world system works. I'll look at it and should give me picture if all 15 players carry all written books inside their inventories including bags.

[edit] I have 26k of player data is that to big? The content of the books seem stored inside world map dbase.

User avatar
ChimneySwift
Member
Posts: 320
Joined: Fri Sep 22, 2017 06:46
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift
Location: 127.0.0.1

Re: [Items] What's the cost in making book_written hold 6000

by ChimneySwift » Post

The book data is stored wherever the inventory is stored.

If the book is stored inside a chest or other node it will be stored inside the map database. If it's stored inside a player inventory then it'll be stored inside the player database.

Note here that the map database will grow slightly even if you're not doing much so it's hard to tell the difference in size, especially since a full book of 60000 characters is only 0.06mb.
A spoon is basically a tiny bowl with a stick on it

Post Reply

Who is online

Users browsing this forum: Unacceptium_core and 13 guests