Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
clort81 opened this issue Aug 28, 2021 · 10 comments
Open

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

clort81 opened this issue Aug 28, 2021 · 10 comments

Comments

@clort81
Copy link

clort81 commented Aug 28, 2021

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
Copy link
Author

clort81 commented Aug 28, 2021

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

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

@macdice
Copy link
Owner

macdice commented Aug 28, 2021

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.

macdice added a commit that referenced this issue Aug 28, 2021
Graphics from clort81: #8

This isn't finished yet, they're a bit too close together and more
work is needed on some other sprites.  For now it's a secret option:

ascii_invaders --unicode
macdice added a commit that referenced this issue Aug 28, 2021
Graphics from clort81: #8

This isn't finished yet, they're a bit too close together and more
work is needed on some other sprites.  For now it's a secret option:

ascii_invaders --unicode
@clort81
Copy link
Author

clort81 commented Aug 29, 2021

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
Copy link
Owner

macdice commented Aug 29, 2021

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
Copy link
Owner

macdice commented Aug 29, 2021

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
Copy link
Author

clort81 commented Aug 30, 2021

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

@macdice
Copy link
Owner

macdice commented Aug 30, 2021

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
Copy link
Author

clort81 commented Aug 31, 2021

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

  • Feature: add a centered display mode where invader quantity equals original (11x5 invaders) regardless of term size

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
Copy link
Author

clort81 commented Aug 31, 2021

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

@clort81
Copy link
Author

clort81 commented Sep 2, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants