macdice / ascii-invaders

An ASCII-art game like Space Invaders
GNU General Public License v2.0
43 stars 10 forks source link

If you want, here's unicode braille invaders. #8

Open clort81 opened 3 years ago

clort81 commented 3 years ago

They're not exact copies of original, but they could fit. Depending on the font, the gap can be pretty big between lines.

⢀⡴⣾⢿⡿⣷⢦⡀⢀⡴⣿⢦⡀⢀⡵⣤⡴⣅⠀⣴⡶⢿⡿⢶⣦⠀⢀⣀⣾⣷⣀⡀⠀
⠉⠻⠋⠙⠋⠙⠟⠉⢈⢝⠭⡫⡁⠏⢟⡛⣛⠏⠇⠩⣟⠫⠝⣻⠍⠀⣿⣿⣿⣿⣿⣿⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢀⡴⣾⢿⡿⣷⢦⡀⢀⡴⣿⢦⡀⣆⡵⣤⡴⣅⡆⣴⡶⢿⡿⢶⣦⠀⢀⣀⣾⣷⣀⡀⠀
⠉⠻⠋⠙⠋⠙⠟⠉⠨⡋⠛⢙⠅⢘⠟⠛⠛⢟⠀⣉⠽⠫⠝⠯⣉⠀⣿⣿⣿⣿⣿⣿⠀

The ugly bit is utf8 in c.

clort81 commented 3 years ago

You could also do sub-character (1-pixel) horizontal shifts:

⢀⡴⣾⢿⡿⣷⢦⡀⢀⡴⣿⢦⡀⢀⡵⣤⣤⢮⡀⢠⣶⠾⣿⠷⣶⡄⠀⣀⣰⣿⣆⣀⠀
⠉⠻⠋⠙⠋⠙⠟⠉⢈⢝⠭⡫⡁⠏⢟⡛⢛⡻⠹⠈⢽⡛⠭⢛⡯⠁⢸⣿⣿⣿⣿⣿⡇
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣠⢶⡿⣿⢿⡶⣄⠀⣠⢾⡷⣄⠀⣨⢦⣤⡴⣅⠀⣴⡶⢿⡿⢶⣦⠀⢀⣀⣾⣷⣀⡀
⠈⠙⠟⠉⠛⠉⠻⠋⠁⡩⡫⢝⢍⠸⠹⣛⠛⣛⠏⠇⠩⣟⠫⠝⣻⠍⠀⣿⣿⣿⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢀⡴⣾⢿⡿⣷⢦⡀⢀⡴⣿⢦⡀⣆⡵⣤⣤⢮⣰⢠⣶⠾⣿⠷⣶⡄⠀⣀⣰⣿⣆⣀⠀
⠉⠻⠋⠙⠋⠙⠟⠉⠨⡋⠛⢙⠅⢘⠟⠛⠛⠻⡃⢈⡩⠟⠭⠻⢍⡁⢸⣿⣿⣿⣿⣿⡇
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⣠⢶⡿⣿⢿⡶⣄⠀⣠⢾⡷⣄⢰⣨⢦⣤⡴⣅⡆⣴⡶⢿⡿⢶⣦⠀⢀⣀⣾⣷⣀⡀
⠈⠙⠟⠉⠛⠉⠻⠋⠁⢝⠙⠋⡫⠀⡻⠛⠛⠛⢟⠀⣉⠽⠫⠝⠯⣉⠀⣿⣿⣿⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
macdice commented 3 years ago

Thanks! They look great. I pushed an experimental change to use them, run with new non-advertised "--unicode" option. Seems like some more work is needed to space them out better, and maybe also do explosions and shelters with Braille.

clort81 commented 3 years ago

That's awesome. utf-8 in C can be a bit difficult. the unicode ones aren't displaying for me (tried mlterm, terminology, uxterm) The braille invaders display as a lot of "M-bM- for me

