v0.8.9 (Bugfixes + translations) released to Google Play!

Useful links
Source code of the game - Contribution guide - ATCS Editor - Translate the game on Weblate - Example walkthrough - Andor's Trail Directory - Join the Discord
Get the game (v0.8.9) from Google, F-Droid, our server, or itch.io

Mini Feature Showcase: Repeated messages in Log now have a counter. e.g. (x 3)

Discussions of the development process of the game.
Post Reply
twirlimp
VIP
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Mini Feature Showcase: Repeated messages in Log now have a counter. e.g. (x 3)

Post by twirlimp »

I'm posting this feature in a new thread because it is completely unrelated to ranged weapons (and monster AI ). :P

Update: the code now uses localisable strings from strings.xm. file. See below comments.
Basically it's a simple function that can be plugged in as-is into the current game code, and will handle the repeated messages.

Here are some pictures of various scenarios inside and outside combat.

Messages from outside combat:
Image
Messages from inside combat:
Image
Image
Last edited by twirlimp on Wed Jan 06, 2016 6:41 am, edited 3 times in total.
ideas plox
twirlimp
VIP
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Re: Mini Feature Showcase: Repeated messages in Log now have a counter. e.g. (x 3)

Post by twirlimp »

More info about the code:
Inside the actual game, the new "appendNewRepeat" is called from inside the old "append" near the end.

Also, and as can be sen from above, if the number of messages is a single digit then it will append a space before it.
This can be changed to append a 0 before the number, but it looked ugly before.

Same pics as above but with 0 instead of space.
Image
Image
[Image
ideas plox
User avatar
Zukero
Lead Developer
Posts: 2028
Joined: Thu Jul 21, 2011 9:56 am
android_version: 8.0
Location: Eclipse

Re: Mini Feature Showcase: Repeated messages in Log now have a counter. e.g. (x 3)

Post by Zukero »

This seems like a good idea overall.
twirlimp wrote:More info about the code:
Also, and as can be sen from above, if the number of messages is a single digit then it will append a space before it.
This can be changed to append a 0 before the number, but it looked ugly before.
Using spaces is always a bad idea for padding. Different devices can use different fonts, or different sizes of fonts, which will give different results visually speaking.

Moreover, when dealing with displayed text, localization must always be thought about. Appending "(x"+i+")" is not an internationalizable (yes, that's a word) method of doing it.
I'd rather have two versions of each string that can be repeated: one for the one instance, and one for the multiple instances (using a parameterized number), so that translators can find the best way to handle it.

Some languages may need to have this at the beginning of the sentence, or the fact that it's multiple times can have an impact on the rest of the sentence... you never know, and assuming as little as possible is generally a good idea when internationalizing an app. This is something I learned the hard way...
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
twirlimp
VIP
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Re: Mini Feature Showcase: Repeated messages in Log now have a counter. e.g. (x 3)

Post by twirlimp »

Zukero wrote:This seems like a good idea overall.
twirlimp wrote:More info about the code:
Also, and as can be sen from above, if the number of messages is a single digit then it will append a space before it.
This can be changed to append a 0 before the number, but it looked ugly before.
Using spaces is always a bad idea for padding. Different devices can use different fonts, or different sizes of fonts, which will give different results visually speaking.

Moreover, when dealing with displayed text, localization must always be thought about. Appending "(x"+i+")" is not an internationalizable (yes, that's a word) method of doing it.
I'd rather have two versions of each string that can be repeated: one for the one instance, and one for the multiple instances (using a parameterized number), so that translators can find the best way to handle it.

Some languages may need to have this at the beginning of the sentence, or the fact that it's multiple times can have an impact on the rest of the sentence... you never know, and assuming as little as possible is generally a good idea when internationalizing an app. This is something I learned the hard way...
Yes what you're saying is right. This is more of a mock-up anyway. :P

But are you sure there is no way but to add a new parametrized version for every single repeatable string?
There must be a way to parametrize the appended text instead.

I started working on a translation for Arabic and I admit the parameterisable ones are irritating to work with.
But I don't understand what you mean by having the parameter at the beginning of the string, unless you mean in cases where the language reads from right-to-left.
ideas plox
User avatar
Zukero
Lead Developer
Posts: 2028
Joined: Thu Jul 21, 2011 9:56 am
android_version: 8.0
Location: Eclipse

Re: Mini Feature Showcase: Repeated messages in Log now have a counter. e.g. (x 3)

Post by Zukero »

I believe that for some languages, it may be more natural to say "3 times you missed" than "You missed (x3)".

For some, it might be along the lines of "You missed once" vs "You have missed 3 times", needing to modify the whole "missed" sentence when there are multiple occurrences.

Few strings are repeatable actually. You hit, you miss, mob hits, mob misses, not enough AP...
Having two of each of these is no big deal IMHO. Having the whole log handle the repetitions, while being message-agnostic, though, would force an API change, where message senders (Combat controller for example), would need to provide two messages, leaving the log system choose which one to use depending on repetition.

Nothing impossible. Some work to do though.
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
twirlimp
VIP
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Re: Mini Feature Showcase: Repeated messages in Log now have a counter. e.g. (x 3)

Post by twirlimp »

Ah, you're right.

I'm going to work on the message-agnostic one because the number of repeatable messages will eventually grow, and this seems like a solution that would scale.

What I'll do is that I'll make the second-message parameter optional --which defaults to normal logging -- so that everything can still work while we make the new messages.
Last edited by twirlimp on Wed Jan 06, 2016 8:05 am, edited 2 times in total.
ideas plox
twirlimp
VIP
Posts: 204
Joined: Wed Dec 30, 2015 8:00 am
android_version: 4.3

Re: Mini Feature Showcase: Repeated messages in Log now have a counter. e.g. (x 3)

Post by twirlimp »

Zukero wrote:Having the whole log handle the repetitions, while being message-agnostic, though, would force an API change, where message senders (Combat controller for example), would need to provide two messages, leaving the log system choose which one to use depending on repetition.
Ok made a second message() method that excepts two strings instead of one, and handles the repeated messages.

I made repeatable copies of some messages in strings.xml with an extra formatter argument,
and went to their method call (e.g. onPlayerMissed) to pass two strings instead of one to the message method.
ideas plox
Post Reply