Feature request to ponder: linking figures

Non-bug comments, suggestions, and feature requests for BRPG and/or BGE
Post Reply
User avatar
Kazander
General
Posts: 367
Joined: Sat Feb 23, 2008 7:51 pm

Feature request to ponder: linking figures

Post by Kazander » Sat Sep 26, 2009 2:38 am

I discovered tonight that it would be useful if figures could be linked together, so that they move & rotate together until the link is broken.

It is a feature I would find useful when the players have horses, or are in a wagon. The wagon is particularly bad because the figures rotate around their own center, which is quite different then the wagon's. You end up moving everything separately every turn.

It's just a thought I had. As nice as the artpack mounted soldiers are, they aren't suitable for all occasions. The separate horses give you the ability to pseudo-mount any figure, but when you give it a 3x1 base it rotates differently than the 1 hex figures the players usually use.

Now I'm sure this isn't particularly simple to implement, but it would be a nice feature to have. It would probably go hand-in-hand with custom base sizes....for things like wagons, and dragons....

User avatar
Omnidon
Site Admin
Posts: 2186
Joined: Mon Feb 06, 2006 7:46 pm
Location: NY State, USA
Contact:

Post by Omnidon » Sat Sep 26, 2009 4:46 am

Ah finally, another vote for this feature. ;-)

I mentioned it ages ago in the Unit Management suggestion summary under "Synchronize Units", but there have been surprisingly few requests for it since then, despite how useful I think it would be.

User avatar
heruca
Developer
Posts: 9381
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Post by heruca » Sat Sep 26, 2009 5:13 am

Anyone care to provide me with the math/trig/calculus/whatever required to handle this? Math is not my strong point, but if someone can provide the logic, I'll gladly program in such a feature. I've always thought it would be sweet to put figures on a ship or wagon and have them rotate/re-position automatically when the ship or wagon is moved and/or rotated.
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

User avatar
Omnidon
Site Admin
Posts: 2186
Joined: Mon Feb 06, 2006 7:46 pm
Location: NY State, USA
Contact:

Post by Omnidon » Sat Sep 26, 2009 8:43 pm

Obviously linear movement just involves keeping the distance between them the same.

For rotation:

Note that for every complete revolution of an axle, the rim of the wheel also has one complete revolution

The unit being rotated is the axle (the center of the circle). The unit synchronized is on the rim of the wheel (the perimeter of the circle). The distance between them is the spoke of the wheel (the radius of the circle).

EDIT: The following article details programmatic circular rotation clearly:
http://www.jjgifford.com/expressions/ge ... tions.html
http://www.jjgifford.com/expressions/geometry/circular_functions.html wrote:For any point on a circle with radius r, the X-coordinate is given by r*cos(A) and the Y-coordinate is given by r*sin(A) ” where A is the angle in radians from the horizontal.

Image

... we just need to add these x and y offsets to the center's coordinates to get our [unit]'s new position

Some general principles of rotation:

Wikipedia Two Dimensional Rotation
Wikipedia wrote:Where (x,y) is rotated by θ and the coordinates after rotation are (x',y'):

Image
or
Image
Wikipedia Sine & Cosine
Wikipedia wrote:The sine of an angle is the ratio of the length of the opposite side to the length of the hypotenuse. In our case:
Image

Image

The cosine of an angle is the ratio of the length of the adjacent side to the length of the hypotenuse. In our case
Image

Image
Note that for circles, the radius is the hypotenuse in these formulas.

I'm pretty sure Lingo includes functions for Sine and Cosine, which will do much of the work for you.

In addition to moving the synchronized unit from (x,y) to (x',y'), be sure to also apply the rotation directly to the unit, or it'll end up acting like the seat of a ferris wheel.
Image
Last edited by Omnidon on Mon Sep 28, 2009 11:58 am, edited 7 times in total.

markuwp
General
Posts: 104
Joined: Tue Aug 25, 2009 9:44 am
Location: Durham, NC USA

pseudo-mounted figures

Post by markuwp » Mon Sep 28, 2009 1:11 am

I found a bit of a work-around to mount 1 hex warriors on 3x1 hex mounts. I put my rider on the head of the mount and then used the figure offset to move him back one square (the horizontal adjustment was something like -200). It's not perfect, but works pretty well. Of course, if the figure dismounts you have to reedit the figure properties to get him into his own hex.

You can also do some linked moving and rotating just by selecting multple figures, though it doesn't reposition them when you rotate so wouldn't work figures on a boat or anything like that.

Mark
Kazander wrote:I discovered tonight that it would be useful if figures could be linked together, so that they move & rotate together until the link is broken.

It is a feature I would find useful when the players have horses, or are in a wagon. The wagon is particularly bad because the figures rotate around their own center, which is quite different then the wagon's. You end up moving everything separately every turn.

It's just a thought I had. As nice as the artpack mounted soldiers are, they aren't suitable for all occasions. The separate horses give you the ability to pseudo-mount any figure, but when you give it a 3x1 base it rotates differently than the 1 hex figures the players usually use.

Now I'm sure this isn't particularly simple to implement, but it would be a nice feature to have. It would probably go hand-in-hand with custom base sizes....for things like wagons, and dragons....

User avatar
Omnidon
Site Admin
Posts: 2186
Joined: Mon Feb 06, 2006 7:46 pm
Location: NY State, USA
Contact:

Post by Omnidon » Mon Sep 28, 2009 12:00 pm

btw heruca, in case you missed it in my original post, the following article's explanation should make programming this feature much easier:
http://www.jjgifford.com/expressions/ge ... tions.html

User avatar
heruca
Developer
Posts: 9381
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Post by heruca » Sat Nov 14, 2009 12:18 pm

Yay! I've made some real progress in figuring out the trig functions required to implement this feature. :D

Thanks for the links, Omnidon.

Now the question is, do I implement the feature in a recursive manner, or just one level deep? In other words, say I anchor a rider to a horse, and then I put the horse on a boat. If the boat is moved and rotated, presumably the horse AND the rider should move & rotate as well. And I should be able to move the horse without moving the boat.

I'd also like to hear everyone's thoughts as to how to implement the feature, in terms on an intuitive UI. Should I add a "Anchor to..." command to a unit's contextual popup menu, with a submenu listing all the other units on the map? Should it be impossible to anchor a unit to more than one other unit? Is "Anchor" a good term for this feature, or can you think of a better one?
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

User avatar
Omnidon
Site Admin
Posts: 2186
Joined: Mon Feb 06, 2006 7:46 pm
Location: NY State, USA
Contact:

Post by Omnidon » Sat Nov 14, 2009 6:24 pm

heruca wrote:Is "Anchor" a good term for this feature, or can you think of a better one?
I originally referred to it as a "synchronize" feature, but actually I like the term "anchor" for it as well.
heruca wrote:do I implement the feature in a recursive manner, or just one level deep? In other words, say I anchor a rider to a horse, and then I put the horse on a boat. If the boat is moved and rotated, presumably the horse AND the rider should move & rotate as well. And I should be able to move the horse without moving the boat.
The best way to implement this may be in the form of two separate features. Perhaps you could make use of both the aforementioned terms to do this.
  1. (Context Menu -> Synchronize)
    - The ability to sync units so that they *always* move and rotate together. Useful for horseback riding, troops moving in formation, AoE graphics, and so forth.
  2. (Context Menu -> Anchor)
    - The ability to anchor units to a surface so that they are moved and rotated along with that surface, but can still move independently of the surface itself. Useful for boats, airships, large flying carpets, etc, not to mention the potential for pre-populating large dungeon tiles with deployments of Orcs and such then dragging the tiles into place later.
heruca wrote:Should I add a "Anchor to..." command to a unit's contextual popup menu, with a submenu listing all the other units on the map?
Eww, steer clear of extremely long context menus.
heruca wrote:I'd also like to hear everyone's thoughts as to how to implement the feature, in terms on an intuitive UI.
Simply linking units together without any hierarchy ("Sync") would be as simple as selecting all the desired units and choosing "Sync" from a context menu or hitting a sync hotkey.

Adding hierarchy ("Anchor", as proposed above) would be a bit trickier, though you could theoretically use the same method and just have it anchor the selected units to the lowest unit in the stack by default.

Another intuitive method of linking things together that I've seen before is the point and click approach. After choosing Anchor/Sync from a context menu, you could potentially be given a special cursor that allows you to specify the other units you intend to link the current unit to.

One option would be to use the point and click method when the user has fewer than two units selected, and to use the other method when multiple units are selected.
heruca wrote:Should it be impossible to anchor a unit to more than one other unit?
Given all of the above suggestions then:
  • Each unit should be able to "sync" with an unlimited number of units. (A formation can be any size.)
  • Each unit should be able to act as the "anchor" for an unlimited number of units. (A boat can have any number of things on it.)
  • Each unit may only be "anchored" to a single unit at a time. (A person can only be on one boat at a time.)
  • If two anchors (e.g. boats) are sync'd with eachother, then the units they are anchoring act as if they are anchored to both anchors (since rotating one boat also rotates the other along with all the units on top of it), but the true anchor for each of those units is still stored separately in case the boats get unsynchronized later.
  • Anchors can have anchors. (Units might be anchored to a lifeboat, which is in turn anchored to its mothership, which is in turn anchored to a "City Docks" dungeon tile.)

User avatar
Kazander
General
Posts: 367
Joined: Sat Feb 23, 2008 7:51 pm

Post by Kazander » Sun Nov 15, 2009 3:05 am

Well, I'd love to add something constructive here, but I think Omnidon has covered it so thoroughly that there's little I can add. I think Omnidon has spent a lot of time thinking about this one already....

So....."what he said". :)

Other possible terms you could use would be 'link' or 'bind'. I'm not really sold on 'synchronize', but I do like 'anchor'.

User avatar
Omnidon
Site Admin
Posts: 2186
Joined: Mon Feb 06, 2006 7:46 pm
Location: NY State, USA
Contact:

Post by Omnidon » Sun Nov 15, 2009 4:28 am

Kazander wrote:Other possible terms you could use would be 'link' or 'bind'. I'm not really sold on 'synchronize', but I do like 'anchor'.
The problem I had with "link" and "bind" was that they were a bit generic and could be used in reference to other features, thus creating the possibility for confusion.

I agree that something sounds a little off with "Synchronize", though it sounds a bit better if you shorten it to "Sync". I suppose you could argue that someone might confuse it for something related to initiative though.

Other possible terms would be "Formation", "Conjoin", "Group", "Unite", "Attach", and "Yoke".

User avatar
pyroknight
Captain
Posts: 51
Joined: Sat Sep 13, 2008 11:58 am

Post by pyroknight » Mon Nov 16, 2009 3:16 pm

I'm also very interested in this feature.

On the bright side Heruca, you were probably going to need to add this feature to BRPG: wargames edition anyway. Might as well get a head start on it. *hint, hint

User avatar
heruca
Developer
Posts: 9381
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Post by heruca » Mon Nov 16, 2009 3:27 pm

Quite correct.

I'm excited at the possibilities this feature may allow for. I'm thinking of things like corner-based pivoting of a formation of soldiers (or a single car counter in a Car Wars game).
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

User avatar
heruca
Developer
Posts: 9381
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Post by heruca » Thu Nov 19, 2009 1:02 pm

I think I'll go with the terms "Group" and "Anchor".

I like the idea of automatically anchoring selected units to the lowest unit in the stack.
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

User avatar
heruca
Developer
Posts: 9381
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Post by heruca » Fri Nov 20, 2009 11:17 pm

LOL! Due to some bad math while trying to implement the "Anchor" feature, I accidentally came up with a "Follow the Leader" behavior. :lol:

I'm saving the code for later use, as it's too late to try to squeeze it into v1.5.
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

User avatar
heruca
Developer
Posts: 9381
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Post by heruca » Tue Nov 24, 2009 3:53 pm

OK, the good news is that both the "Anchor" and the "Group" commands have been implemented.

However, the bad news is that a hard-to-find/fix bug (probably in my math) is affecting both of those new features, so that they do not work very well except under specific conditions. Once I can get that bug fixed, I'll be ready for final testing of BRPG v1.5 prior to releasing it.
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

User avatar
heruca
Developer
Posts: 9381
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Post by heruca » Sat Nov 28, 2009 1:01 am

Try as I might, I can't seem to fix that darn bug (see prior post). Been trying the last 4-5 days and I'm just going around in circles and getting nowhere. So I may go ahead and release v1.5 anyway, and try to fix the bug in some future update. :?
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests