settlers-remake icon indicating copy to clipboard operation
settlers-remake copied to clipboard

Special characters in font aren't implemented

Open tehKaiN opened this issue 5 years ago • 20 comments

When special characters are about to be drawn, the game enters exception which stops further drawing of game view. It's easily reproducible in non-english locales (e.g. Polish)

obraz

tehKaiN avatar Jul 20 '19 15:07 tehKaiN

The funny thing is that special chars are working just fine in UI. My guess is that it's not rendered the same way, right?

EDIT: After a bit of digging I see that in-game font uses predefined set of characters bound into pre-baked font atlas texture (my guess is that it comes from S3 data files?). How about generating it dynamically using TTF font?

tehKaiN avatar Jul 23 '19 17:07 tehKaiN

no you are looking at the legacy font drawer see LWJGLTextDrawer or AndroidTextDrawer

paulwedeck avatar Jul 24 '19 09:07 paulwedeck

yes, I've discovered it this morning. :)

I've hacked together a bit of code to display '?' characters when trying to display a special char that is not in pregenerated font - It fixed some cases where text printing stopped display of rest of UI, but not all. Perhaps I've not patched all needed code. Nonetheless it confirms that it's special-chars related.

I'll dig into it a bit deeper and then try to scan locale for needed chars and generate font atlas from such charset as we discussed at some point on Discord.

tehKaiN avatar Jul 24 '19 09:07 tehKaiN

I did it in 419b2e2

paulwedeck avatar Jul 24 '19 09:07 paulwedeck

It is based on the character I found in the locale_* files and therefore not complete

paulwedeck avatar Jul 24 '19 09:07 paulwedeck

But it's good enough, I guess, since it allows displaying all needed strings. That fixes this issue then. Do you want me to commit '?' replacement afterwards or do you think it's not needed after the fix?

tehKaiN avatar Jul 24 '19 09:07 tehKaiN

its not necessary because AbstractTextDrawer:222 basically does what your commit would do.

paulwedeck avatar Jul 24 '19 09:07 paulwedeck

okay, so we'll have to wait for a merge then ;)

tehKaiN avatar Jul 24 '19 09:07 tehKaiN

I also add this: obraz

"Harbour" is not displayed in the local language. Words are cut at special characters.

Version: 88ba0d98

PaweX avatar Apr 19 '20 02:04 PaweX

@PaweX Harbor is not yet localized into Polish so JSettlers will just fallback to English instead of crashing or just showing nothing.

Polish localization can be found here: https://github.com/jsettlers/settlers-remake/blob/master/jsettlers.graphics/src/main/resources/jsettlers/graphics/localization/labels_pl.properties

The English one as a reference how to call and where to place which entry: https://github.com/jsettlers/settlers-remake/blob/master/jsettlers.graphics/src/main/resources/jsettlers/graphics/localization/labels_en.properties

paulwedeck avatar Apr 19 '20 10:04 paulwedeck

Ok, I will do the translation.

P.S. how to change the language of the game? options.prp is ignored. By changing the language of SIII Gold Edition? If yes, how?

PaweX avatar Apr 19 '20 18:04 PaweX

Also, what are the guidelines for translations? I think they should be as close to original retail as possible, but isn't that the problem for the project in terms of copyright? Perhaps they should be done from scratch instead of almost copy-pasting?

tehKaiN avatar Apr 19 '20 20:04 tehKaiN

Words can't be copyrighted. If we copied all translation file and it's mechanism maybe that would be potentially a problem. But here is something new.

Yes, as close as possible to original. However with some corrections. Anyway JSettlers is a bit different. I only translate this what haven't been translated yet. I will finish it probably today. But there are some things that, very probably, will need to be updated in the future.

BTW. forester message can be sometimes very annoying. Can't it be switched off by default? Why to inform the player that forester doesn't have enough space for new trees? That's not important, especially when our settlement is already large.

PaweX avatar Apr 19 '20 20:04 PaweX

Done. #787

PaweX avatar Apr 19 '20 21:04 PaweX

@PaweX options can be set directly via the command line or via %APPDATA%.jsettlers.jsettlers or ~/.jsettlers/.jsettlers

paulwedeck avatar Apr 20 '20 08:04 paulwedeck

Ok thanks, found it. Is there any command prompt in the game? (If not it would be nice to have it.)

PaweX avatar Apr 21 '20 20:04 PaweX

There is nothing similar to a command prompt. What kind of commands are you thinking of?

paulwedeck avatar Apr 21 '20 21:04 paulwedeck

For the in-game command prompt? Many, basically debugging commands (for single player), e.g:

  • reveal the map
  • control all AI players (boolean variable)
  • player x can't lose (boolean variable)
  • see all players (reveals what other AI players can see)
  • show minerals (boolean variable)
  • show grid (boolean variable)
  • show paths (when settlers move)
  • create material (material id or name)
  • create settler (settler name or id, player id)
  • create vehicle/ship (name or id, player id)
  • create building (name or id, player id)
  • create object e.g. rock (object id or name)
  • change tower owner (player name or id)
  • some graphics commands for debugging
  • show AI army commands (like attack, go here etc. - e.g. drawn as lines on the map)
  • cast spell (spell id or name)
  • create minerals in area (mineral name or id, radius)
  • remove player (removes all buildings)
  • remove all soldiers (player id)
  • remove all settlers (player id)
  • remove all buildings but towers (player id or all)
  • remove all buildings of type (name or id, player id or all)
  • remove all settlers of type (name or id, player id or all) (including soldiers)
  • remove all vehicles/ships of type (name or id, player id or all)
  • player defeated (boolean variable)
  • become a different player (player id) (swaps between these two players)
  • peace time (how long - counting down)
  • commands for AI e.g. attack player x, don't fill towers, don't use priests and magic etc.

Here are just examples. They act as cheats, so there should be a command that makes them available like "sv_cheats 1". Personally I would like to dynamically (during the game play) reveal the map, control all AI or friendly AI and become a different player.

Command prompt would be also for notifying about warnings and errors. I am thinking about command prompt like in all games based on Source Engine (or older engines, even like Quake's engine): Half_Life2, Portal, Counter Strike etc. - it was my favourite command prompt. Or command prompt like in some other games e.g. Minecraft. I didn't like the one from Settlers IV because it was mixing messages from a game mission, game messages (e.g. you've been attacked) and command prompt and chat.

It would be nice to place "change language" option in the main menu->settings.

PaweX avatar Apr 22 '20 19:04 PaweX

--control-all lets you control all players and remove the fog of war via 'w'. Spells are not yet merged https://github.com/paulwedeck/settlers-remake/tree/priests Killing all soldiers/ships is already possible via control-all (just select all and click "kill") You could simply add a change language option to SettingsMenuPanel.java

paulwedeck avatar Apr 22 '20 21:04 paulwedeck

Thanks for the commands, I was looking for them. I may try to add it, but I am not Java programmer, (I come from C++ background. I made just one Java program at school :) ). But if you say it's simple, I can have a look at it.

PaweX avatar Apr 23 '20 19:04 PaweX