Xonotic Forums
Color picker for player shirt & glow - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Creating & Contributing (https://forums.xonotic.org/forumdisplay.php?fid=10)
+--- Forum: Xonotic - Development (https://forums.xonotic.org/forumdisplay.php?fid=12)
+--- Thread: Color picker for player shirt & glow (/showthread.php?tid=671)



Color picker for player shirt & glow - MirceaKitsune - 07-05-2010

Something I was planning to ask for a while. What does everyone think about implementing a color picker for selecting the player shirt and glow colors? We could forget about the 15 color buttons and select any color in between, which is a feature I'm totally up for Smile

I'm not going for a picker that allows changing the brightness, so don't worry about black or gray colors. Basically, we could turn the color buttons into a rainbow bar, offering all full intensity colors. White could be included separately at the bottom of the bar, and the rainbow cycling option that Nexuiz had could be a separate button. Here is a picture of what I had in mind:

[Image: rktf2cwofloqh89cefa.png]

I don't know if I can implement it myself, but I can try if the feature would be accepted. The system could also be useful for the new panel hud, as it doesn't have a picker for the panel colors yet.


RE: Color picker for player shirt & glow - clanclanclan - 07-05-2010

If you wanted to make it more complex for the user, an 'Advanced' button that leads to another two of those colour changers used for the name might be an easier way of doing it. That way advanced users get FULL control, whilst less advanced users can just pick a colour and be done Smile


RE: Color picker for player shirt & glow - MirceaKitsune - 07-05-2010

(07-05-2010, 07:40 PM)clanclanclan Wrote: If you wanted to make it more complex for the user, an 'Advanced' button that leads to another two of those colour changers used for the name might be an easier way of doing it. That way advanced users get FULL control, whilst less advanced users can just pick a colour and be done Smile

That can be done, though I don't see the advantage of two color pickers in the menu. I think that would load the menu too much for such a small feature, and imo even a simple user can drag a slider over the desired color. I do believe the sliders should have a small snapping however, possibly cvared.

Problem is we need to disallow dark colors, so players can't set theirselves to black or grey by manually changing the cvars. I don't see a problem with that personally, but some believe it can make you too hard to hit so that would likely be requested. Imo the easiest way is by forcing either Red Green or Blue to be 1 at a time.


RE: Color picker for player shirt & glow - clanclanclan - 07-05-2010

MirceaKitsune Wrote:I do believe the sliders should have a small snapping however, possibly cvared.

Yes, that would be the ideal way to do it.

MirceaKitsune Wrote:Problem is we need to disallow dark colors, so players can't set theirselves to black or grey by manually changing the cvars.

The colour that gives an advantage will be different on each map and for each person. What if they're colourblind? What if it's a snow themed map? It soon gets to the point you need a colour blacklist (trench warfare) or a filter (if R+G+B<90: col=(30,30,30), very irritating). There is even research into colour dominance which shows that some people act differently towards different colours.

The easiest way to fix that is fullbright skins, which means you CAN'T get an advantage.


RE: Color picker for player shirt & glow - Lee_Stricklin - 07-06-2010

It would be interesting if a better color picker was made for choosing players colors, but I think it's best use would be for the panel HUD.


RE: Color picker for player shirt & glow - MirceaKitsune - 07-06-2010

Unfortunately there's bad news about this. The shirt \ glow color is handled by the engine, since we don't have csqc players yet. So from what I understand, this either means that support for RGB coloring needs to be implemented engine-side (which I heard is almost impossible) or we need to wait for csqc players first, which may happen later or not happen at all.

The only point where I'm confused is why it's impossible to do it in the engine. I took a look at the engine code, and although I couldn't understand much at a first sight, it feels as it should be possible without dirty hacks. There's already the 'rainbow cycling' color, so rendering at other values does work. If we could somehow get a cvar that specifies the colors in RGB instead of 15 colormap choices, that could do the trick. Of course I know little about the engine, that's just what I'm wondering. If not, I guess this has to be done later if it will.

I remember one interesting thing however. I was working on a code once (the respawn ghosts) and found a way to color players to black from csqc. I did so by using self.colormap = 512; I tried some experiments with self.colormap at other values, but that doesn't allow me to recolor to anything else sadly.


RE: Color picker for player shirt & glow - Mr. Bougo - 07-06-2010

Colormap uses the same palette as player colors, IIRC it's 1024 + 16*shirt color + pants color. 0 to 1023 are reserved for game-dependant specific color combinations I think (why this much, I have no idea)...

I don't know why csqc players play any role in this, as the rendering of the models and the coloring is done by the engine anyway.


RE: Color picker for player shirt & glow - divVerent - 07-07-2010

well, csqc is a way to add this to the protocol without breaking stuff

The main restriction is not the engine. Internally, a new csqc field can be added for it.
The main restriction is the network protocol.


RE: Color picker for player shirt & glow - MirceaKitsune - 07-07-2010

I see then. Well, if there's a chance for it to be possible sometime, I'll try implementing the color picker which can set a cvar to a RGB value like the nickname coloring. Then the branch can wait until the coloring system is also coded somehow in the future.


RE: Color picker for player shirt & glow - MirceaKitsune - 07-07-2010

I managed to implement the picker today, and got the code to a stable point so it can be tested safely. See branch mirceakitsune/player_color_picker in xonotic-data.pk3dir. The sliders are working and setting the cvars properly, but those cvars don't become the player colors yet. Things left to do are:

- Make the slider's cvars actually work... hardest part of all. Would be very appreciated if anyone can help with that, otherwise the sliders are useless until this is done. From what I understood on IRC, csqc should handle the cvars and send the color to the engine as an object.

- Implement snapping for setting common colors more easily. I'll look into that tomorrow, shouldn't be too hard. Done

- Optionally, add a cursor to the picker. I couldn't do that due to several reasons, but this really isn't urgent since it's just an effect. You just click & drag where you want on the color bar and the cvar is set to that color.

Feel free to commit changes to my branch especially if you get the coloring part working. Here is a screenshot of how the slider looks like (I may try improving the textures later):

[Image: mrse8cbqj0zs4sh1un4f.jpg]

[EDIT] Snapping implemented and working in the latest branch.

[EDIT 2] Updated the textures to look better, like this:

[Image: i60ne2i14fj4389c5mg.jpg]


RE: Color picker for player shirt & glow - -z- - 07-08-2010

how far away from doing live previews are we?


RE: Color picker for player shirt & glow - Lee_Stricklin - 07-12-2010

(07-08-2010, 05:35 PM)-z- Wrote: how far away from doing live previews are we?

That would be cool. I'm no coder, but these things instantly come to mind when I think about live preview:

Loading a map for the menu screen like Unreal Tournament does

Chase Cam

Maybe someone with some skill is thinking the same thought?


RE: Color picker for player shirt & glow - Mr. Bougo - 07-12-2010

Model preview is in the works (no animation though), rendering is done in menu QC. I don't think you cab count on that for maps, it will be extremely slow.


RE: Color picker for player shirt & glow - MirceaKitsune - 07-12-2010

That's great news! Glad to hear this is in the works Big Grin When player rendering preview will be done, I'll remove the "preview button" of my picker as well, since it wouldn't make much sense to keep it and I think it would look better without it. Imo even a non-animated preview is ok for a start, as long as it works and shows the model with shirt \ glow.

Anyway, the color picker code still requires help from anyone willing to look into this. We need a way to somehow network these cvars to the engine for each player, so the colors can be applied. _cl_color is the cvar we must "follow" and try finding a way to duplicate, but with sending RGB colors rather than values from 1 to 16.