More text colors

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Sat Nov 15, 2008 3:14 pm

  • ok. I've done all the dirty work!
    I've implemented the new color management in the console, in the input field of the player name, in the nicknames autocompletion and in the players list of a server.

    Some instruction to use the new colors:

    1. ^xrgb where r, g, b are hexadecimal numbers (0-f) representing red, green and blue components of the color.

    2. ^ah where h is a hexadecimal number (0-f), sets the alpha of the following text (alpha is the contrary of transparency, so low alpha means high transparency).
    If u use ^[0-9] after a ^ah, the alpha value is ignored (old colors have its own alpha), but it will be applied when u will use again another ^xrgb. Actually, if u want to keep the transparency, don't use old colors.

    3. ^a+ or ^a- increase or decrease the previous alpha by 1. If previously the alpha isn't defined, they do nothing.

    I've tested it out well and it works fine... on Windows! I hope that all works fine also in linux and mac (there should be no problem).

    Page where download the last version of the patch: http://sites.google.com/site/terencehill/Nexuiz

    Included in the zip there is a cfg file to quickly test the new colors out: put testnewcolors.cfg in your Nexuiz/data directory, open the console and type exec testnewcolors.cfg
    Last edited by terencehill on Wed Nov 19, 2008 10:55 pm, edited 1 time in total.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Sat Nov 15, 2008 6:32 pm

  • Hi.

    I haven't tried it yet, however, I'm wondering how this mixes with the usual approach of using a normal 16 piece color palette.

    E.g. what happens when I use your modified engine on an unmodified SVN server?
    IRC quote:
    [kojn] I've been coming a bit more recently
    [kojn] she took it the dirty way
    GreEn`mArine
    Forum addon
     
    Posts: 1509
    Joined: Tue Feb 28, 2006 9:33 pm
    Location: Germany

Sat Nov 15, 2008 6:50 pm

  • @Green and all
    u type: ^xf00namered
    in nexuiz with this patch u see: namered
    in nexuiz without this patch u see: ^xf00namered

    the server is not envolved.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Sun Nov 16, 2008 7:28 am

  • Tested and it works. Great job! The only problem I find is people abusing transparency by hiding their names in order not to be kicked.

    for those, who have newer svn:
    Code: Select all
    svn co -r 5051 svn://svn.icculus.org/nexuiz/trunk nexuizsvn


    Ok, terencehill haven't changed anything in q3 color support. That means there are two ways to colorize your name:
    1) Old and q3 names compatible way ^[0,9]name
    2) New terencehill's way: ^xRGBname and independent alpha modifier: ^aHname

    The only bug I've found is that if alpha 0 and you use ^a- it overflows and gets to alpha 1. :) Does not work vice versa.
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Sun Nov 16, 2008 1:57 pm

  • your patch does not apply, you should teach your IDE to not change every \n to \r\n...

    stupid windows <.<

    okay after doing: dos2unix *.patch
    it applied
    still... it shouldn't be necessary

    EDIT:
    do svn revert console.c and apply:
    http://stud4.tuwien.ac.at/~e0725517/pat ... etion.diff
    it includes whatever your patch does to console.c and does some necessary changes to the nickcompletion code, I haven't tested it yet (there aren't many people using these colors in their nicks :P)
    so... test it :)
    I'll be using it from now on to see how it works
    User avatar
    Blµb
    Alien trapper
     
    Posts: 277
    Joined: Thu Mar 29, 2007 1:49 pm

Sun Nov 16, 2008 2:27 pm

  • Feature request: to prevent abusing of this patch,could it be possible to make the "status" command to ignore the transparency?
    "One should strive to achieve; not sit in bitter regret."
    WE ARE NEXUIZ.
    Image
    Image
    User avatar
    C.Brutail
    Laidback mapper
     
    Posts: 2357
    Joined: Tue Feb 28, 2006 7:26 pm
    Location: Ironforge

Sun Nov 16, 2008 2:36 pm

  • C. Brutail, let's say there are 3 pl with transparent nichknames. How should you know which player is misbehaving even if status removes transparency?
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Sun Nov 16, 2008 3:40 pm

  • what about a cvar for a minimum ^ah value?
    like r_min_text_alpha 0.25
    so anything below ^a4 is just the same as ^a4
    User avatar
    Blµb
    Alien trapper
     
    Posts: 277
    Joined: Thu Mar 29, 2007 1:49 pm

Sun Nov 16, 2008 7:04 pm

  • Blµb wrote:your patch does not apply, you should teach your IDE to not change every \n to \r\n...

    stupid windows <.<

    I've considered that, it's not a choice of windows but mine with Notepad++. So it's totally my fault. I will change the patch to be in unix format.


    Blµb wrote:do svn revert console.c and apply:
    http://stud4.tuwien.ac.at/~e0725517/pat ... etion.diff
    it includes whatever your patch does to console.c and does some necessary changes to the nickcompletion code, I haven't tested it yet (there aren't many people using these colors in their nicks Razz)
    so... test it Smile
    I'll be using it from now on to see how it works


    1. Tell me before if u want to work with code in which im still working. I've read this msg too late. I've just made the change and tested it and it works (tested). Div told me that he wanted to fix a function on playerlist.c and I'm not touching it.
    2. To test your patch u should connect to a server and change your name using ^xrgb colors... after that u can try as many times as u want.
    3. Analyzing your patch I guess that it doesn't work... but however I've my code is working, so we don't discuss this thing anymore...
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Sun Nov 16, 2008 7:15 pm

  • Alien wrote:Tested and it works. Great job! The only problem I find is people abusing transparency by hiding their names in order not to be kicked.

    Tnx :)
    It's the same of using a name with only spaces. Not many players uses these kind of names and they are easily recognized coz they are the unique ones on servers.

    Alien wrote:The only bug I've found is that if alpha 0 and you use ^a- it overflows and gets to alpha 1. Smile Does not work vice versa.


    U r right. But this bug is limited to the inputbox of player name, that does not affect the name directly, so the name have still the right transparency. Im gonna fixing it.

    C.Brutail wrote:Feature request: to prevent abusing of this patch,could it be possible to make the "status" command to ignore the transparency?

    Yes good idea. But I can work on that after all the more important stuffs are done.

    Btw the status command should be fixed!!! after the name it displays the informations with the last color used in the truncated version of the name... It's horrible. And also a carriage return after each player info can increase greatly the legibility. Does any1 want to fix this shit?
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Sun Nov 16, 2008 8:09 pm

  • terencehill wrote:1. Tell me before if u want to work with code in which im still working. I've read this msg too late. I've just made the change and tested it and it works (tested). Div told me that he wanted to fix a function on playerlist.c and I'm not touching it.
    2. To test your patch u should connect to a server and change your name using ^xrgb colors... after that u can try as many times as u want.
    3. Analyzing your patch I guess that it doesn't work... but however I've my code is working, so we don't discuss this thing anymore...

    I'll just look at your changes then :)
    it's not like my patch is such a huge change :)
    User avatar
    Blµb
    Alien trapper
     
    Posts: 277
    Joined: Thu Mar 29, 2007 1:49 pm

Sun Nov 16, 2008 10:40 pm

  • If some1 wants to help me with suggestions pls comment on this page:
    http://sites.google.com/site/terencehil ... evelopment
    I've done other stuffs today...

    I'm thinking of cut the alpha support coz it's a bit harder to implement (at least for me), or maybe not if some1 helps me coding the alpha thing after the rgb colors are completly implemented.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Mon Nov 17, 2008 5:27 am

  • The status thing was wrong (iirc) even with the old colors (if you are talking about misaligned strings).

    Code: Select all
    char c2 = c - (c & 128);
    http://www.asciitable.com/ - look below to see extended ASCII table
    All chars with value greater than or equal to 128 get 128 subtracted. That said if you have ▓ (178) it is changed to the value of 178-128=50, that is number 2 (check at ASCII table).

    c & 128 is bitwise and (&&). It works like this:
    abcdefgh - c in binary
    10000000 - 128 in binary
    Now it does boolean AND between appropiate bit from c and bit from 128.
    Example:
    10010110 - 150
    10000000 - 128
    150 & 128 = 1&1 0&0 0&0 1&0 0&0 1&0 1&0 0&0 = 1 0 0 0 0 0 0 0 = 10000000 = 128 in decimal

    Code: Select all
        if (d[j] == STRING_COLOR_TAG)
                    {
                        *cur++ = STRING_COLOR_TAG;
                        *cur++ = STRING_COLOR_TAG;
                    }

    Yes, ++ has precedence over *, so pointer is incremented, than dereferenced and changed into whatever STRING_COLOR_TAG is. From the name I guess it used to dump colored player names in linux console, but this is just a wild guess.

    Code: Select all
      It seems that name1 is padded with ^7 only when a ^[0-9] but not ^7
        is used in name1. Now we have to append ^7 always after a name!

    Not necessarily. The name is parsed correctly if you have ^[0,9] anywhere in your name.
    Example:
    name ^x834wow^2^x482miau
    name ^1blah
    works correctly. That means you need to parse the name every time and not only when it has ^[0,9] what I suppose current code does. Finding that place would probably fix it.
    Sorry, I can't help more because I don't know what div said to you what is wrong.
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Mon Nov 17, 2008 1:45 pm

  • Tnx for the explanations.

    After I have understood that char c2 = c - (c & 128), I was able to patch the function VM_uncolorstring [prvm_cmds.c]. Should be tested btw...

    That means you need to parse the name every time and not only when it has ^[0,9] what I suppose current code does. Finding that place would probably fix it.

    For now I don't know where...
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Tue Nov 18, 2008 12:56 am

  • I NEED some HELP: I have to know how to test some functions and to resolve a (the only one?) bug.
    Still refer to the same page http://sites.google.com/site/terencehill/Nexuiz/newtextcolorsdevelopment for more infos and to download the patch updated.

    I've removed (commenting it) completely the support for alpha change.
    The alpha can be implemented later. At least the code will have full support for rgb colors, the more important thing.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Wed Nov 19, 2008 7:09 pm

  • terencehill wrote:Btw the status command should be fixed!!! after the name it displays the informations with the last color used in the truncated version of the name... It's horrible. And also a carriage return after each player info can increase greatly the legibility. Does any1 want to fix this shit?


    .... I've fixed it. Now it's nicer to see, more readable and it displays the complete names.

    The patch for this command is needed also to display more chars in names with lots of new color tags. A name like ^xf00t^x0f0e^xf00r^x0f0ence ^4hill without this patch is shown with only 3 chars (a part the truncated tag...): ter^xf0

    Download link: http://sites.google.com/site/terencehill/Nexuiz/status.patch

    And don't forget, this patch works only in your own server.

    Image
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Wed Nov 19, 2008 9:40 pm

  • Terence, qcsrc/menu/nexuiz/inputbox.c ha changed radically recently. Your patch does not work on the current SVN.

    Also, can you please make the patch by right clicking on the menu directory. I have no clue how you did it, but it's just impossible to patch using the normal method. You should definitely use the commandline svn to make your patches, or figure out how tortoisesvn does patches.

    Oh and please, use short file names and no whitespaces for your patch files. It's a real pain to read :p
    Meh.
    User avatar
    Mr. Bougo
    Keyboard killer
     
    Posts: 760
    Joined: Mon Sep 10, 2007 3:29 pm

Wed Nov 19, 2008 9:44 pm

  • I copy the patch to both dirs and use patch < patch.patch
    Alien
    Forum addon
     
    Posts: 1212
    Joined: Tue Apr 22, 2008 7:12 am

Thu Nov 20, 2008 2:00 am

  • Patch updated.
    download here: http://sites.google.com/site/terencehill/Nexuiz

    I'm now really losing my patience.

    Div, Blub ar any other ppl that knows better the darkplace code, can plssssssss test those functions left? They are 2 and I guess that they works already, coz the patch is really simple.

    SO AGAIN, pls some1 test those fucking functions, if he knows how to do it!!!!

    Div, can u pls tell me something, since u asked me to make all stuffs I did?
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Mon Dec 01, 2008 5:29 pm

Thu Dec 25, 2008 3:22 pm

Sun Dec 28, 2008 1:08 pm

  • Hey terencehill, did you show this to the Darkplaces people ?
    User avatar
    mand1nga
    Alien trapper
     
    Posts: 321
    Joined: Mon May 12, 2008 12:19 am

Sun Dec 28, 2008 1:15 pm

  • It's been committed to the SVN DarkPlaces and Nexuiz already :p
    Meh.
    User avatar
    Mr. Bougo
    Keyboard killer
     
    Posts: 760
    Joined: Mon Sep 10, 2007 3:29 pm

Sun Dec 28, 2008 1:26 pm

  • hahahah :lol:

    amazing job terencehill !!!!!!!!!!!!!!!!!!!!!!!!!
    User avatar
    mand1nga
    Alien trapper
     
    Posts: 321
    Joined: Mon May 12, 2008 12:19 am

Thu Jan 15, 2009 7:53 pm

  • tnx :)
    I'm just returned from the holidays (no internet :( ) and I found the patch applied to the SVN, too cool :D

    I saw that div (I guess) perfected the code, adding also the color picker... awesome!

    Now everyone, even a 3 years old player (lol), knows that it's possible to color the text. Lot of ppl don't know the ^[0-9] tags too, so with Nexuiz 2.5, I expect more colored names, instead of many flat white names.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Fri Jan 16, 2009 6:31 am

  • Too bad it breaks qstat too, which most of the websites use that show player lists.

    We need someone to make a patch for qstat that adds support for these color codes.
    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

Fri Jan 16, 2009 8:13 am

Wed Jan 28, 2009 12:30 am

  • I've done the patch to qstat too: http://pastebin.com/f418a57bf

    Now qstat strips ^xrgb codes (default qstat behaviour is to strip color codes), and can generate html codes (<font color="#rrggbb">) still using the same option -htmlnames

    So qstat patched can be used exactly in the same way as before.
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Sun Feb 08, 2009 5:00 pm

  • I was asking myself: why use ^x (2 chars) and not a single char? It could be better IMO use for example *rgb rather than ^xrgb.

    In this way the tags are 4 chars instead of 5, so quicker to type and to see.
    More colors can be used on the name that has a limit of 64 chars: with ^xrgb max 10 (keeping 10+ chars to color), with *rgb max 12 (keeping 12+ chars to color).

    Instead of ^x it could be used an ascii char rarely used:

    One of these, with no compatibilty problem (I think):
    @ ? ' * &

    These ones are unusable, coz they are already used for other purposes:
    # $ %

    Is there any kind of problem using one of these chars (a part the small amount of time to chang the code)?
    User avatar
    terencehill
    Alien
     
    Posts: 176
    Joined: Thu Jul 10, 2008 10:33 pm
    Location: Italy

Sun Feb 08, 2009 6:39 pm

  • @ is in email addresses, or used as "at"
    ? is in punctuation
    ' is in it's
    * is often used to *emphasize* stuff
    & is an "and"

    Sorry, none of these should be given a special meaning.
    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

PreviousNext


Return to Nexuiz - Development




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