Page 1 of 1

Player information window

PostPosted: Sat Apr 12, 2014 20:49
by MirceaKitsune
Thread for pull #1220.

Formspec window which lists all players active on the server. The name of each player is shown, as well as their ping / lag. Additionally the system supports custom icons, which mods can set per player.

Image

FAQ (please read before asking questions or making requests):

Q - Why was this added in builtin?
A - Because it's intended for the Minetest engine and not for minetest_game, and doing it in Lua is the best and only way. If most developers suggest moving it minetest_game, I will do so... but note that in this case adding a keybind will no longer be possible.

Q - Why didn't you add a keybind to toggle the menu rather than a chat / console command?
A - I'll do that later, or add it to the pause menu if that's a better choice. Wanted to first hear what people think so I don't work for nothing. Currently you bring up the window by typing "/players" in the console. Note that this doesn't work in singleplayer.

Q - What are player icons for and how do they work?
A - Mods can set an icon for each player, which shows left of the player's name in the player list. Scripts can change a player's icon with the playerinfo.set_icon function. Servers / games / mods can either offer a selection of avatars, or use the face of the player skin (making it easier to recognize someone in-world). Player icons are not persisted between server restarts, because that would be both hard and a bad idea. The minetest logo is used when no icon is set.

Q - Does the window auto-update?
A - No, all info is generated when the window is opened. Auto-refresh would be both difficult and the info shown doesn't require it that much.

Q - What happens if there are too many players on the server to fit them all on the list?
A - The default size of the list is 6 x 8, so 48 players can be shown. If there are more than 48, some players will be excluded. If anyone thinks that's unacceptable, feel free to add support for multiple pages, I don't know how to do this myself.

Q - Any thoughts to add more features?
A - I wanted to list more information per player... but there isn't a lot of room for text, and it appears I can only afford two lines. My plan was to show the position of players as well as their distance from self, while clicking a player's name added a waypoint to their location. Such would be very hard to do however, especially if we don't auto-refresh the list and player positions. This could however be used to send private messages to players, by clicking their name to change chat channel.

Q - Minecraft also has a window like this, aren't we copying it too much?
A - NO! >:(

PostPosted: Sat Apr 12, 2014 21:02
by hoodedice
Player icons are not persisted between server restarts, because that would be both hard and a bad idea.


Can you explain this a little more?

PostPosted: Sat Apr 12, 2014 21:14
by MirceaKitsune
hoodedice wrote:Can you explain this a little more?


They are stored in a local list inside the Lua file, with two functions to get / set them. Storing them permanently makes little sense. First of all because it's difficult... we would probably need to create and maintain a text file in the world folder which might get slow to read / write. But since the Lua API can set them in minetest.register_on_joinplayer, they can maintain their own list and handle this as they see fit.

PostPosted: Sat Apr 12, 2014 22:19
by Evergreen
sfan wrote something which brings up a player list when the tab key is pressed. Good idea though.

PostPosted: Sun Apr 13, 2014 02:16
by Sokomine
MirceaKitsune wrote:A - I wanted to list more information per player... but there isn't a lot of room for text, and it appears I can only afford two lines. My plan was to show the position of players as well as their distance from self, while clicking a player's name added a waypoint to their location. Such would be very hard to do however, especially if we don't auto-refresh the list and player positions. This could however be used to send private messages to players, by clicking their name to change chat channel

Perhaps you might find the "textlist" type for formspecs of intrest. They're used in mobf and in my markers mod. There, they list all the areas and provide further information if one is clicked on. My traders also use that formspec element (for handling sales/buy limits).

The position of other players might be very intresting in relation to the player itself, spawn and other important areas (i.e. towns). There is a mod that adds a player radar. Perhaps that can be helpful here as well. However, I'd prefer to have a very abstract, server-specific map with abstract symbols for important places and roads (no way to do that automaticly I'm afraid) with all the player positions shown there.

Evergreen wrote:sfan wrote something which brings up a player list when the tab key is pressed. Good idea though

It would be very practical to have such a keybinding.

It's nice to have such an overview now. Not every player may know the /status command, and the output of that one is not as easily digestible as it ought to be. A nice formspec is better :-)

PostPosted: Sun Apr 13, 2014 09:04
by Calinou
Looks nice, but not so compact. The ping should be shown in milliseconds instead of seconds, it makes much more sense and avoids leading zeros. Use player skin as default icon?

