blue-nebula / base

Main repository of Blue Nebula, a fast-paced shooter with a unique parkour system. It is a fork of Red Eclipse and is free software.
https://blue-nebula.org
15 stars 6 forks source link

IRC-style highlighting #75

Open TheAssassin opened 4 years ago

TheAssassin commented 4 years ago

50 inspired me to this idea. We should add some chat highlighting feature, like you have in most IRC clients. Whenever you are mentioned (and this has become fairly easy with #37), the client should display the entire line in a special, highly visible (maybe even customizable) color. This is a very non-invasive, subtle but powerful way to inform users about lines which affect them.

One thing to look out for is, whatever color is used, the game must still make sure that when a color code is used in such a message, that part is highlighted in some way. I could imagine something like "if same color then display that part in white font color".

MoonPadUSer commented 4 years ago

I rly like that idea, but how about instead of coloring the text itself, how about we just draw a colored background to the text?

TheAssassin commented 4 years ago

This'd required adding such a feature. Also, I think coloring the font is more subtle, which is also important in a game.

MoonPadUSer commented 4 years ago

both ways we'd have to add a new parameter to struct cline, e.g. bool mentions_player so we don't have to recalculate it over and over again. that'd need us to fiddle inside the void conline(int type, const char *sf, int n), the biggest problem with this is that sf means the entire thing you see in the chat e.g. <freem> Hello World.

MoonPadUSer commented 4 years ago

and regarding "adding that feature", this is nonsense, we can already draw stuff like images behind text.

TheAssassin commented 4 years ago

and regarding "adding that feature", this is nonsense, we can already draw stuff like images behind text.

That's not quite the same as having some serious support for background colors. As said, I don't even think it's that much of a good idea. I'd personally just go for the ^fo color.

both ways we'd have to add a new parameter to struct cline, e.g. bool mentions_player so we don't have to recalculate it over and over again. that'd need us to fiddle inside the void conline(int type, const char *sf, int n), the biggest problem with this is that sf means the entire thing you see in the chat e.g. Hello World.

That just basically screams, "I want to be refactored". It seems the state keeping of chat lines is pretty bad. Might be time to add some structure to them, e.g., class ChatMessage or something like that.

MoonPadUSer commented 4 years ago

I do agree with you, but

  1. ChatMessage would be an inappropriate name except you want to have a separate class for chatmessages and console outputs (which I think would also kinda make sense since console outputs don't need parameters like mentioned_player, etc. so maybe we could have a general class for that and then have a class that derives from it
  2. If we want to do that, I recommend we first merge my scrollable chat PR as it fiddles around with this code, splitting console output and chat output into two separate lists