itsapi / pycraft

A Minecraft-inspired game for the terminal
GNU General Public License v2.0
197 stars 21 forks source link

Suggestion: Custom font #133

Open segeljakt opened 7 years ago

segeljakt commented 7 years ago

Have you considered creating a custom font for the game which is loaded when the game starts? For example see my game: https://media.giphy.com/media/d1E2GIbl1ulFhxNS/giphy.gif. It makes things look nice and also makes it possible to do more fine-grained collision detection. I used http://www.pentacom.jp/pentacom/bitfontmaker2/ to create the font and I have made it work on Mac, I have not tried on Linux but it should be plausible.

olls commented 7 years ago

That's a cool idea! I would like as much as possible for the game to work with as little user configuration as possible, but we could try an optional font to enhance the game. So far we've been using Unicode with fallbacks to ASCII, so a font layer on top could work in a similar way.

Could you elaborate on the collision detection, how does having a custom font help?

segeljakt commented 7 years ago

In my game it looks like this without a custom font: (1) https://media.giphy.com/media/l0Exd4LeEMBQEioAU/source.gif

With a custom font, each symbol physically takes up 8x8 pixels but visually takes up 16x16: (2) https://media.giphy.com/media/l3q2wqJKrCEZ7Vrr2/giphy.gif

If symbols in the custom font would physically take up 16x16 and visually take up 16x16 (similar to Unicode and ASCII), it would look like this: (3) https://media.giphy.com/media/l3q2uM3t6c4y3UKxq/giphy.gif

The custom font (2) improves collision because units do not need to be aligned with the block grid, so the units can collide in more places on each block.

olls commented 7 years ago

Ah I see, that's really cool. That would be good to try out in Pycraft at some point and see if it is worth keeping (and made to be backwards compatible with default font).