TheFury: How about some more colors? 16 isn't enough.

NeilStevens: A new graphics system is something I'd hope to see in ToME 3.5 or 4, but I won't count on it, heh.

TheFalcon: *counts* ... :p I've been hoping for this too really, though I expect I could live without.

TheFury: What is the big deal with adding more colors? I added more and it all works great. Here is a link: image . There are 41 colors in game now.

NeilStevens: The big deal is portability.

TheFury: Portability? It works with linux and windows. I don't have access to a mac so I can't test that part. I probably killed dos compatibility, but who really uses that anymore?

NeilStevens: Not all terminals are created equal. Anything beyond the basics can't be relied upon.

TheFury: What do you mean by terminals?

NeilStevens: Specifically I mean the terminal emulators that people run console apps in.

TheFury: How many people run tome like that? I guess my feeling is that all-around portability is nice, but more features are better. For example, I broke dos compatibility, but no one really uses dos for this anymore. I still have full windows, and linux compatibility, and probably mac compatibility.

NeilStevens: Most everyone who uses the text interface is running it in a terminal emulator of some sort.

And being portable means more than just supporting a couple platforms you happen to favor at the moment.

TheFury: would what I did break portability completely?

Actius: depends on how it's handled. Right now, colors are identified using numbers. Presumably new colors would get new numbers. If there was a way for the new numbers to map to the nearest original colors, with an option to instead map to the new colors then it's just a risk for people with old terminals -- if they have this new option on then things won't look right, if they have it off, it's no different from before, except that there's new numbers in the config files. Of course, anyone who has tweaked monster colors (or whatever colors) is going to have a config file that doesn't use the new colors, so they would probably have to go with the new defaults and then make whatever their edit was over again. Then again, if they've tweaked their monster config files maybe they don't really care about the new colors.

TheFury: Why not just throw in a copy of R_info, a_info, and k_info that don't use the new colors, anyone who is compiling for an older terminal would know enough to copy those in, while the windows/mac users don't have to do anything extra.

DarkGod: maintaining 2 sets of files ? uh that's a good way to make a mistake :) But I'm sure for more colors, if we can do it right. COuld you post your patch to have a look please?

TheFury: I changed defines.h, variable.c and init1.c, along with adding the lua bindings/wrappers/whatevers. It works under windows and at least one version of linux. This is all the code that I changed to add colors, minus the lua bindings/wrappers/whatevers. Here you go:

defines.h

#define TERM_DARK                0  /* 'd' */   /* 0,0,0 */
#define TERM_WHITE               1  /* 'w' */   /* 4,4,4 */
#define TERM_SLATE               2  /* 's' */   /* 2,2,2 */
#define TERM_ORANGE              3  /* 'o' */   /* 4,2,0 */
#define TERM_RED                 4  /* 'r' */   /* 3,0,0 */
#define TERM_GREEN               5  /* 'g' */   /* 0,2,1 */
#define TERM_BLUE                6  /* 'b' */   /* 0,0,4 */
#define TERM_UMBER               7  /* 'u' */   /* 2,1,0 */
#define TERM_L_DARK              8  /* 'D' */   /* 1,1,1 */
#define TERM_L_WHITE             9  /* 'W' */   /* 3,3,3 */
#define TERM_VIOLET             10  /* 'v' */   /* 4,0,4 */
#define TERM_YELLOW             11  /* 'y' */   /* 4,4,0 */
#define TERM_L_RED              12  /* 'R' */   /* 4,0,0 */
#define TERM_L_GREEN            13  /* 'G' */   /* 0,4,0 */
#define TERM_L_BLUE             14  /* 'B' */   /* 0,4,4 */
#define TERM_L_UMBER            15  /* 'U' */   /* 3,2,1 */
#define TERM_INDIAN_RED         16  // i
#define TERM_PINK               17
#define TERM_GOLD               18
#define TERM_ROYAL_BLUE         19
#define TERM_AQUAMARINE         20
#define TERM_DARK_ORCHID        21
#define TERM_CHOCOLATE          22
#define TERM_FIREBRICK          23
#define TERM_KHAKI              24
#define TERM_DARK_KHAKI         25
#define TERM_CADET_BLUE         26
#define TERM_STEEL_BLUE         27
#define TERM_LIGHT_STEEL_BLUE   28
#define TERM_SANDY_BROWN        29
#define TERM_ORCHID             30
#define TERM_HONEYDEW           31
#define TERM_YELLOW_GREEN       32
#define TERM_OLIVE_DRAB         33
#define TERM_PURPLE             34
#define TERM_DARK_SLATE_GRAY    35
#define TERM_SALMON             36
#define TERM_CRIMSON            37
#define TERM_MOCCASIN           38
#define TERM_DARK_SEA_GREEN     39
#define TERM_TEAL               40
#define TERM_ANTIQUE_WHITE      41
#define TERM_OLD_LACE           42
#define TERM_TAN                43

init1.c

int color_char_to_attr(char c)
{
        switch (c)
        {
        case 'd':
                return (TERM_DARK);
        case 'w':
                return (TERM_WHITE);
        case 's':
                return (TERM_SLATE);
        case 'o':
                return (TERM_ORANGE);
        case 'r':
                return (TERM_RED);
        case 'g':
                return (TERM_GREEN);
        case 'b':
                return (TERM_BLUE);
        case 'u':
                return (TERM_UMBER);

        case 'D':
                return (TERM_L_DARK);
        case 'W':
                return (TERM_L_WHITE);
        case 'v':
                return (TERM_VIOLET);
        case 'y':
                return (TERM_YELLOW);
        case 'R':
                return (TERM_L_RED);
        case 'G':
                return (TERM_L_GREEN);
        case 'B':
                return (TERM_L_BLUE);
        case 'U':
                return (TERM_L_UMBER);
                case 'i':
                return (TERM_INDIAN_RED);
                        case 'p':
                return (TERM_PINK);
                        case 'z':
                return (TERM_GOLD);
                        case 'c':
                return (TERM_ROYAL_BLUE);

                        case 'a':
                return (TERM_AQUAMARINE);
                        case 'O':
                return (TERM_DARK_ORCHID);
                                        case 'C':
                return (TERM_CHOCOLATE);
                                        case 'f':
                return (TERM_FIREBRICK);
                                                case 'K':
                return (TERM_KHAKI);
                                                        case 'k':
                return (TERM_DARK_KHAKI);
                
                                                        case 'A':
                return (TERM_CADET_BLUE);
                                                                case 'e':
                return (TERM_STEEL_BLUE);
                                                                        case 'E':
                return (TERM_LIGHT_STEEL_BLUE);

                case 'F':
                return (TERM_SANDY_BROWN);

                        case 'h':
                return (TERM_ORCHID);
                                        case 'H':
                return (TERM_HONEYDEW);
                                                        case 'I':
                return (TERM_YELLOW_GREEN);
                                                                        case 'j':
                return (TERM_OLIVE_DRAB);
                                                                                        case 'J':
                return (TERM_PURPLE);
case 'l':
                return (TERM_DARK_SLATE_GRAY);
case 'L':
                return (TERM_SALMON);
case 'm':
                return (TERM_CRIMSON);
case 'M':
                return (TERM_MOCCASIN);
case 'n':
                return (TERM_DARK_SEA_GREEN);
case 'S':
                return (TERM_TEAL);
case 'P':
                return (TERM_ANTIQUE_WHITE);
case 'q':
                return (TERM_OLD_LACE);
case 'Q':
                return (TERM_TAN);
        }

        return ( -1);
}

variable.c

byte angband_color_table[256][4] =
{
        {0x00, 0x00, 0x00, 0x00},       /* TERM_DARK */
        {0x00, 0xFF, 0xFF, 0xFF},       /* TERM_WHITE */
        {0x00, 0x80, 0x80, 0x80},       /* TERM_SLATE */
        {0x00, 0xFF, 0x80, 0x00},       /* TERM_ORANGE */
        {0x00, 0xC0, 0x00, 0x00},       /* TERM_RED */
        {0x00, 0x00, 0x80, 0x40},       /* TERM_GREEN */
        {0x00, 0x00, 0x00, 0xFF},       /* TERM_BLUE */
        {0x00, 0x80, 0x40, 0x00},       /* TERM_UMBER */
        {0x00, 0x40, 0x40, 0x40},       /* TERM_L_DARK */
        {0x00, 0xC0, 0xC0, 0xC0},       /* TERM_L_WHITE */
        {0x00, 0xFF, 0x00, 0xFF},       /* TERM_VIOLET */
        {0x00, 0xFF, 0xFF, 0x00},       /* TERM_YELLOW */
        {0x00, 0xFF, 0x00, 0x00},       /* TERM_L_RED */
        {0x00, 0x00, 0xFF, 0x00},       /* TERM_L_GREEN */
        {0x00, 0x00, 0xFF, 0xFF},       /* TERM_L_BLUE */
        {0x00, 0xC0, 0x80, 0x40},       /* TERM_L_UMBER */
        {0x00, 0xCD, 0x5C, 0x5C},       /* TERM_INDIAN_RED */
        {0x00, 0xFF, 0xC0, 0xCB},       /* TERM_PINK */
        {0x00, 0xFF, 0xD7, 0x00},       /* TERM_GOLD */
        {0x00, 0x41, 0x69, 0xE1},       /* TERM_ROYAL_BLUE */
        {0x00, 0x7F, 0xFF, 0xD4},       /* TERM_AQUAMARINE */
        {0x00, 0x99, 0x32, 0xCC},       /* TERM_DARK_ORCHID*/
        {0x00, 0xD2, 0x69, 0x1E},       /* TERM_CHOCOLATE*/
        {0x00, 0xB2, 0x22, 0x22},       /* TERM_FIREBRICK*/
        {0x00, 0xF0, 0xE6, 0x82},       /* TERM_KHAKI*/
        {0x00, 0xBD, 0xB7, 0x6B},       /* TERM_DARK_KHAKI*/
        {0x00, 0x5F, 0x9E, 0xA0},       /* TERM_CADET_BLUE*/
        {0x00, 0x46, 0x82, 0xB4},       /* TERM_STEEL_BLUE*/
        {0x00, 0xB0, 0xC4, 0xDE},       /* TERM_LIGHT_STEEL_BLUE*/
        {0x00, 0xF4, 0xA4, 0x60},       /* TERM_SANDY_BROWN*/
        {0x00, 0xDA, 0x70, 0xD6},       /* TERM_ORCHID*/
        {0x00, 0xF0, 0xFF, 0xF0},       /* TERM_HONEYDEW*/
        {0x00, 0x9A, 0xCD, 0x32},       /* TERM_YELLOW_GREEN*/
        {0x00, 0x6B, 0x8E, 0x23},       /* TERM_OLIVE_DRAB*/
        {0x00, 0x80, 0x00, 0x8B},       /* TERM_PURPLE*/
        {0x00, 0x2F, 0x4F, 0x4F},       /* TERM_DARK_SLATE_GRAY*/
        {0x00, 0xFA, 0x80, 0x72},       /* TERM_SALMON*/
        {0x00, 0xDC, 0x14, 0x3C},       /* TERM_CRIMSON*/
        {0x00, 0xFF, 0xE4, 0xB5},       /* TERM_MOCCASIN*/
        {0x00, 0x8F, 0xBC, 0x8F},       /* TERM_DARK_SEA_GREEN*/
        {0x00, 0x00, 0x80, 0x80},       /* TERM_TEAL*/
        {0x00, 0xFA, 0xEB, 0xD7},       /* TERM_ANTIQUE_WHITE*/
        {0x00, 0xFD, 0xF5, 0xE6},       /* TERM_OLD_LACE*/
        {0x00, 0xD2, 0xB4, 0x8C},       /* TERM_TAN*/


};

NeilStevens: Is this code the stuff recently announced on r.g.r.a, or your own?

TheFury: All my own. What code was announced on RGRA?

NeilStevens: Leon Marrick et. al. announced that big interface change, and I didn't remember whether additional colors were part of it.

By the way, I just checked, and according to the ncurses manpage here on Mac OS X 10.4, RGB color values are not settable. So this would be a pretty big break. That is, if ncurses doesn't support it, then it mostly defeats the purpose of making a chance to the text interface.

TheFury: What is ncurses? So you are saying if this works on Mac OS that this would be great?

NeilStevens: ncurses is the library most commonly used to implement the text interface. So if it doesn't support these new colors, these new colors just aren't portable.

TheFury: So I should see about testing this on as many different os's as possible? It works so far under ubuntuu linux, windows 98 and xp.

NeilStevens: Yeah. judging by your comments you seem far too Microsoft-biased, heh.

DarkGod: On the other hand we could just have the colors "fall back" to the 16 ones when a terminal is too dumb to allow color redefinition. And more colors is good for more than just the gcu client you know, many people play in text mode even with graphical interfaces. With the fallback this does not pose any compatibility issu does it ? If so I'm all for it

NeilStevens: With fallbacks, that's two lists of colors to maintain. Do you really want to do that?

DarkGod: No it is not :) we can have the init function do the fallback automatically

NeilStevens: How would that work? I don't think the code can guess which monsters need to be kept distinct with and without the additional colors. That needs to be done manually.

TheFury: Now, as I said repeatedly before, I know next to nothing about c coding, but what if there is a compile time switch, like USE_EXTRA_COLORS, if that switch is on, the letters in r_info.txt show up as the new colors, if it is off, the new color letters in r_info.txt are changed to an old color that is close to what the extra color would be?

NeilStevens: Depending on how the new colors are used, that's the worst possible fallback, as it might make packs of similiar monsters, with similar but distinguishable colors in the new set, look identical in the fallback set.

Orvin: Instead of using more colors, how about adding monster-dependant background colors to tiles?

NeilStevens: How about instead of adding hacks to the old code, those who want more flexibility in the display go and write a single, unified, portable SDL interface? One that supports interchangeable graphics sets, including a graphics set that uses letter and punctuation to represent everything, and thus allowing infinite, portable flexibility of color?

DarkGod: SDL means losing the terminals ports, while adding new colors just means the terminal ports will be a bit less colorfull. (Not that I am not for a SDL interface, I'm actaully all for it ;)

NeilStevens: Yeah, well, TheFury is already ready to ditch terminal ports as it is here, so I figure we're better off having him work on something that will improve ToME a great deal.

TheFury: How many people still play using the terminal ports?

TheFury: Interesting. I had Juergen(sp?) try it under linux. He was able to compile it, all the colors showed up, and tried to take an html dump. It dumped this http://home.arcor.de/juergen_frieling/test.htm . A regular .bmp or .jpg screenshot works fine. It appears that it automatically replaces colors if it can't handle them. Does anyone have access to a terminal that doesn't support the colors so we can see what happens?

NeilStevens: Remind me tomorrow to look into it, heh.

TheFury: OK, it is tomorrow, and I am reminding you. :)

NeilStevens: I realize now that I have no idea how to tell where to look for some new colors in this.

TheFury: Do you want me to give you a link to the furyband 3 beta, that has the new color code all set up, and working?

NeilStevens: I was trying ToME 3.

TheFalcon: It would appear that the colours themselves are defined in colors.prf in the pref folder. Not sure whether that's actually the case or not (or whether that's the information you wanted). :)

Actius: I'm the sort of person inclined to use a terminal interface, and there's already reasons to avoid that. The biggest one is that you only get one window (so no monster recall, which can be deadly). P.S. the way to avoid hosing existing color distinctions is to make sure that the existing color is obvious in the notation for the finer-grained colors. The new colors can be thought of as minor variations on existing colors, and it shouldn't be that hard to make sure that that's true symbolically as well. Have a base color and then some mods, for example. Or just require that the RGB triple be prefixed by the closest base color. Whatever...

TheFury: Does this mean I get in the credits for tome 3? :)

Developers Corner/Adding colors (last edited 2006-02-16 22:21:11 by cpe-72-225-141-66)