title screen :

                            __ _ ___  ___(_|_) (_)_ ____   ____ _  __| | ___ _ __ ___
                           / _` / __|/ __| | | | | '_ \ \ / / _` |/ _` |/ _ \ '__/ __|
                          | (_| \__ \ (__| | | | | | | \ V / (_| | (_| |  __/ |  \__ \
                           \__,_|___/\___|_|_| |_|_| |_|\_/ \__,_|\__,_|\___|_|  |___/

                                                M-bM-"~@= ?  pointsbM-#M->M-bM-"M-?M-bM-!M-?M-bM-#M-7M-bM-"M-&M-b
M-!~@                                           M-bM- ~IM-bM- M-;M-bM- ~KM-bM- ~YM-bM- ~KM-bM- ~YM-bM- ~_M-bM- ~I

                                                M-bM-"~@= 30 pointsbM-#M-?M-bM-"M-&M-bM-!~@
                                                M-bM-"~HM-bM-"~]M-bM- M--M-bM-!M-+M-bM-!~A

                                                M-bM-"~@= 20 pointsbM-#M-$M-bM-!M-4M-bM-#~E
                                                M-bM- ~OM-bM-"~_M-bM-!~[M-bM-#~[M-bM- ~OM-bM- ~G

                                                M-bM-#M-= 10 points-bM-"M-?M-bM-!M-?M-bM-"M-6M-bM-#M-&
                                                M-bM- M-)M-bM-#~_M-bM- M-+M-bM- ~]M-bM-#M-;M-bM- ~M

Sometimes this is caused by not setting LC envvars correctly: I had LC_MESSAGES=en_US.UTF-8 And tried adding: LC=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

I'm not familiar with ncurses and mvprintw. Maybe it's a problem with 'char' on my system. (devuan linux, aarch64). I'm sorry i can't be more helpful.

macdice commented 3 years ago

On my FreeBSD system it looks like this:

`

                      _ _   _                     _
        __ _ ___  ___(_|_) (_)_ ____   ____ _  __| | ___ _ __ ___
       / _` / __|/ __| | | | | '_ \ \ / / _` |/ _` |/ _ \ '__/ __|
      | (_| \__ \ (__| | | | | | | \ V / (_| | (_| |  __/ |  \__ \
       \__,_|___/\___|_|_| |_|_| |_|\_/ \__,_|\__,_|\___|_|  |___/

                            ⢀⡴⣾⢿⡿⣷⢦⡀= ?  points
                            ⠉⠻⠋⠙⠋⠙⠟⠉

                            ⢀⡴⣿⢦⡀   = 30 points
                            ⢈⢝⠭⡫⡁

                            ⢀⡵⣤⡴⣅   = 20 points
                            ⠏⢟⡛⣛⠏⠇

                            ⣴⡶⢿⡿⢶⣦  = 10 points
                            ⠩⣟⠫⠝⣻⠍

               https://github.com/macdice/ascii-invaders

`

Some time soon I'll test on Linux and macOS and see if I can figure out what's wrong there...

macdice commented 3 years ago

Oh yeah I see the same corruption on Gnome Terminal on a Debian system. Funnily enough if I log into FreeBSD remotely through the Gnome Terminal on the same Debian system, it shows correctly. In both environments my LANG and LC_CTYPE are set to en_NZ.UTF-8. Hrmph.

clort81 commented 3 years ago

program should link against the ncursesw library (-lncursesw) to use UTF-8, rather than just ncurses (-lncurses

macdice commented 3 years ago

Oh yeah, that fixes it! Now, I think we need to sort out the bombs (they kind of zigzag on the real game), the shields, the explosions, and the spacing...

clort81 commented 3 years ago

✓Agree: For unicode mode, seperate invader columns horizontally by an additional character

I think the spinning diagonal ascii bombs you have look pretty good, but there are some options with unicode Problem is most terminal fonts don't cover the exotic glyphs.

Player/enemy shot: 
┃ block drawing character (pretty common)

Enemy shots: 
╋ block drawing character (pretty common)
✝ U271D latin cross 
⭍ U+2B4D Downwards Triangle-Headed Zigzag Arrow (rare)
⦚ U+299A Vertical Zigzag Line (rare)

Looking at the original in MAME, it looks like shots cycle between these shapes:
⢹⠁⢺⠂⢼⠄⣸⡀⢐⠅⠨⡂⠀

Alien explosions are not animated in original - odd number of columns:
⠐⢄⠑⠐⢁⠔
⢉⠔⢀⢀⠐⢌⠁
Even number of columns (matching current alien schema)
  ⠢⡑⠀⢊⠔⠀
⠈⡡⢂⠀⡐⢌⠁
If later alien explosion can get another frame, this could be the 'kernel' of it 
⢄⣀⡠
⠝⠛⠫

Original game shields are almost as wide as 1.5 columns of aliens.  Four of them, with a full shield's space between them:
⣠⣾⣿⣿⣿⣿⣿⣿⣷⣄⠀⣠⣾⣿⣿⣿⣿⣿⣷⣄⠀⣠⣾⣿⣿⣿⣿⣷⣄⠀
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⣿⣿⣿⣿⣿⣿⣿⣿⠀
⣿⣿⠟⠉⠉⠉⠉⠻⣿⣿⠀⣿⡿⠋⠉⠉⠉⠙⢿⣿⠀⣿⡿⠋⠉⠉⠙⢿⣿
clort81 commented 3 years ago

Shield damage in the original is interesting. Would take some programming to emulate the pixel-based damage.

clort81 commented 3 years ago

Turns out there's only three alien bomb shapes. This is a dive into the original: https://computerarcheology.com/Arcade/SpaceInvaders/