Goombert
|
|
Posted on: August 06, 2013, 04:24:15 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Some of you may not be aware as you have not much interaction with the plugin to LateralGM. canthelp discovered that the default font is rendered inside the plugin using Java AWT, you see ENIGMA uses sprite fonts, like every other game engine including Game Maker. So for there to be a default one, the plugin takes the default Java font and renders it and passes the glyphs over to ENIGMA. This is very dumb, this is done every time you compile, not that slow, but is part of the reason why compile is slow. It should be done internally by ENIGMA, otherwise ENIGMA basically depends on Java or something else to render that default font. canthelp discovered it when building the CLI that he could not call draw_text when he had no font resources. We should include a default sprite font with ENIGMA, what do you think Josh?
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|
|
Josh @ Dreamland
|
|
Reply #3 Posted on: August 06, 2013, 06:53:23 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Having ENIGMA exclusively as a separate binary is asinine. Syntax checking is done frequently; in an increasing number of modern IDEs, it is done continually. Are you going to have the OS spawn a process every half second or so to check the syntax of an open script? If that isn't enough to frighten you out of that idea, what about for all open scripts? Good luck.
As far as whose job it is to generate font textures, letting the plugin do it has an advantage: the IDE can pass textures it gets from anywhere. Anything goes. The disadvantage is, of course, that all IDEs must do that. Perhaps some kind of compromise is in order (eg, an option to pass a null bitmap and have ENIGMA generate the glyphs using libttf).
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
Goombert
|
|
Reply #4 Posted on: August 06, 2013, 09:35:19 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Well I don't know, I just thought maybe you hadn't given that some thought in a while Josh, because it seems like something you would traditionally be against. But I kinda get now why it is the way that it is. I just don't like ENIGMA having to rely on Java. How big are font files anyway? I think we could pack quite a few of them in at a small size if we really wanted couldn't we?
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|
|
Goombert
|
|
Reply #7 Posted on: August 07, 2013, 04:01:24 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
btw everyone, ssss is canthelp on the IRC, he is building a Command Line Interface for ENIGM'R
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
TheExDeus
|
|
Reply #8 Posted on: August 07, 2013, 08:02:32 am |
|
|
Joined: Apr 2008
Posts: 1860
|
If everyones forgotten, I found out that theres the GML function font_add that can create a font. It crashes ENIGMA right now because it never actually creates the fnt->texture, but someone should fix it for GM compatibility. That means ENIGMA has to have the ability to render a font on its own. That doesnt mean the compiler can do it though. We know about that function and it was investigated. The problem is that there is no really painless way to do it. I guess the best bet is to use libttf: http://www.freetype.org, but previously when this was investigated (years ago) either the library didn't exist in the current form or we just didn't find it (we experimented with OS level stuff, like Windows font generation functions). I haven't investigated that though.
|
|
|
Logged
|
|
|
|
Josh @ Dreamland
|
|
Reply #9 Posted on: August 07, 2013, 10:32:27 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
The default one which is always included is 128x64 with about half the texture empty. Okay, that's gross. The rectangle packer is supposed to generate an optimal map. If half the texture is empty, it means there were just enough glyphs to require one more resize (Each resize doubles the texture atlas size, for obvious reasons). Anyway, font_add isn't really my biggest concern, largely because it's ugly and inconsistent between platforms, and as Harri so elegantly pointed out, we pack a default font with each game. Yes, it would be nice to be able to acquire glyphs (especially Unicode glyphs) on demand, so we might invest in the matter down the road. The rectangle packer, despite its apparent issues, is capable of adding more glyphs on the fly, as it does not do any planning in advance. That said, perhaps we could gain a more optimal solution by providing the texture size in advance, eg, by calculating a solution, halving the larger (or vertical) side, then recomputing the map. Could you upload the texture generated on your system, Harri?
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
TheExDeus
|
|
Reply #10 Posted on: August 08, 2013, 01:22:30 am |
|
|
Joined: Apr 2008
Posts: 1860
|
Okay, that's gross. The rectangle packer is supposed to generate an optimal map. If half the texture is empty, it means there were just enough glyphs to require one more resize (Each resize doubles the texture atlas size, for obvious reasons). Well, yeah, it didn't fit in 64x64, so it expanded to 128x64. I don't see that as a big issue taking into account how tiny the texture is. Maybe later with texture atlas we could pack several fonts together into one texture. Anyway, font_add isn't really my biggest concern, largely because it's ugly and inconsistent between platforms, and as Harri so elegantly pointed out, we pack a default font with each game. Yes, it would be nice to be able to acquire glyphs (especially Unicode glyphs) on demand, so we might invest in the matter down the road. The rectangle packer, despite its apparent issues, is capable of adding more glyphs on the fly, as it does not do any planning in advance. I think libttf would be quite consistent and the more I read about it the more I think that is a good solution (and it's GPL). That said, perhaps we could gain a more optimal solution by providing the texture size in advance, eg, by calculating a solution, halving the larger (or vertical) side, then recomputing the map. Could you upload the texture generated on your system, Harri? I think they are generated the same on all systems (or at least platforms). On Windows, for example, everyone should see this: I inverted the colors so it easier to see (normally the text is white so blending works). I think it packs quite good and maybe even too tightly, because that causes rendering artifacts. Like when you render a scaled text or something, then the texture coordinate slightly goes into the other letter. This was a massive problem with GM and I see artifacts like that in ENIGMA as well. Also, the default font doesn't look so well and because of size and no AA the lines are not straight when they should be (like in X or Y), so we should at least turn AA on. That would probably make the font use more of the 128x64 texture, but it's empty anyway.
|
|
« Last Edit: August 08, 2013, 01:26:16 am by TheExDeus »
|
Logged
|
|
|
|
|
|
Goombert
|
|
Reply #13 Posted on: August 08, 2013, 05:19:19 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Harri, it was that, and it was also the half pixel alignment. I can easily fix OpenGL 3 fonts, simply add a boolean flag to GmTexture struct called isFont, and check that when looping the textures in texture_set_interpolation
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
Josh @ Dreamland
|
|
Reply #14 Posted on: August 08, 2013, 08:35:34 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Sorry, Harri; that's life. There's not a damn thing I can do about the L being just big enough to not fit. Now, as for packing tightness, that's a reaaaally easy fix. You'd just need to up the width and height of the rectangles that get passed to the packing algorithm. You'd probably also need to offset the glyphs in the texture by half that margin as to avoid artifacts from clamping on the top and left edges of the texture. Interpolation gets a little ugly when that happens. The idea is that it would not matter in most games, but we've been seeing that behavior with increasing frequency...
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|