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

mirror center #19

Open
Monsterfisch opened this issue Sep 16, 2021 · 15 comments
Open

mirror center #19

Monsterfisch opened this issue Sep 16, 2021 · 15 comments

Comments

@Monsterfisch
Copy link

when creating maps for ai one has to align iron and swamp resources according to a 5x5 grid sadly when using the mirror tool that grid is not accurately mirrored to both sides of the map aka there is a 1 tile offset at the center of the map

my suggestion would be to make the mirror tool have an even and uneven setting where it would change from a 2x2 square in the center of the map to a 1 tile in the center
image
right side is how it currently mirrors (if all sides are mirrored) and left is how i suggest it work if set to uneven

that way the 5x5 grid will be mirrored correctly and make placeing down iron and pitch alot less of a headache

@gynt
Copy link
Owner

gynt commented Sep 16, 2021

@TheRedDaemon

@TheRedDaemon
Copy link
Contributor

Interesting.
Which version of the mirror tool are you using, Monsterfisch?
But I think is does not matter. If I remember right, even the first version had its center in the middle point between four tiles. I simply used that as "the center" for every mirroring function (I think the circle shape uses a single tile, though.)...

gynt, I need a bit of expertise here. The actual center of the map is in the middle of the mentioned four tiles, right?
Does this mean that this 5x5 grid uses a different center overall, or am I missing something?
Basically, is there an error in the center calculation that needs fixing, or is essentially a new feature required to deal with this resource building grid?

@Monsterfisch
Copy link
Author

Monsterfisch commented Sep 17, 2021

It's a problem with the grid basically here is how the grid is aligned on the map https://i.imgur.com/tiEIYS5.png

you can see how it is not centered correctly essentially it would have to get moved enough to the double centerline would be in the middle of the resource building which would be roughly 3 tiles up/down and left/right however since I assume changing the grid is impossible at this point its best to simply add a function specifically for this purpose where the center isn't perfectly in the middle of the map but slightly offset to address the resource issue as otherwise you have to work with mirror off to place down these resources if you are working with precise measurements which are sorta required with those two resources if you want them to be used a specific way by the player and the ai.

btw if you look precisely you can see how the map is kinda weirdly proportioned with 2 corners being 2 tiles wide and the other two 1 tile (you can verify this ingame too, i tested it on a 400x400 map) ... not sure what's up there but you know lots of odd stuff happening with maps generally speaking

@TheRedDaemon
Copy link
Contributor

TheRedDaemon commented Sep 17, 2021

Ok, I created a pull request, even though it may not be precisely the solution you asked for, I added the ability to set the center point for the mirroring functions. Using a x.5 value like 199.5 for example for both x and y coordinates will move the center onto a tile. I think this might produce the results you want.

Did you use anything past version 1.1 of the editor tools? If not, using the newer stuff might be a bit of an adjustment. 🙃
If you want to test it, you can just grab the files from THIS branch.

However, does the whole resource raster stuff mean that even a perfect visual mirror would not be an perfect mirror for the AI?
This game... 😆

@Monsterfisch
Copy link
Author

Monsterfisch commented Sep 18, 2021

@TheRedDaemon whats the command to set this up then? xP i was struggleing with the current setup already btw xP i only know the new version aslo basically just started using it like 5 days ago

@TheRedDaemon
Copy link
Contributor

I try to give a quick summary:

Version 1.1 had only two variables, MIRROR_MODE and MIRROR_MODE2.
The equivalent in the new version is mirror.mode and mirror2.mode. Using only them, it kinda functions like 1.1 (just that mirror2 will also work if mirror mirror is not active).

However, mirror and mirror2 are just one of several configuration objects. The general help text (command help) tries to explain this, and how to get even more help text.
Example:
Typing and executing mirror() in the console writes a help text, listing all options of mirror (mirror2 is identical).
Typing and executing mirror("mode") should give you the help text for the mirror function and list all modes, while mirror.mode = ... is used to set it. (... is a sting in this case, like "horizontal")

The values for setting the mirroring center are x and y.
mirror.x = ... for example is used to set the x coordinate for the first mirror. (... is a number like 150 or 199.5)
mirror2 needs to be set separately.

x and y both default to 200.0, which is the visual center of the map, between the mentioned four tiles. Important to know is also, that 0 for x is in the upper left corner of the map, and 0 of y in the upper right. In turn, a center of `0, 0 would be far outside the map.

I hope that helps a bit. And of course, the x and y coord values currently only exist if the version of my branch is used.

@Monsterfisch
Copy link
Author

i installed ( by dragging the files into the crusader directory replaceing the old editortool files) the version from your branch but it seems like it cant find the x parameter? image

@TheRedDaemon
Copy link
Contributor

If you use mirror(), are the parameters mirrorCenterX and mirrorCenterY listed?

If not, you need the shc-mapeditortools.lua from THIS branch (branch name is mirror_center_offset).
If yes... I might need to look into that later...

@Monsterfisch
Copy link
Author

mhm i had to manually change the content of the .lua but it works now ^^ and looks like it works perfectly!! thx

@TheRedDaemon
Copy link
Contributor

You are welcome. 👍

However, small question: What do you mean with

change the content of the .lua

?

Did you change a particular part of the code, or did you copy over the whole content of another version of the file?
Just asking in case something of the code needs fixing.

@Monsterfisch
Copy link
Author

i mean i copy pasted the content from the downloaded file to the already existing one... as it didnt want to work when just replacing the files for some reason ^^ thats all

btw how can i set the default value to be 199.5 for x and y coords by defuault? like which line of code do i define it in?

@TheRedDaemon
Copy link
Contributor

thats all

Alright 👍 And as long as the bigger brushes are symmetrical, everything else should also be up to date. (Since gynt fixed the odd, missing upper left edge of the brush, making them proper mirror-able.)

btw how can i set the default value to be 199.5 for x and y coords by defuault? like which line of code do i define it in?

In short, it should be on line 1821 (local DefaultMirror = ...), assuming no potential line changes I forgot...
That is the structure for the default values of Mirror Feature objects.
It is sadly not in some convenient place at the beginning of the file. Since all needs to be in one file, I made the decision to split it by feature.
You would reach the same place by following the table of contents at the beginning:
COORDINATE MODIFICATION FEATURES -> MIRROR FEATURE -> Mirror Configuration

@Monsterfisch
Copy link
Author

ooh he fixed the big brushes! amazing love it

sweet its still simple enough if you have the right software that shows the lines so dw =)

@gynt
Copy link
Owner

gynt commented Sep 22, 2021

Nice fix @TheRedDaemon

@Monsterfisch I just want to correct one misconception. The grid is symmetrical. You can explore a map file here by loading your favorite map and pressing load section.
That does not take away that game logic code may interact with the map in an assymetrical way. I can for example imagine that for the same reason that units walking the map border are hard to spot, you can also not modify the map there with the map editor tools.

@Monsterfisch
Copy link
Author

mhm interesting and yeah on some sides based on rotation of the map one line of tiles is completely cutoff i could only really build there with the terrain raised too but at least it is possible xP damn you FF :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants