Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[floating_text] is too fast #4347

Open
doofus-01 opened this issue Sep 14, 2019 · 15 comments · May be fixed by #4429
Labels

Comments

@doofus-01
Copy link
Member

@doofus-01 doofus-01 commented Sep 14, 2019

The WML tag [floating_text] is too fast, as the title says. It's not that recent an issue, but I'm not sure when it started.
https://wiki.wesnoth.org/InterfaceActionsWML#.5Bfloating_text.5D

Put this event in HttT scenario 01_The_Elves_Besieged.cfg and move Konrad a step (this avoids complications like dialogs popping up).

[event]
name=moveto
[filter]
id=Konrad
[/filter]
[floating_text]
x,y=19,23
text="<span color='#cccc33'>" + _ "Your text here" + "</span>"
[/floating_text]
[/event]

If there is a key to specify the speed, it's not documented on the wiki, and it's not 'time'.
EDIT: This is BfW 1.14, I have no idea about 1.15.

@stevecotton

This comment has been minimized.

Copy link
Contributor

@stevecotton stevecotton commented Sep 14, 2019

The speed is hardcoded in game_display::float_label(), so no way for WML to override it. It is affected by the game acceleration speed, so if you're playing at 16x speed there's no chance to read it.

@doofus-01

This comment has been minimized.

Copy link
Member Author

@doofus-01 doofus-01 commented Sep 14, 2019

Also too fast to read at 1x speed.

@gfgtdf

This comment has been minimized.

Copy link
Contributor

@gfgtdf gfgtdf commented Sep 14, 2019

Also too fast to read at 1x speed.

It it really specific to floating_text? That is is it really faster than for example the green numbers when a unit is healed at the start of a turn?

@doofus-01

This comment has been minimized.

Copy link
Member Author

@doofus-01 doofus-01 commented Sep 14, 2019

Seems so, yes.
EDIT: Interestingly, if you mix it up with another floaty-text thing like [harm_unit], the results are a bit different. The last string is still too fast though.

[event]
name=moveto
[filter]
id=Konrad
[/filter]
[floating_text]
x,y=19,23
text="<span color='#cccc33'>" + _ "Your text here" + "</span>"
[/floating_text]
[harm_unit]
[filter]
id=Delfador
[/filter]
amount=10
animate=yes
delay=100
[/harm_unit]
[floating_text]
x,y=19,23
text="<span color='#cccc33'>" + _ "Your text here" + "</span>"
[/floating_text]
[/event]

@gfgtdf

This comment has been minimized.

Copy link
Contributor

@gfgtdf gfgtdf commented Sep 15, 2019

I'm quite sure that both harm_unit and floating_text are implemented in lua and call the same lua function to display the text

@doofus-01

This comment has been minimized.

Copy link
Member Author

@doofus-01 doofus-01 commented Sep 15, 2019

Ah, yes, I assumed for some reason harm_unit worked, but it is also too fast if it is by itself.

@jostephd jostephd added the Bug label Sep 15, 2019
@jostephd

This comment has been minimized.

Copy link
Member

@jostephd jostephd commented Sep 15, 2019

Is this just a matter of changing the magic numbers in the function @stevecotton identified, or is there more to it than that?

proposed values
--- a/src/game_display.cpp
+++ b/src/game_display.cpp
@@ -616,8 +616,8 @@ void game_display::float_label(const map_location& loc, const std::string& text,
 	flabel.set_font_size(font::SIZE_XLARGE);
 	flabel.set_color(color);
 	flabel.set_position(get_location_x(loc)+zoom_/2, get_location_y(loc));
-	flabel.set_move(0, -2 * turbo_speed());
-	flabel.set_lifetime(60/turbo_speed());
+	flabel.set_move(0, -1 * turbo_speed());
+	flabel.set_lifetime(225/turbo_speed());
 	flabel.set_scroll_mode(font::ANCHOR_LABEL_MAP);
 
 	font::add_floating_label(flabel);

@doofus-01 When posting code segments please use multiline text areas, delimited by ``` on a line by itself, that will preserve indentation.

@gfgtdf

This comment has been minimized.

Copy link
Contributor

@gfgtdf gfgtdf commented Sep 15, 2019

Is this just a matter of changing the magic numbers in the function @stevecotton identified, or is there more to it than that?

Doofus said it onle effected the last loationg message shown, so I'd say no.

@jostephd

This comment has been minimized.

Copy link
Member

@jostephd jostephd commented Sep 16, 2019

@gfgtdf Ah! I had tested with two [floating_text] and didn't see the problem, but when I test the example from #4347 (comment) I do see the problem. So it's not what I thought it was.

@gfgtdf

This comment has been minimized.

Copy link
Contributor

@gfgtdf gfgtdf commented Sep 16, 2019

adding a [delay] after the [floating_text] also seems to workaround this issue.

@gfgtdf

This comment has been minimized.

Copy link
Contributor

@gfgtdf gfgtdf commented Sep 16, 2019

the set_lifetime function

// set the number of frames to display the text for, or -1 to display until removed
void set_lifetime(int lifetime) {

says its measured in 'frames' so maybe during event excution there are just less frames per second?

@gfgtdf

This comment has been minimized.

Copy link
Contributor

@gfgtdf gfgtdf commented Sep 16, 2019

thinking about it didn't @jyrkive recently removed the fps cap by default? That could have caused the bug.

Hmm probably not as from the commitmessage if only added an option which is disabled by default.

In any case i think measuring the liftime in 'frames' is probably a bad idea.

@jostephd

This comment has been minimized.

Copy link
Member

@jostephd jostephd commented Sep 16, 2019

While testing this with one floating_text and with different magic numbers in game_display::float_label, I noticed that the speed at which the text moved varied. When the text appeared it moved up about a hex's height very quickly, and then it moved the rest of the way more slowly.

@jyrkive

This comment has been minimized.

Copy link
Member

@jyrkive jyrkive commented Sep 17, 2019

@gfgtdf The FPS cap is still enabled by default.

@jostephd

This comment has been minimized.

Copy link
Member

@jostephd jostephd commented Sep 17, 2019

Similar: #3607 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.