Wargaming - Wheeling turns

Virtual tabletop software specifically designed for boardgames, wargames, card games and dice games
Post Reply
User avatar
BrotherAirplane
Cannon Fodder
Posts: 4
Joined: Tue Aug 25, 2015 1:25 am
Location: New Mexico

Wargaming - Wheeling turns

Post by BrotherAirplane » Thu Aug 27, 2015 8:35 am

Hello!
I'm new to battlegrounds and to these forums. I hope that I'm posting in the correct place.
I purchased BGE a couple days ago in hope that I could continue gaming with a good friend that moved away. I've been messing around with the program a bit but I was wondering if there is support for wheeling your units. That is a rotation or pivot around one of the front corners of a unit, or group of units, similar to what you would see in De Bellis Antiquitatis or Field of Glory. I've attached a picture from the Field of Glory rulebook that will better explain what I mean.
wheeling.png
wheeling.png (348.7 KiB) Viewed 3148 times
Is this kind of rotation supported in BGE?

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

Re: Wargaming - Wheeling turns

Post by heruca » Thu Aug 27, 2015 10:16 pm

Welcome, BrotherAirplane.

No, such movement isn't currently supported in BGE. But I would very much like to add that feature in version 2. It would be very useful to have for miniature games.

I just hope I can figure out the math necessary to implement it. That's not my strong point. :oops:

In the meantime, if your troops are depicted by a single graphic, you can place a small marker on the pivoting corner, then rotate the troop unit, and reposition the troop unit so that the corner matches its original location.

Can I assume you would need to be able to pivot on any of the four corners, forward or backward? Would the pivot maneuver need to be constrained by how far the opposite corner of the formation gets moved?
: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: 9364
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Re: Wargaming - Wheeling turns

Post by heruca » Thu Aug 27, 2015 10:21 pm

If anyone is aware of an open-source program that has such a feature, please point me to it, since it might help if I can sort through the code to see how they implemented the feature. Thanks.
: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:

Re: Wargaming - Wheeling turns

Post by Omnidon » Fri Aug 28, 2015 12:56 am

heruca wrote:If anyone is aware of an open-source program that has such a feature, please point me to it, since it might help if I can sort through the code to see how they implemented the feature. Thanks.
http://help.adobe.com/en_US/Director/11 ... -7bf4.html

The second example from the adobe documentation shows how to rotate around an arbitrary point in Director, assuming the syntax hasn't changed too much in the newer versions.

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

Re: Wargaming - Wheeling turns

Post by heruca » Fri Aug 28, 2015 1:05 am

Unfortunately, that's strictly for 3D, and not available for bitmap sprites.
: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:

Re: Wargaming - Wheeling turns

Post by Omnidon » Fri Aug 28, 2015 1:11 am

Ah. Well how are you rotating it currently? You could probably just change the registration point from the center to the corner and rotate on the new registration point using the normal rotation method.

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

Re: Wargaming - Wheeling turns

Post by Omnidon » Fri Aug 28, 2015 1:31 am

Omnidon wrote:Ah. Well how are you rotating it currently? You could probably just change the registration point from the center to the corner and rotate on the new registration point using the normal rotation method.
http://help.adobe.com/en_US/Director/11 ... -7e93.html
^ that's probably the method you are currently using.
A bitmap rotates around the registration point of the image.

User avatar
BrotherAirplane
Cannon Fodder
Posts: 4
Joined: Tue Aug 25, 2015 1:25 am
Location: New Mexico

Re: Wargaming - Wheeling turns

Post by BrotherAirplane » Fri Aug 28, 2015 6:06 am

heruca wrote: I just hope I can figure out the math necessary to implement it. That's not my strong point. :oops:

In the meantime, if your troops are depicted by a single graphic, you can place a small marker on the pivoting corner, then rotate the troop unit, and reposition the troop unit so that the corner matches its original location.
That should help for now. Thank you!
I would be more than willing to help with any math that is required. I've done something similar to this in a project of my own and I do remember it being a bit more complex than I first expected.
heruca wrote: Can I assume you would need to be able to pivot on any of the four corners, forward or backward? Would the pivot maneuver need to be constrained by how far the opposite corner of the formation gets moved?
For the games that we are playing, only the front two corners are used for turning. It couldn't hurt to add support for pivoting around all four corners though. There might be a game out there that would use them.

User avatar
BrotherAirplane
Cannon Fodder
Posts: 4
Joined: Tue Aug 25, 2015 1:25 am
Location: New Mexico

Re: Wargaming - Wheeling turns

Post by BrotherAirplane » Sat Aug 29, 2015 3:26 am

I've found an article that might help in addition to the links that Omnidon has provided. It explains the algorithm in Javascript but it should be easy to implement in anything else.

Here's the important stuff:

Code: Select all

angle = (angle ) * (Math.PI/180); // Convert to radians
var rotatedX = Math.cos(angle) * (point.x - center.x) - Math.sin(angle) * (point.y-center.y) + center.x;
var rotatedY = Math.sin(angle) * (point.x - center.x) + Math.cos(angle) * (point.y - center.y) + center.y;
And here's the article if you're interested: http://www.gamefromscratch.com/post/201 ... point.aspx

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

Re: Wargaming - Wheeling turns

Post by heruca » Sat Aug 29, 2015 9:58 am

Thanks, that might help.

You should know that for BGE v1.7 I am working on fixing the currently-buggy Group and Anchor features, which will be the foundation of this pivot/sweep feature.
: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
BrotherAirplane
Cannon Fodder
Posts: 4
Joined: Tue Aug 25, 2015 1:25 am
Location: New Mexico

Re: Wargaming - Wheeling turns

Post by BrotherAirplane » Sat Aug 29, 2015 5:46 pm

Awesome! I'm very happy that I picked up this program :D

Post Reply