purpose of [move_unit_fake]

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
denispir
Posts: 184
Joined: March 14th, 2013, 12:26 am

purpose of [move_unit_fake]

Post by denispir »

I don't understand the actual purpose of [move_unit_fake]. I think I understand that it is intended to be used in conjonction with [hide_unit] and [unhide_unit], but why? Is it only to spare processor power, since actually moving a unit must be costly? Or are there cases where we can, or should, only move a unit "fakely"?

More generally, it would be nice if all WML tag-blocks were introduced by a purpose section, short or not. Else, we presume that learners already know everything (but details), which is quite funny ;-). Where should they have learnt everything but there where features are presented? Actually, the purpose is the most basic and important thing to learn and know: the rest is coding details.

If I have time and energy (moral, mainly), i will participate in improving learning documentation; I am supposed to be rather good at that, and have already start a little. But it would be cool if others join in, starting with placing such purpose sections on every page they visit; well, once they have understood: thank to hard experimentation, which i pretty heavy and annoying with WML, or maybe thank to this forum.

User avatar
Iris
Site Administrator
Posts: 6678
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: purpose of [move_unit_fake]

Post by Iris »

[move_unit_fake] exists since time immemorial for the purpose of implementing cutscenes, when the proper [move_unit] didn’t exist and there wasn’t any other way to move a unit on the map without the player (or an AI) performing the action. There isn’t much else to say about it.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm (now available for Wesnoth 1.14).

denispir
Posts: 184
Joined: March 14th, 2013, 12:26 am

Re: purpose of [move_unit_fake]

Post by denispir »

shadowm wrote:
November 3rd, 2019, 1:23 pm
[move_unit_fake] exists since time immemorial for the purpose of implementing cutscenes, when the proper [move_unit] didn’t exist and there wasn’t any other way to move a unit on the map without the player (or an AI) performing the action. There isn’t much else to say about it.
Thank you very much.

Side-question: in many scenarios, when we see a group of units moving, usually when entering or leaving the "stage", they are moved one after the other all along the path, which is (for me) extremely annoying, even at the very first play of the scenario. Is there any alternative?
If not, I am ready to implement (via Lua) a a new block [move_units_together] that would do just what it says. In your opinion (of all reading this), is it interesting for others, or just me?

User avatar
octalot
Developer
Posts: 477
Joined: July 17th, 2010, 7:40 pm

Re: purpose of [move_unit_fake]

Post by octalot »

Many thanks if you will implement this, it's a long-standing feature request. #1266

User avatar
Celtic_Minstrel
Developer
Posts: 1654
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: purpose of [move_unit_fake]

Post by Celtic_Minstrel »

denispir wrote:
November 3rd, 2019, 3:40 pm
Side-question: in many scenarios, when we see a group of units moving, usually when entering or leaving the "stage", they are moved one after the other all along the path, which is (for me) extremely annoying, even at the very first play of the scenario. Is there any alternative?
If not, I am ready to implement (via Lua) a a new block [move_units_together] that would do just what it says. In your opinion (of all reading this), is it interesting for others, or just me?
Isn't this exactly what [move_units_fake] (note the plural) does? (Except for the fact that it's fake movement and not real movement.) Though I've never used it myself, so I could be wrong…
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

denispir
Posts: 184
Joined: March 14th, 2013, 12:26 am

Re: purpose of [move_unit_fake]

Post by denispir »

Celtic_Minstrel wrote:
November 3rd, 2019, 4:11 pm
Isn't this exactly what [move_units_fake] (note the plural) does? (Except for the fact that it's fake movement and not real movement.) Though I've never used it myself, so I could be wrong…
Well, I also thought initially. But then I thought at all those scenarios where units move one after the other, that I have never seen units move together, and that this instruction tag-block is old...
But I will try, and come back here to tell you ;-).

User avatar
octalot
Developer
Posts: 477
Joined: July 17th, 2010, 7:40 pm

Re: purpose of [move_unit_fake]

Post by octalot »

That FR is about the missing functionality in [move_units_fake].

denispir
Posts: 184
Joined: March 14th, 2013, 12:26 am

Re: purpose of [move_unit_fake]

Post by denispir »

octalot wrote:
November 3rd, 2019, 4:07 pm
Many thanks if you will implement this, it's a long-standing feature request. #1266
Great! Yet another mission for me ;-). This one is fun, however!

EDIT: just saw your last note. I can implement it in Lua as a new tag, not improve the present [move_units_fake] unless it is in Lua, which is improbable, since shadowm talked about old times... I cannot or rather don't want to touch C++ (which I can read) because it is, for me at least, hopeless disprortionate amount of effort, imo. Well you understand... If Wesnoth were written in D instead, or another primitive prog lang, for humans rather than for dark elves... ;-)
However, once the feature implemented, it should be easy and fast to translate (even in C++). Also, we can then do the same for [move_unit] (non fake, to avoid forcing [hide] + [unhide] for a whole group of units).

User avatar
sergey
Posts: 473
Joined: January 9th, 2015, 9:25 pm

Re: purpose of [move_unit_fake]

Post by sergey »

I recently decided to use move_unit_fake instead of move_unit here #4539, because unit should start (and end) its movement in village and I didn't want it to capture the village. I still had to create a unit, because there is no animate_unit_fake command and wanted to show its attack animation.
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.

User avatar
Celtic_Minstrel
Developer
Posts: 1654
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: purpose of [move_unit_fake]

Post by Celtic_Minstrel »

You're correct, [move_unit_fake] and [move_units_fake] are among the few tags still implemented in C++. However, for what it's worth, [move_unit] is implemented in Lua. Maybe that can help you.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
Iris
Site Administrator
Posts: 6678
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: purpose of [move_unit_fake]

Post by Iris »

The issue with [move_units_fake] is simply that the animation engine (at the time at least, but to my knowledge this hasn’t changed in the last 10 years) didn’t have the ability to animate more than two adjacent units at a time, other than idle and standing animations which have the implicit guarantee that the units will not change position and therefore the render invalidation extents are more or less well-known (bugs with larger-than-one-hex standing animations have cropped up multiple times in the past).

So it’s not about Lua vs. C++, it’s about figuring out a way to break free of render engine design restrictions.

(Also, for the record, that tag is much newer than the original MUF and still older than the addition of the Lua engine. I guess it can be hard to grasp the scale of Wesnoth’s development timeline since it’s been around for 16 years now.)

Also, with regards to your concern with MUF’s workflow (which doesn’t seem that much of an issue to me unless you are seriously overestimating the amount of time these operations take or refuse to use [move_unit] for some reason) you could perhaps look into [do_command]. I haven’t used it myself since I’ve been writing WML since long before any of these newer tags existed.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm (now available for Wesnoth 1.14).

User avatar
Adamant14
Posts: 905
Joined: April 24th, 2010, 1:14 pm

Re: purpose of [move_unit_fake]

Post by Adamant14 »

You should be able to set the direction in which the unit is facing, it looks strange when a group of units is moving next to each other and not all are looking in the direction of movement.
Wiki wrote: [move_units_fake]

moves multiple images of units along paths on the map. These units are moved in lockstep.

force_scroll: (Version 1.15.0 and later only) Has the same meaning as in [move_unit_fake] but a different default.
[fake_unit]: A fake unit to move
type: the type of unit whose image to use
x: a comma-separated list of x locations to move along
y: a comma-separated list of y locations to move along (x and y values are matched pairs)
side: the side of the fake unit, used for team-coloring the fake unit
skip_steps: the number of steps to skip before this unit starts moving
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR

Post Reply