More text colors

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Tue Oct 21, 2008 11:08 pm

  • In this topic http://alientrap.org/forum/viewtopic.php?p=46323#46323 I've wrote an idea to implement new colors in chat. I report here my reply:
    terencehill wrote:Yes. More colors instead of modifying the existing ones.

    I thought a simply solution that doesn't recolor old nicknames, compatible with Quake 3 Arena with not so big differences in colors:
    ^1 is red ---> ^1^1 is dark red, ^2^1 is brown (colors near to red), ^4 is blue ---> ^1^4 is dark blue, ^2^4 is indigo (colors near to blue) etc.... And so on for each color. A max of 100 colors can be created instead of current 10.

    With the current implementation ^1^1 and ^2^1 are still red, with the new system are dark red and brown, ^1^4 and ^2^4 are still blue, with the new system are dark blue and indigo...


    Watching source code of the file console.c, where there is the code related to console output, I found that some special codes are used to change color output. I've extrated these codes from the code in console.c (function Con_Print):
    case 7: [m
    case 1: [1;31m
    case 2: [1;32m
    case 3: [1;33m
    case 4: [1;34m
    case 5: [1;36m
    case 6: [1;35m
    case 9: [0;1m

    Searching these codes on google I've found this page http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html where there are other codes for other kinds of colors, that I write here:
    Black 0;30
    Blue 0;34
    Green 0;32
    Cyan 0;36
    Red 0;31
    Purple 0;35
    Brown 0;33
    Light Gray 0;37

    Dark Gray 1;30
    Light Blue 1;34
    Light Green 1;32
    Light Cyan 1;36
    Light Red 1;31
    Light Purple 1;35
    Yellow 1;33

    White 1;37

    To developers:
    - Can these new colors be used natively by Nexuiz?
    - If yes, can these new colors be added "easily" to Nexuiz, modifying a bit the code in console.c to implement the system I've talked before?
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Wed Oct 22, 2008 2:22 pm

  • "To developers"

    Why do you make that plural? There's only one regular dev for nexuiz (Div0) and he is not too much into deving anymore when all anyone else does is demand things and no one else helps with code dev.

    He's asked for more devs and everyone has anwered "I'd like to but I won't" aka "screw off, and your little game too".

    Why do they even respond if it's just to say "no"?
    take_this_cup_of_poison
    Banned
     
    Posts: 198
    Joined: Sun Jan 20, 2008 2:25 am

Wed Oct 22, 2008 2:44 pm

  • Anyway. The answer is probably yes. Try out adding them. You're on your way to making a nice contrib to the code! :D (Nexuiz is capable of millions of colors where bash can only do 16)
    take_this_cup_of_poison
    Banned
     
    Posts: 198
    Joined: Sun Jan 20, 2008 2:25 am

Wed Oct 22, 2008 3:58 pm

  • The things i've wrote are the results of a research I've made, I didn't want an answer
    The answer is probably yes.
    by a non-dev. That's why I wrote "to devs". I am asking if it can be teorically implemented. I know that div have his own work, and this is not a priority.

    Since I know only a bit C and it's the first time I look the Nexuiz source code, I don't know even if it's possible to add also one more color. Maybe these new colors works only on linux but not in Windows. This is a problem.

    Assuming that div says that it's surely possible to add new colors, I'd really want to write some code line, but my C knowledge is limited. I can try too but it could be only a big waste of time with no result. Maybe if someone knows C a bit more, then he can make the changes without involve div.

    Nexuiz is capable of millions of colors where bash can only do 16

    I wish u r right. We r talking however about text colors, not about colors of the 3d game, I guess u understand this difference.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Thu Oct 23, 2008 2:28 am

  • If you want it done you're going to have to do it yourself. Even if you're "not good at C". It's a simple change. No one else is going to do it. Nexuiz doesn't have "devs" (plural) at the moment and wishing for someone else to do it is not going to result in anything. You're 1/2 way there. Keep on going.

    You might not want to hear from me but... the colors that is possible are all the colors that nexuiz display. Bash is limited to 16 colors because linux console is limited to 16 colors.

    If you want it done you have to code it. No one else is going to do it. It's your choice. Become a dev (you're getting there) or just beg for implementation of the idea to no avail.

    Keep following that code trail as you've started! :D

    But as you've allready said, you're not going to... so you will forever wish for the extra colors but you will never ever ever ever have them.
    take_this_cup_of_poison
    Banned
     
    Posts: 198
    Joined: Sun Jan 20, 2008 2:25 am

Fri Oct 31, 2008 10:33 pm

  • Tnx take_this_cup_of_poison for your words.

    I've implemented it!
    I still don't believe I did it! :D :D :D
    Not so complicated however, but I thought I had very few possibilities so now I'm very happy! :)
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Fri Oct 31, 2008 11:29 pm

  • awesome!

    Have you had a chat with div about your successful code?
    Dokujisan
    Forum addon
     
    Posts: 1199
    Joined: Sat Oct 07, 2006 4:31 pm
    Location: Louisville, Kentucky

Fri Oct 31, 2008 11:47 pm

Sat Nov 01, 2008 2:49 pm

  • How about something like ^RGB?

    As in "this is ^FF0yellow, this is ^00Fblue!"
    User avatar
    Fnilp
    Member
     
    Posts: 14
    Joined: Sat Nov 01, 2008 6:18 am

Sun Nov 02, 2008 3:34 am

  • Fnilp wrote:How about something like ^RGB?

    As in "this is ^FF0yellow, this is ^00Fblue!"


    This is what I would like to see. The game Track Mania used ^RGB with the number ranging from 0-9. For example ^900 would be red, ^200 is dark red. ^009 would be blue etc etc..... This solution gives a wide range of colors, much more so than any other solution I've seen.
    User avatar
    Pyromace
    Member
     
    Posts: 46
    Joined: Wed May 28, 2008 8:27 pm

Sun Nov 02, 2008 3:37 am

  • Good Job!
    See. Isn't it kinda fun :). It's almost like scripting.

    Could you post your changes here so we don't loose them.

    (What isn't fun is texturing a uvmap... everything distorts).
    take_this_cup_of_poison
    Banned
     
    Posts: 198
    Joined: Sun Jan 20, 2008 2:25 am

Sun Nov 02, 2008 6:42 pm

  • I'm implementing this system so that it's fully compatible with standard Quake colors. And also to be mnemonic, once u memorize the numbers of the 10 main colors.

    The limit of 90 colors is a bad thing (there are some stupid things in the rest of the code, maybe they can be fixed easily, otherwise could be 100). I know it's better a system with millions of colors, but on the other hand this is less mnemonic (not a huge problem btw).

    A system with ^x^x^x can be still implemented expanding my system with the same concept to give a max of 1000 colors, keeping the 90 existing ones.

    Watch the (final?) result with all colors I did in this page: http://sites.google.com/site/terencehill/

    PS: I did my best chosing colors... they can't be millions neither 256 (with 256, at least all main kind of colors are covered)
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Sun Nov 02, 2008 7:18 pm

  • This system does break with some Nexuiz code, e.g. print("^7Some message ^3", playername, "^7 something else"); would seemingly randomly recolor the name if it starts with a color code.

    So I am not really sure if I should apply it. Sure, THIS SPECIFIC code can be replaced by

    print("^7Some message^3 ", playername, "^7 something else");

    but all such instances in the code have to be found and fixed then. And that will take quite some time.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Mon Nov 03, 2008 4:27 pm

  • I've encountered a little problem that fucked all up. I wanted to keep color compatibility with less loss of color information, but it's impossible due to ^0^7 and ^7^0: in theory the first should be white, the second black. In practice, considering the existing code, to make work all stuffs, they have to be both white. And ^7^0 can't be white but only black (^7^0 should be equal to ^0). End of the story.
    Watch this screenshot to see what's wrong:
    http://sites.google.com/site/terencehill/Nexuiz/problem%20with%20colors.jpg

    The definitive solution compatible with the actual system can be this one:
    Nexuiz could decode only ^x or ^x^x^x, while ^y^x is intended as ^x.
    In this way we can introduce 1000 colors without any kind of problem with existing code. Indeed the problem is ^x^x but not ^x^x^x.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Mon Nov 03, 2008 10:49 pm

  • terencehill wrote:I've encountered a little problem that fucked all up. I wanted to keep color compatibility with less loss of color information, but it's impossible due to ^0^7 and ^7^0: in theory the first should be white, the second black. In practice, considering the existing code, to make work all stuffs, they have to be both white. And ^7^0 can't be white but only black (^7^0 should be equal to ^0). End of the story.
    Watch this screenshot to see what's wrong:
    http://sites.google.com/site/terencehill/Nexuiz/problem%20with%20colors.jpg


    What's wrong here?
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Tue Nov 04, 2008 6:10 am

  • Anyway, if your problem is this: ^7say meh, this won't work cause say command will be misintepreted. Use this say ^7meh. Same goes for say ^7^0 black text, say ^0^7 white text.
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Tue Nov 04, 2008 2:27 pm

  • Alien wrote:Anyway, if your problem is this: ^7say meh, this won't work cause say command will be misintepreted. Use this say ^7meh. Same goes for say ^7^0 black text, say ^0^7 white text.


    The problem is that in "^7say meh" I can't remove neither modify that ^7 coz atm I can't understand how all the things work and I'm not capable of doing it.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Tue Nov 04, 2008 2:42 pm

  • You can't use ^7say meh (and you don't to modify anything), but you can use say ^0^7meh/ say ^7^0meh (which both work). IIRC, You wanted to make chat more colourful and not to change the colour of console commands.
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Tue Nov 04, 2008 4:39 pm

  • Alien wrote:You can't use ^7say meh (and you don't to modify anything), but you can use say ^0^7meh/ say ^7^0meh (which both work). IIRC, You wanted to make chat more colourful and not to change the colour of console commands.


    I explain better:
    1. I can't modify or remove anything before say and in general at the beginning of a string!
    2.
    a) ^0 and ^7 MUST be black and white, they are main colors.
    b) To make work all things in console ^0^7 and ^7^0 MUST be both white.
    c) ^0^7 MUST be equal to ^7 and ^7^0 MUST be equal to ^0 to be compatible.
    Deadlock.
    Therefore I can do nothing.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Tue Nov 04, 2008 8:26 pm

  • This basically means that approach does not work, but it does not rule out any other approach.

    Basically, you must add at least one more escape sequence, and can't just work with the existing sequences.

    For example, ^x, after which three hex digits would follow, e.g. ^xF00 = red.

    Then all functions that decolorize (look for '^' and STRING_COLOR_TAG in the engine source) need to be altered to support that notation too.

    If you get that done in the engine, I'll do the remaining step of making the Nexuiz menu code support it too.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Wed Nov 05, 2008 1:56 pm

  • terencehill wrote:b) To make work all things in console ^0^7 and ^7^0 MUST be both white.

    Why? If some function uses ^7^0 for white output, than this function is wrong.
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Wed Nov 05, 2008 3:20 pm

  • Alien wrote:
    terencehill wrote:b) To make work all things in console ^0^7 and ^7^0 MUST be both white.

    Why? If some function uses ^7^0 for white output, than this function is wrong.


    Alien, u can notice some problems until u modify the code. I don't know the exact reason of this behaviour, but if the things work on this way, one reason should be!!!

    Btw... good news :)
    I have solved the problem: now when the algorithm find ^x^0 or ^7^y it just ignores the x and the y so they become ^0 and ^y. Now the new colors are only 81 instead of 90. But I can now expand this system (keeping these 81 colors) and add other 1000 colors (unless of other problems) with the system ^x^y^z :wink:

    screenshot here: http://sites.google.com/site/terencehill/Nexuiz

    Now there is another thing to do (damn!): change the algorithm to generate new colors also in the player name setup in the GUI. I've searched in the code and I couldn't find it :(
    Div can u tell me pls where I should put my hands?

    PS: ROFL this seems just a blog of what I am doing... maybe I shouldn't discuss these things here... Should I send u PMs instead, div?
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Wed Nov 05, 2008 3:43 pm

  • I still am not convinced this is the way to go. Taking one message of many:

    nexuiz-trunk/data/qcsrc/server/clientcommands.qc: bprint ("^4", self.netname, "^4 is playing now\n");

    Now if the player sets ^4^2foo^4^2 as name, it will be interpreted as the color codes ^4^4^2 and ^4^2^4. The "is playing now" text would appear as another color.

    This is why I really dislike this solution of adding more colors, and would be in favor of adding more codes in a more "normal" way, like another initial sequence (e.g. ^xF00 for red, x standing for "hex", or simply adding ^a to ^z, ^A to ^Z, etc.).

    Anyway, the part you are looking for is in item/inputbox.c, the if(me.editColorCodes) block.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Wed Nov 05, 2008 5:49 pm

  • divVerent wrote:I still am not convinced this is the way to go. Taking one message of many:

    nexuiz-trunk/data/qcsrc/server/clientcommands.qc: bprint ("^4", self.netname, "^4 is playing now\n");

    Now if the player sets ^4^2foo^4^2 as name, it will be interpreted as the color codes ^4^4^2 and ^4^2^4. The "is playing now" text would appear as another color.


    1. Yes u r right. I already guessed but i've forgot this thing. Indeed I should implement or the system ^x^x or ^x^x^x but not together.

    2.
      a) Using the algorithm I've already implemented (based on ^x^y) each ^x^y^z is considered as ^y^z, therefore ^4^4^2foo is ^4^2foo. ok.

      b) Names that ends with ^x may interfer with the remaining string only if the remaining string is like "^4 is plying now" (the space is after the ^4). They can be changed to put space before ^4, if they r written in this way.
      If it happens the color is modified to a similar color.
      e.g. name: "foo^3" message: "foo^3^4 is playing now"
      "is playing now" is shown in another kind of blue instead of blue.
      However if a player intentionally appends ^x (with x different from 7) to his name, maybe he wants to make a little hack, he changes a bit the following string, not a serious thing :)
      Nexuiz adds a ^7 sometimes to the remaining string, and this is not problem since ^x^7 is considered as ^7

    divVerent wrote:... would be in favor of adding more codes in a more "normal" way, like another initial sequence (e.g. ^xF00 for red, x standing for "hex", or simply adding ^a to ^z, ^A to ^Z, etc.).

    1. This system is not backward compatible (not very important thing).
    2. atm I am capable to do only eaasy things in C. I have modified a bit the algorithm flow, and added the new colors. I try to understand if i can do it or not.
    3. we can still implement the system u r talking in a second time, even using it together with my system (or also deleting it).

    So, considering all, if u agree, we can use this system unless me or any other programmer will do your better system. Obviously, before applying the changes, u have to see if the result is good for u.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Wed Nov 05, 2008 8:28 pm

  • Well, what I mean is that I doubt LordHavoc would want such a system in his engine that has unintended side effects in about every existing Quake mod.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Wed Nov 05, 2008 9:23 pm

  • ok. I've understood it. I can throw my system away then.

    I try to see if I can implement your system.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Thu Nov 06, 2008 6:44 am

  • Well, it does not have to be the ^xRGB system. I already proposed a simpler system, with ^a to ^o using the player colors (and maybe putting extra colors on the remaining letters). In the engine source, you find that palette in the palette_rgb_pantsscoreboard array, and in the menu QC source, you find it in the function colormapPaletteColor(). That won't need MANY code changes, basically you just have to include the range ^a to ^o in every occasion where STRING_COLOR_TAG or maybe '^' is used and the next char compared to the 0..9 range.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Thu Nov 06, 2008 5:50 pm

  • I had already started to implement the system ^xRGB, so now I'm very very sorry to tell u that I've just implemented it :D

    Well, it does not have to be the ^xRGB system. I already proposed a simpler system, with ^a to ^o using the player colors (and maybe putting extra colors on the remaining letters). In the engine source, you find that palette in the palette_rgb_pantsscoreboard array, and in the menu QC source, you find it in the function colormapPaletteColor(). That won't need MANY code changes, basically you just have to include the range ^a to ^o in every occasion where STRING_COLOR_TAG or maybe '^' is used and the next char compared to the 0..9 range.


    Maybe i try to do this thing too
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Fri Nov 07, 2008 6:42 am

  • Well, if your ^xRGB is working, it's perfect.

    I just suggested the simpler one in case it is easier for you.,
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Tue Nov 11, 2008 3:48 pm

  • ^a to ^o using the player colors


    I was thinkin to implement instead of that (that now with ^hrgb is useless) a unique tag ^p that before a string gives the same color of the skin (shirt or pants). So if u put ^p before your name, your name will have always the same color of your skin.

    Is it a good idea?
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Next


Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest