msokalski / ascii-patrol

Ascii Patrol is an ASCII game project. It was mainly inspired by "Moon Patrol", my favourite arcade game at the times I was a child.
GNU General Public License v3.0
221 stars 20 forks source link

White background intended? #12

Closed clort81 closed 4 years ago

clort81 commented 4 years ago

Hello, wonderful game. I love the menus so much. Studying your code atm.

Duirng actual gameplay, I get a offwhite background with kitty, qterminal, termit, lxterminal and xfce4-terminal. https://0x0.st/z68Q.png Can this be made black?

Is this white set in LANDSCAPE::Scroll in game.cpp?

Also, with xterm and urxvt I get no keyboard input during 'Press Any Key' but maybe that should be a seperate issue.

Btw the lowest cpu (game + xorg) use so far seemed to be in kitty terminal emulator.

cheers! asciipatrol_000

ascii-patrol 1.5.0 alpha (git master from Nov 14, 2019) aarch64 g++ (Debian 8.3.0-23) 8.3.0

msokalski commented 4 years ago

Hi, I don't see anywhere white background on your shots. Do you mean light grey color? If so, it is intended, thought you should be able to tweak standard 16c palette in the terminal settings, looks like currently you use xterm color scheme which barely matches intended colors, it should be switched to linux terminal color scheme aka standard VGA palette.

Regarding keyboard input it's another issue, game tries to capture key presses and releases right from x11 on focused window during startup and in the case of listed terminals it failed I think.

Unfortunately i use gnome in all my setups, I'd be very happy to pull your commit if you find a way to read keyboard on other terminals.

clort81 commented 4 years ago

Is there somewhere in the code I can tweak bg colors? Maybe there is a quick hacky way, and also a way that would allow for some broader utility in the form of 'palette themes'?

clort81 commented 4 years ago

Regarding dependency on particular terminal palette: delme I generally need to stick with irc 16-color palette as shown (not exact, personal preference). Sadly i do not see the "linux" or "vga" palette in presets, but i'll see if the xfce folks will add it for us. I also find no way to save my preferred colors into a named preset, which would enable me to create my own vga palette.

I do see: spec_nix.cpp:static int ansi_set_color_rgb(int fg, int bg) Can I run ascii-patrol with rgb ansi color, bypassing term palette issues?

clort81 commented 4 years ago

Sorry to chainpost but i wanted to share this as well: I found that game runs with ansi_set_color_rgb() instead of _ex, but colors only map properly in monochrome.

It looks like we could add a lookup table mapping the indexed colors to rgb values here.

If we could load the 16-color 'linux' palette from a textfile, then render rgb for 24bit color, we could avoid color differences with palettes. This would additionally allow people to make custom palettes to suit their preferences.

If I cat /sys/module/vt/parameters/default_{red,grn,blu} > ~/myconsolecolors i get 0,170,0,170,0,170,0,170,85,255,85,255,85,255,85,255 0,0,170,85,0,0,170,170,85,85,255,255,85,85,255,255 0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255

each line represents r,g,b

then setvtrgb ~/myconsolecolors should apply my changes, but errors out...

So i guess I'm still interested in the ansi_set_color_rgb with custom palettes... The current code doesn't get me colors close to intended ones for some reason: fg&0xff,(fg>>8)&0xff,(fg>>16)&0xff, bg&0xff,(bg>>8)&0xff,(bg>>16)&0xff);

clort81 commented 4 years ago

`static const int myclut[]= { / This should be the VGA palette, i think / 0,169, 0,169, 0,169, 0,169, 87,255, 87,255, 87,255, 87,255, 0, 0,169, 87, 0, 0,169,169, 87, 87,255,255, 87, 87,255,255, 0, 0, 0, 0,169,169,169,169, 87, 87, 87, 87,255,255,255,255, };

// RGB color
return printf("\x1B[48;2;%d;%d;%dm\x1B[38;2;%d;%d;%dm",
    myclut[bg],myclut[bg+16],myclut[bg+32],
    myclut[fg],myclut[fg+16],myclut[fg+32]);

` gives me these colors - do they look correct? fsd

msokalski commented 4 years ago

Yes latest shot is exact match with intended colors :)

If you wish to modify colors of backgrounds and sprites, the best way would be to modify them in .xp files from assets directory using rexpaint editor then regenerate assets.cpp file with temp_xp program.

Rexpaint site: gridsagegames.com/rexpaint