Latest Posts

Topic: Completion of a map by symmetry

gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 37
Ranking
Pry about Widelands
Location: France
Posted at: 2015-01-22, 10:27

einstein13 wrote:

I'm not a mathematician, but physycist. I know that rotations aren't very hard for computer: there is only rotation matrix with sin and cos functions. Of course the implementation will be a bit harder, but still possible.

i'm mathematician and i can tell you that here , we don't even need cos or sin .... i'll write you formulae soon , when i'll have the time to read the post about geometry and the way coordinates are implemented in WL (i saw that columns "zigzag" so i've to solve this very little problem)

But in my opinion the blank spaces should be filled by "background" type of terrain. You should have a possibility to create all the map with one type of terrain and keep it as "background". face-smile.png That would help a lot.

that's what i thought , with unbuildable desert , or swomp , or snow , or lava , or ....


Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1060
Ranking
One Elder of Players
Location: Poland
Posted at: 2015-01-22, 18:39

gnarfk wrote:

that's what i thought , with unbuildable desert , or swomp , or snow , or lava , or ....

Yes, most of background is unvuildable for maps (water), but sometimes people want to have buildable ones (green grass). It should be another option to build a whole world with one background first.

And how can you make rotation without sin/cos function? Rotation with 30, 45, 60, ... degree? Is it possible? Maybe yes (on triangle-shaped map), but for me it is too much work and it is quite in unobvious for lots of people. But if you do it clearly, I can explain it face-smile.png (I like explanations ;P )


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/

Top Quote
gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 37
Ranking
Pry about Widelands
Location: France
Posted at: 2015-01-22, 19:00

einstein13 wrote:

And how can you make rotation without sin/cos function? Rotation with 30, 45, 60, ... degree? Is it possible? Maybe yes (on triangle-shaped map), but for me it is too much work and it is quite in unobvious for lots of people. But if you do it clearly, I can explain it face-smile.png (I like explanations ;P

in our triangle shaped map , rotations of 60° are easy to write without cos/sin. to get the expression of a linear application, we only need the images of 2 non-colinear vectors.

Here if we choose for the base :

vector that moves right . (1;0)

vector that moves top (between top right and top left , it doesn't fall exactly on a vertex of the map but it isn't a problem). (0;1)

the rotation of 60° of the first one will be (0.5 ; 1) . and the rotation of the second one will be ( -0.75 ; 0.5). with that , we get the expression of our rotation.

then , if a vertex is at coordinates (x ; y ) (from the rotation center) , its image will have coordinates ( 0.5 x - 0.75 y ; x + 0.5 y )

in the right coordinate-system , we do not need neither cosine nor sine functions.

Edited: 2015-01-22, 19:00
Top Quote
wl-zocker
Joined: 2011-12-30, 17:37
Posts: 494
Ranking
Tribe Member
Location: Germany
Posted at: 2015-01-22, 20:58

Wouldn't it be easier to use two vectors parallel to triangle sides as a base (e.g. (1; 0) and (0.5; 1) in your coordinate system)? That should avoid fraction numbers (the coordinates have to be integers).

The next problem is how the triangles change: right/down may be swapped, and maybe they even change the field they belong to.


"Only few people know how much one has to know in order to know how little one knows." - Werner Heisenberg

Top Quote
gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 37
Ranking
Pry about Widelands
Location: France
Posted at: 2015-01-22, 21:13

to be honest , my first idea was this base, but it doesn't match with the actual coordinate system. althought it is possible to calculate new coordinates for this.

(in this base with the "right" and "top right" vectors , rotation of 60° is : (x , y ) -> ( - y , x + y ) )

this "non integer" system i used in my last post the closest to the one which is used . we only have to add the 0.5 to some vertices , depending on whether they are on the right or left side of the zig zag. (and to remove these 0.5 if needed afterwards to have integer coordinates)

for the triangles , down becomes the right of his image , and right becomes the down triangle of the images top right neighbour ...

Edited: 2015-01-22, 21:18
Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1060
Ranking
One Elder of Players
Location: Poland
Posted at: 2015-01-23, 02:42

gnarfk wrote: (...) then , if a vertex is at coordinates (x ; y ) (from the rotation center) , its image will have coordinates ( 0.5 x - 0.75 y ; x + 0.5 y ) (...) we do not need neither cosine nor sine functions.

You calculated sine and cosine functions and paste final values. But this things aren't universal.

If we want to make any other rotation, we have to create another function/ method. After 6 different rotations (30, 45, 60, 90, 120, 180 deg) we will have 6 very simmilar functions, one for each rotation degree.

My idea is to have only one function for every rotation. It can calculate sine and cosine value once, create matrix (2x2), maybe modified a little (for zig-zag map) and then calculations of rotations will be only multiplying and sums, as your explanation. For me it will be easier to test and modify, if needed.


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/

Top Quote
gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 37
Ranking
Pry about Widelands
Location: France
Posted at: 2015-01-23, 07:19

einstein13 wrote:

gnarfk wrote: (...) then , if a vertex is at coordinates (x ; y ) (from the rotation center) , its image will have coordinates ( 0.5 x - 0.75 y ; x + 0.5 y ) (...) we do not need neither cosine nor sine functions.

You calculated sine and cosine functions and paste final values. But this things aren't universal.

No i didn't. These values were not calculated with sine and cosine. we don't use a "orthonormal base". (if this were the case, we would have needed sine and cosine ...)

If we want to make any other rotation, we have to create another function/ method. After 6 different rotations (30, 45, 60, 90, 120, 180 deg) we will have 6 very simmilar functions, one for each rotation degree.

The 60° rotation is natural with our triangle structured map. Rotations of angles that are not multiples of 60 will have bad results, as the image of vertex of the map will not be a vertex ....

My idea is to have only one function for every rotation. It can calculate sine and cosine value once, create matrix (2x2), maybe modified a little (for zig-zag map) and then calculations of rotations will be only multiplying and sums, as your explanation. For me it will be easier to test and modify, if needed.

with my function it is possible to have rotations of 60°,120°,180°,240°,300° with only 1 function, as we can use the rotation multiple times to get the other.


Top Quote
LAZA
Avatar
Joined: 2010-05-22, 12:34
Posts: 49
Ranking
Pry about Widelands
Location: Winterhill, Swabia, Germany
Posted at: 2015-01-23, 13:55

+1 for that option.

especially while playing the map "Desert Tournament" (in the tournament) this map is regard to this point a bit unfair:

  • Gold is only found on the northern sides on both of the mountains in the middle
  • Coal and Ore are only found south on these mountains

So the player(s) sitting in the south has to circle around and therefore needs an important (extensive) furthermore wider expansion than the other player(s).


* Dell X58 *
Xeon W3680 @ 3.33 GHz
M391B5673FH0-CH9 - 12 GB @ 1.33 GHz
R7260X-DC2OC-1GD5 DirectCU II OC
SP900 64 GB SSD = root; ST3000VX000-1ES1 = home; 2x WD2003FYPS-2 = pub
BDR-208D
-
* Manjaro Testing Xfce *

Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1060
Ranking
One Elder of Players
Location: Poland
Posted at: 2015-01-23, 17:25

gnarfk wrote:

einstein13 wrote:

You calculated sine and cosine functions and paste final values. But this things aren't universal.

No i didn't. These values were not calculated with sine and cosine.

Yes, that values were not calculated with sine and cosine, but still they are connected to them in (almost) stright way.

we don't use a "orthonormal base".

Why not? Why don't we go from zig-zag to ortonormal? Then we can use casual transformations, instead of creating something new.

(if this were the case, we would have needed sine and cosine ...)

And why do you avoid sine and cosine? It isn't paintful for computers face-wink.png They love calculations face-tongue.png

The 60° rotation is natural with our triangle structured map. Rotations of angles that are not multiples of 60 will have bad results, as the image of vertex of the map will not be a vertex ....

Yes, it is. But any other degree will be innatural for the structure. This is mainly because of the descrete structure. But to fix this we can use interpolations. This is easy for me face-smile.png I have to do something simillar (interpolation for nonlinear function with discrete points) for another project and it isn't as much problematic, as you think face-tongue.png

with my function it is possible to have rotations of 60°,120°,180°,240°,300° with only 1 function, as we can use the rotation multiple times to get the other.

Ok, fair point face-smile.png But still we have to consider rotations for 30, 45 and 90 degree face-smile.png


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/

Top Quote
gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 37
Ranking
Pry about Widelands
Location: France
Posted at: 2015-01-23, 19:45

Well , here we have to make a choice (or to go in both directions).

First choice : we wanted to use these rotations to make things FAIR, so things have to be exactly the same. In this case we need to stay in the isometry group of the hexagon . ( 6 symetry axles and rotations of 60 , 120 etc .... but it will be easy to create maps with 2 , 3 , 4 , 6 or 12 equivalent starting positions , and translations can be used also to create maps with any number of equivalent starting positions)

Second choice : we want to have the most possible transformations. But in this case , we will need interpolations. it will not be easy to keep everything equal in this case.

Edited: 2015-01-23, 20:16
Top Quote