English How to optimize hudtxt's usage?[Solved]

13 replies
Goto Page
To the start Previous 1 Next To the start
Up
Mora_rus
User
Offline Off
Hello dear uss community.
Well, the problem may not be solved through using images as a hudtxt, i dont like this idea.

The main thing is that i have Inventory with hudtxt2 feature, and the problem is that i have many slots but lack of hudtxt2 free ids. I know myself that using alot of them is bad and etc, but:
may be there an one hudtxt2 id for one line of items in horizontal?
IMG:https://i.imgur.com/wYLKeDf.png


May be these all hutdtxts be one just somehow with fixpos?
Otherwise one guy told that i can hide info in tooltip. Any ideas?
edited 1×, last 09.08.19 08:45:49 pm
S.T.A.L.K.E.R. - The Lost Land dev. https://discord.gg/aABCkHQ
07.08.19 04:16:08 pm
Up
Masea
Super User
Offline Off
I actually told you what you could do. That's the only legit way around here. Show the item's quantity only when players hover on them. You would save lots of hudtxts as well.
Create your UI easy and fast: UI Framework | Go to the deep of darkness and test your bravery: file cs2d Outlast 2 Modification (27)
07.08.19 04:18:11 pm
Up
Mora_rus
User
Offline Off
I already mentioned about this idea, maybe some more ideas will come, wouldn't be very bad, huh?
S.T.A.L.K.E.R. - The Lost Land dev. https://discord.gg/aABCkHQ
07.08.19 04:20:37 pm
Up
Masea
Super User
Offline Off
You didn't, though. I didn't tell you to show the quantity in the tooltip but in slots. In fact, perhaps the tooltip idea could be better. Since your tooltip is at the center and truly big, otherwise it would be less noticeable in slots.
Create your UI easy and fast: UI Framework | Go to the deep of darkness and test your bravery: file cs2d Outlast 2 Modification (27)
07.08.19 05:40:55 pm
Up
Danilqra
User
Offline Off
why can't you use images?
you can make your hudtxt using images
edited 1×, last 07.08.19 05:53:43 pm
Da Ny
07.08.19 07:56:38 pm
Up
Gaios
Security Supporter
Offline Off
How can you be out of 49 hudtxts at the screen... lol? Anyway I use automatic dynamic assignment of free IDs for hudtxts. Just grabs the one that isn't used currently.

EDIT:
Aha... nice big inventory.. lol. Anyway it's interesting why it's limited to 49 haha.. probably of bandwidth size per tick. That's the limit of server-sided mods. At least they can do hudtxt package function that will send many compressed hudtxts to the client in single packet.

user Mora_rus has written:
may be there an one hudtxt2 id for one line of items in horizontal?

√ You need special algorithm GL
08.08.19 01:19:53 am
Up
Goo
User
Offline Off
There's actually 50 IDs (0-49)!
08.08.19 11:18:11 pm
Up
DC
Admin
Offline Off
I think the limit of 50 is arbitrary. At least I don't remember why I chose exactly that limit.

I guess I could try to increase it for the next update. Shouldn't cause direct issues but of course more texts mean more data. So updating many texts frequently is still a pretty bad idea.

No idea how you could display more text. You already mentioned using images instead. That's the only solution I can think of. But of course that's pretty annoying to implement. You also need additional files (images for the digits) and it's less efficient (causing more traffic).

Using one text for a whole line of items works in theory if you pad the spaces with a lot of space characters. Unfortunately the font isn't mono space (characters have different sizes). Therefore you would have to write quite some code to get the positions somewhat right. The positioning would never be perfect though because you can't do pixel perfect positioning that way. All numbers in a line would jump a bit when a number in front of them changes.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
09.08.19 02:55:11 pm
Up
Mora_rus
User
Offline Off
Well, about hudtxt2 limit is interesting, like, samely: mora images - more data, i dont actually know if there's an image limit, but you can place 50 images whose sizes are like my HUD of inventory. Anyway you can use alot of images same as hudtxt2 like, items on floor, images as hud and imageframed image etc.

Nothing would cause more traffic as long as you use good(Ain't like me :D), so even if there's limit will be like 100, a coder, if he dont wanna lag and if he understand what he's doing then is okay.
Right now "more traffic" cause alot of images and bad coding without optimizations.(like all my scripts :C)

The problem is that if I hide items amount it wouldn't be so informative, and is not that easy to know how much you have, otherwise you need to aim each item to know how much you have. In plans to make possible to combine some items to get another one, so thats why i wanna use hudtxts.

Well i've got y'all. I will check my code and graphics, maybe i can find solution to keep items hudtxt-ed. Like decreasing slots amount and adding pages.
S.T.A.L.K.E.R. - The Lost Land dev. https://discord.gg/aABCkHQ
09.08.19 07:45:51 pm
Up
DC
Admin
Offline Off
Yes, like I said, there was no real reason for that limit. I probably just didn't expect that anyone will ever need more texts
I agree that it doesn't make much sense to have that limit.

I implemented a new limit yesterday and can confirm that the new limit will be 200 (0-199) in CS2D 1.0.0.9.
Why a new limit instead of an "infinite" (~65k actually) amount like images? That's because of the way it is implemented internally. I don't want to change the underlying code. I think 200 is enough for most cases.

The update will probably be released within the next 1-2 months (fixes and minor improvements only).
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
09.08.19 08:45:14 pm
Up
Mora_rus
User
Offline Off
Well, actually bad using cause lag and traffic))
Huh, nice to see that something is making even after one post, lol. Thank you much!

By the way, data of hudtxt2 that sends (traffic) depending on how much symbols is used there? So if for example i have a single hudtext2:
'Health: "..player(id,"health").."/Armour: "..player(id,"armor").."/Money: "..player(id,"money")..".'

it will show me: Health: 100/Armour: 0/Money: 10000.
And if i use
Code:
1
2
3
4
5
local h=player(1,"health")
local a=player(1,"armour")
local m=player(1,"money")
local text="Health: "..h.."/Armour: "..a.."/Money: "..m
parse('hudtxt2 id 1 text 20 20 20 20 20')


is there any difference in data, that sending to client?Because output the same.

/offtop, and please, you did blocked using "key" of "addbind" while you type text, if you affected about updates, then this blocking should also work while you in any cs2d menu and in options and especially in console.
S.T.A.L.K.E.R. - The Lost Land dev. https://discord.gg/aABCkHQ
09.08.19 11:48:50 pm
Up
Gaios
Security Supporter
Offline Off
user Mora_rus has written:
is there any difference in data, that sending to client?Because output the same.

Man, Lua is just interpreting language. The output data is send.. doesn't matter how did you code it. If it's still the same data at the end, there's no difference.

Also to let you know.. it's faster and better to use cs2d lua cmd imagealpha at created images instead of: creating new images and removing them. Every cs2d lua cmd image command contains path, x, y and stuff; every cs2d lua cmd imagealpha contains only alpha value.
10.08.19 08:27:19 am
Up
Mora_rus
User
Offline Off
So if i have on my screen mine inventory and before used PDA and all items that are there, wouldn't it lag ATM, while even their alpha is 0? since images are still there.
S.T.A.L.K.E.R. - The Lost Land dev. https://discord.gg/aABCkHQ
10.08.19 09:26:48 am
Up
Gaios
Security Supporter
Offline Off
@user Mora_rus: If there are created like ~50 images at the screen but hidden (alpha 0) for sure it doesn't affect at the connection between server-client. It will only affect at a client's GPU.. but in fact 50 images at the screen is nothing.. also user SQ optimized image memory usage.
To the start Previous 1 Next To the start