PostPosted: Sun Apr 13, 2014 10:44
by MirceaKitsune
Notice: Tomorrow I'm leaving for a week, spending Easter at grandparents house. I'll have my laptop with me and of course Minetest on it, but might not spend time coding during this time. Changes I make today are possibly the last for a week.

Sokomine wrote:Perhaps you might find the "textlist" type for formspecs of intrest. They're used in mobf and in my markers mod. There, they list all the areas and provide further information if one is clicked on. My traders also use that formspec element (for handling sales/buy limits).

The position of other players might be very intresting in relation to the player itself, spawn and other important areas (i.e. towns). There is a mod that adds a player radar. Perhaps that can be helpful here as well. However, I'd prefer to have a very abstract, server-specific map with abstract symbols for important places and roads (no way to do that automaticly I'm afraid) with all the player positions shown there.


I wasn't aware of this element. When I work on this again I shall attempt using it instead... sounds like the right way to go.

Also, if I can think of a layout which offers enough room, I might add buttons for each player to the right of their name... such as "chat" or "spawn waypoint at last location". I'm actually thinking of having a vertical list only, since the current layout is pretty meh.

Calinou wrote:Looks nice, but not so compact. The ping should be shown in milliseconds instead of seconds, it makes much more sense and avoids leading zeros. Use player skin as default icon?


I wasn't sure what the best value for the ping would be. I'll multiply by 1000 to get miliseconds instead, thanks for the correction.

And I thought about using the player skin instead of an icon. But there's no way to read the texture assigned to the player, without each game / mod providing a function for this purpose. More importantly, using the player texture there would look kinda ugly... why see random bits of clothing and skin intended to be UV-mapped over a mesh? Existing system will allow mods to use the player texture's face as an icon (different texture) making things nicer and easier.

PostPosted: Sun Apr 13, 2014 12:21
by webdesigner97
Calinou wrote:Looks nice, but not so compact. The ping should be shown in milliseconds instead of seconds, it makes much more sense and avoids leading zeros. Use player skin as default icon?

IMHO, it is compact enough. But I agree with the time units and the icon idea.

PostPosted: Sun Apr 13, 2014 13:00
by BlockMen
webdesigner97 wrote:
Calinou wrote:Looks nice, but not so compact. The ping should be shown in milliseconds instead of seconds, it makes much more sense and avoids leading zeros. Use player skin as default icon?

IMHO, it is compact enough. But I agree with the time units and the icon idea.


If using the player skin as icon, then use just the face part

PostPosted: Sun Apr 13, 2014 16:18
by MirceaKitsune
Updated the layout to use textlist, show player information to the left only for selected player. Player list is only refreshed when re-opening the window, but player information is gathered whenever clicking a player. Let me know what you think of the current design.

Image

PostPosted: Sun Apr 13, 2014 16:18
by rubenwardy
So much white space!

Maybe players could write biographies, or you can allow mods to set multi-line labels.

PostPosted: Sun Apr 13, 2014 16:21
by MirceaKitsune
rubenwardy wrote:So much white space!

Maybe players could write bios, or you can allow mods to set multi-line labels.


Hmmm... descriptions / profiles players can write sounds like an intriguing idea! I'll think about it. Otherwise, I'll consider trying to reduce empty areas.

PostPosted: Sun Apr 13, 2014 16:26
by Calinou
BlockMen wrote:If using the player skin as icon, then use just the face part


Ideally, players would have the ability to upload their own avatars (or admin installs them, like with the player_textures mod), separately from skins.

PostPosted: Sun Apr 13, 2014 19:57
by Sokomine
BlockMen wrote:If using the player skin as icon, then use just the face part

Sounds like an intresting idea. For my traders, I use the texture as such for the buttons to switch texture and as inventory images - which does not look so well. Perhaps it would be possible to apply a mask to the texture so that only the front is shown?

PostPosted: Sun Apr 13, 2014 21:28
by MirceaKitsune
Allow players to have descriptions apart from just icons (thanks rubenwardy for the idea). Can be used as profiles, class descriptions (PvP servers), status messages, or anything else plus all of these combined (given multi-line support). Also improve the layout: Add a list refresh button, print current / maximum player count, show ping in the player list and colorize entries based on it.

Image

Image

PostPosted: Mon Apr 14, 2014 00:07
by Sokomine
Status messages sounds fine. If there's a way for players to change these, it might be an easy way of telling other players what a player prefers to do on the server/would like to trade/plans building/...