Page 1 of 1

"Abusing" signs_lib - unlimited text length ...

Posted: Fri May 18, 2018 09:49
by mycomments2017
Hello, just trying to experiment here ... if I were to change MAX_INPUT_CHARS variable from '600' to say '65535' in signs_lib mod (https://github.com/minetest-mods/signs_ ... t.lua#L249) - am I to expect crashes? bad surprises?
Thanks

Re: "Abusing" signs_lib - unlimited text length ...

Posted: Fri May 18, 2018 11:12
by Krock
Quickly tested this in a local world, using the Lorem Ipsum to generate a lot of text quickly.
So I've ended up with 65535 characters on a single sign - then I increased the limit - even 327k lines don't affect the gameplay as long you don't point a the sign.
Never point at the sign. Only masochists do that.
The infotext which is drawn at the upper left side of the screen slows down the rendering process a lot, and thus causes a massive frame drop. It seems to draw the entire text even though its visual space is limited and thus, only the first few hundred characters can be read.

Re: "Abusing" signs_lib - unlimited text length ...

Posted: Fri May 18, 2018 18:06
by stu
Krock wrote:So I've ended up with 65535 characters on a single sign - then I increased the limit - even 327k lines don't affect the gameplay as long you don't point a the sign.
Never point at the sign. Only masochists do that.
LOL, although that is rather impressive. Did you happen to note how much memory was consumed?

Re: "Abusing" signs_lib - unlimited text length ...

Posted: Fri May 18, 2018 18:22
by Krock
stu wrote:Did you happen to note how much memory was consumed?
192 MiB (before: a bit less than 192 MiB).
In other words: No noticeable memory consumption (RAM). This seems also logical because the sign limits the columns and lines to create the text entity texture. Also the infotext is just a string variable which doesn't result in loading any additional media and is rendered directly.

Re: "Abusing" signs_lib - unlimited text length ...

Posted: Fri May 18, 2018 18:31
by stu
Krock wrote:[his seems also logical because the sign limits the columns and lines to create the text entity texture.
Ah, so extending the number of input character does not really gain you anything, the real limit is actually the maximum number of columns and rows. I have never really studied the signs_lib code but It clearly performs a lot better than I would have imagined :)