ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Feature requests and bug reports
forum topic indicator Coppercube really needs some work on 2D text
person icon
dekon_17
Registered User
Quote
2024-09-13 15:33:31

So, Coppercube has a bit of a problem when it comes to 2D text rendering. Setting a big font size makes letters disappear, some fonts may look "glitchy", and that is without mentioning that italic fonts just look bad.
embedded external image
🔎︎

One thing I also found out, you don't really need to just set the font big to break text. It will happen if player, say, has a higher screen scaling (which is set in Windows, display options). While, sure, you probably won't encounter text disappearing with english language, the same can't be said about other languages. It's bad, because, you know, I want to make a localization for my game. And, guess what? It's barely possible due to such restrictions.
Now, I will mention that I was talking about this problem before. But I did this in another thread, where I was talking just about some quirks of russian translation of Coppercube. However, one thing I got wrong at first was that it was the problem with "disappearing text" was unique to this language. It's not. In fact, it is universal.
When you open a project (or launch it, I'm not sure yet) that has 2D overlays with text, try looking up C:\Temp folder. You'll see .bmp files of fonts.
embedded external image
🔎︎

When checking those images, depending on the font size, some characters may be gone.
embedded external image
🔎︎

Font on the right only fits some english and... some other characters. The one on the left shows pretty much everything. Kind of. I guess.
Here you can also find out why letters screw up when set to italic: they're out of their "bounding box", indicated by these lil' dots around them.
embedded external image
🔎︎

Is there any way such thing could be fixed in the future?
Also, correct me if I got something wrong here. After all, I do not specialize in such stuff.

person icon
guest_Guest
Guest
Quote
2024-09-13 16:49:02

Try using the launcher thing by JIC, it has some sort of fix for the fonts as mentioned on the itch.io page.

person icon
guest_guest
Guest
Quote
2024-09-13 17:25:23

This can help you guys to get rid of problems with installed system fonts:

https://hadoken-records.itch.io/...
embedded external image
🔎︎


person icon
guest_guest
Guest
Quote
2024-09-13 18:03:03

Yeah, but if you need a free alternative then try "duzakh" game on itch.io or there was a github repo with some code that does the text based on images, i read in somepost here on forum, i don't remember the author name though.

person icon
dekon_17
Registered User
Quote
2024-09-14 08:29:30

Tried using just_in_case's launcher, but it's just... Black screen. Hadoken's bitmap toolkit looks promising, but all I can see about it on its page is just... A banner for it. Like, I have no idea what it does. And, regardless, I'm not really comfortable right now spending dat sweet $$$ on a possible solution.

The image-based text, however... I think I can do something like this. And, after all, having even more ridiculous effects on screen would be cool and fitting for the game. The only thing I'm a bit worried about is that it may be a bit... problematic to make, considering that I've decided to slap a whole bunch of fonts into my game, to have somewhat of a "chaotic" look for it.

However, I'll have to see how this text works with non-english letters. From personal experience, I know it's not easy.

Edit 1: apparently, just_in_case's launcher requires the game to be called "game.exe" to work. For some reason.
Edit 2: the launcher doesn't fully fix the problem. Certain letters were missing. But, at least it's fixing it to some extent.


person icon
guest_Guest
Guest
Quote
2024-09-14 09:49:06

After fiddling with the search, I finally found the github repo, I was talking about.

https://github.com/vazahat/Coppe...

person icon
dekon_17
Registered User
Quote
2024-09-14 10:25:21

Thanks for providing the link, guest_Guest.

Looking through the code, I can see that it may not work well with other languages.
for(var i =0;i < this.text.length; i++)
...
ccbDrawTextureRectangleWithAlpha("font//"+strCase+this.text.charAt(i)+".png", ...)

I did the same thing with my 3D text code, and, well, here's the thing: because I want to add localization, it means that the game needs, say, a text file containing afformentioned localization. When the code reads it, however... It will not be the same text, if we talk about different languages. Here's how my log file looks, after writing a text from localization file:
 ')

That's because of UTF-16LE. Using UTF-8 is not going to work perfectly either, because a single letter may consist of multiple symbols (or something like that, according to some test I've conducted), which makes text longer, which makes the script write a bunch of symbols instead of actual text.

So, in the end, I don't think it will work. Much like my 3D text, which works in a similar way. I may try to work on making the thing differentiate between certain letters and even spaces (russian letter '?' appears as ' ' with UTF-16LE, which makes my script believe that there is no letter). Same wouldn't happen with regular Coppercube text, which is the reason I've been talking about it specificaly.

I may try working on it, maybe I can still get it to work, but my expectations are already on the bottom.

person icon
hadoken
Registered User
Quote
2024-09-14 11:01:11

Thank you people for mentioning my bitmap font extension. I have added a free demo video to the itch.io project page showing how to use it.
https://hadoken-records.itch.io/...

The nice thing about bitmap fonts is that you can style them particularly well with paint tools like Gimp adding color gradiends, shadows, glows, etc., which is not really possible with system text as far as I know. (see example image at bottom)

Plus the text in your games really looks the same on ever computer no matter what system fonts installed because the game ships its own text components.

embedded external image
🔎︎


person icon
guest_Guest
Guest
Quote
2024-09-14 11:01:18

Isn't it possible to use the English alphabet in code while displaying images of letters from another language?
For example, if you want to write "??????" (which means "hello" in Russian), you could map the Russian letters to English equivalents like this:

? = p,
? = r,
? = i,
? = v,
? = e,
? = t.

Internally, you would use "privet," but display "??????" on the screen. Would this approach work?

person icon
guest_Guest
Guest
Quote
2024-09-14 11:06:27

The forum also don't support characters from different language.

@hadoken, i checked the extension is still paid though, while it seems to be doing the same thing as the github code.

Ooo you mean you made the video free, i thought you made the extension free.

person icon
guest_guest
Guest
Quote
2024-09-14 11:32:03

checked both, the github approach doesn't provide a simple solution to easily convert any installed system font into bitmap font in no time which @hadokens solution does plus offering static and dynamic text handling with overlays and planes

person icon
dekon_17
Registered User
Quote
2024-09-14 13:14:53

Isn't it possible to use the English alphabet in code while displaying images of letters from another language?

I mean, theoretically, I can kind of make it be formated as "[lang. file]-[ASCII char.]", something like "rus-c" being for letter '?'. At least, that's my plan. I'm not all too sure on how to make it yet, will see about that. But the problem here is the whole thing being not so "user-friendly". Sure, I may be able to make english and russian localizations, but the rest is up to other people, since these two are the only languages I know. And, while as a programmer of this whole thing, I will understand how to work with it, I'm not sure it's going to be an easy task for others.

Guess I'll have to improvise.

person icon
VP
Guest
Quote
2024-09-17 08:03:15

a bitmap font, replaces the letters with images - not only is it possible to use letters from different languages (yet still typing using English letters), you could even completely replace the letters with pictograms, glyphs, runes, icons, emojis/ animation frames for sprites etc.

...think of a font as simply remapping the keycodes to call a ttf/otf/bitmap image (or actually any asset). A common application for 'fonts' in games is to assign each text character to an image (bitmap), 3D model or sound etc.

Fonts are commonly recognised as text-character/type-faces but you can create a modular font-library of all kinds of different assets, which are then referenced/called/placed in the game, using different keycodes (or combinations).

Using Fonts in this way are great for speedy level-mapping and intuitive/random procedural-generation.

person icon
just_in_case
Moderator
Quote
2024-09-18 14:01:22

yeah, it's pretty easy to use bitmap fonts for anyking of text or image based rendering.

Actually that's my github account. I totally forgot about that AW.js thing, it was a project I was working with collaboration to make Coppercube capable of doing animations, based on custom skeleton and rigs, but when I found that I can use irrlicht engine for almost everything, I stopped creating things from scratch but the code is still there. It was actually planned to create a custom game engine out of CopperCube itself.

So I want creating that menu and other text stuff with colored and textured rectangles, it is originally using the bitmap font's from an external directory but one can easily embed them in the game manually, or something like that. I did had plan to convert that into a usable extension with spritesheet in past I also mentioned many times this on forum. But never got any time and then totally forgot about this repo, as the code doesn't exist on my PC, but it is on github repo.

Yeah, regarding the inbuilt Coppercube font I fixed the rendering issue by adjusting the Glyphs a bit, but Coppercube doesn't allow any method for now to make them work for itallic font.

Maybe a new font tool can help in fixing this, I will look into it more.

But you can always use either bitmap fonts, or just use Images of the text.
You can also create something like Font-awesome Icons pack or something like that. I am thinking of creating that myself to be honest.

You can use something like "fa-Person" and it will show a person icon, so yeah with bitmap fonts you can use a lot of methods.

person icon
dekon_17
Registered User
Quote
2024-09-19 19:51:56

Huh... Okay, I'll see what I can do with that (bitmap-based text), it sounds quite promising.

In regards to the fix to the text renderer, I still had some letters removed, although it's not all that bad (you know, having most letters present is much better than having no letters). Problem is, this fix is not currently in the base engine. The reason I made this thread in the first place was to point out the bug (hence the category), and to provide as much known information about it. So, I hope it's going to get patched in future.

Anyway, thank you guys for pointing out possible solutions, I'll try my best to figure something out and, hopefully, make it to "just work".


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |