![]() |
why does angband still use .fon files ?
I was looking at -
Code:
~/games/angband-master/lib/fonts$ ls There are so many foss fonts nowadays . Just to ideate there are 514 packages (font number will be higher in Debian) . See - Code:
$ aptitude search fonts | wc -l https://en.wikipedia.org/wiki/TrueType https://en.wikipedia.org/wiki/OpenType#Open_Font_Format https://en.wikipedia.org/wiki/OpenType They also will work better on mobiles and SBC's if it were deployed as most platforms have support for all three font formats shared. |
The answer to a lot of questions like "why does Angband still do X?" is because no-one made it not do that yet. Plus, I think most of the Angband maintainers have enjoyed hacking on the game and weren't/aren't particularly interested in learning how to write e.g. a new Windows frontend, or learning how to use SDL. The platform-specific bits of Angband are for sure the least modified and least loved bits of the game. Pending people who like frontend work showing up and doing some stuff, the frontends mostly stay unmodified for years at a time.
EDIT: Also, Angband is very different on different platforms. Windows and SDL use the .fon files, but Mac doesn't, and neither does the X11 port, or curses. |
Quote:
Code:
If it's the latter, we could simply use one or more fonts to make the game look attractive without much cost. I have 806 fonts when I have not installed all the font packages in Debian archive - Code:
$ fc-list | wc -l Unicode fonts could be another idea perhaps https://en.wikipedia.org/wiki/Unicode_font One idea could perhaps be to use the popular noto font which is used quite a bit. https://web.archive.org/web/20160303...ts.debian.net/ |
Quote:
|
Quote:
Quote:
|
Takkaria--i agree bitmaps were better choices with low resolution screens. But those are few and far between these days. Spline-fit fonts are a much better choice now.
|
.fon files are really just tilesets. IMO, it would be easier to use bmp or png file with glyphs + text file with coordinates (exactly like tiles in lib/tiles).
In fact, for my project, I've written a tool that makes such tilesets out of vector font files :) If someone wants it, I can send it to you (the tool is written in D, so you'll also need a D compiler from https://dlang.org/). |
t4nk-
It turns out to be a performance penalty to use tiles instead of glyphs. You can see the difference when running and sometimes on redraws. |
Quote:
Quote:
* which is, btw, not trivial and can involve such things are running bytecode on a virtual machine (part of so-called "hinting")... |
It can be surprisingly difficult to render a large grid of anything without getting performance penalties. I discovered that when writing the Pyrel UI. The naive approach (just tell your GUI widget library to render a text symbol for every tile in view on every update) is horrifically slow. Getting clever about remembering which portions of the screen have changed and only rerendering those helps, but then scrolling the view is also horrifically slow (because every single tile "changes"). So then you start saying "well, the scrolled view re-uses a lot of tiles from the previous view, so I'll keep the previous view around, redraw it at an offset, and then draw the new/updated tiles on top of that" and you have fairly complex drawing logic that's still really not all that fast.
As for tilesets vs. software-rendered fonts, I can absolutely believe that it's faster to blit a texture to a tile than it is to draw an "@". After all, drawing the "@" involves first converting the vectors to a raster image and then...converting that raster to a texture and blitting it. :) A pre-rendered tileset of the kind t4nk describes is super common in gaming. You can load the entire tileset into your GPU's memory and then just send a payload to the GPU saying "render this tile here, render that tile there", and it can draw the entire screen without having to go back to the CPU for more information. |
Quote:
Quote:
(And let's not even get started with shaders... :) ) |
Quote:
|
Were you drawing to the screen or to a backup buffer? As earlier post says, doing the latter, then blitting everything into place makes a big difference (and eliminates the flicker.)
|
Oh sure, I'm well aware of double-buffering. I think I was CPU-bound though.
If you're really curious, the Pyrel code is still up on BitBucket. |
Ah, right it was 1 Python function call per glyph then? I'm not sure about Python specifically, but in many languages going across the "VM" -> native barrier can be quite costly, so if you were incurring that cost for every tile then it's suddenly starting to make a lot more sense :).
There's also just the fact that the standard Python interpreter is itself quite slow compared to native/JIT'ed languages and even compared to Lua IIRC. |
All times are GMT +1. The time now is 04:38. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.