Marker enhancement discussion
thecodewarrior opened this issue ยท 16 comments
I'm working on making markers more powerful and flexible, and need a place to discuss changes.
I've changed the markers from being nothing but a texture to being much more flexible.
I've added:
Multiple icons
You can now specify multiple icons at different resolutions, and the mod will select the best one based on the size that it's drawing.
Custom size
You can specify the size the markers will render at. The size is represented in tiles.
Clipping
You can specify a minimum and maximum zoom level for a marker to render
Ignoring hidden markers
You can specify whether the marker should render even if markers are hidden
Tile markers
You can specify if a marker should scale with the map or be the same size regardless of zoom
Technical markers
You can specify if a marker should be excluded from the marker placing menu
Center point
You can specify what point on the marker should be at the marker's actual location
JSON format (WIP)
The JSON config file will probably moved to "markers.json" from "marker_textures.json", I'll see if I can make it move over the markers from the old config file and delete it.
Here is the format so far:
{
"version": 1,
"data": {
"antiqueatlas:Example": {
"__comment": "Any of these values can be ommited. The mod will either use the default value or if it's already been registered it will keep the existing values",
"textures": [
"List of icons at different resolutions",
"[Default: 'antiqueatlas:textures/gui/markers/red_x_small.png']"
],
"size": "[Default: 2] The width and height of the marker, in tiles (a chunk at 1x zoom)",
"clipMin": "[Default: -1000] The minimum zoom, -1 is 1/2x, -2 is 1/4x, ...",
"clipMax": "[Default: 1000] The maximum zoom, 0 is 1x, 1 is 2x, ...",
"alwaysShow": "[Default: false] True if the marker should appear regardless of whether hide markers is on",
"isTile": "[Default: false] True if the marker should scale with the map",
"isTechnical": "[Default: false] True if user shouldn't be able to place the marker on the map",
"centerX": "[Default: 0.5] The point in the image that should be at the location of the marker (0-1)",
"centerY": "[Default: 0.5] The point in the image that should be at the location of the marker (0-1)"
}
}
}
I'm thinking that the example will be added to the beginning when it's saved and removed when it's loaded, that way people will have at least a little bit of a clue what's going on. It could also create a bare "markername":{}
for any markers that are registered in code, that way you know what markers you have to work with. It wouldn't create a marker if the object is empty, that way if a mod that added markers is removed, the markers get removed from the file when it's saved.
I've also added support for exporting massive maps to images by slicing up the image. I think it's time for a PR.
PR? Public Release? That sounds right to me, the people want better maps with better markers! 1.9.4 has to be one of my favorite updates since boats are no longer worthless and you have an off hand.
As soon as we sort out those merge conflicts, I'll test it out on a server, then we'll post to curse. Sound good?
Pull request. It also needs textures before release. Right now the end islands are just cannibalized plateau tiles. The end city markers could also use a bit of de-flattening. (My brain just doesn't do well with making textures that aren't a solid color)
The end city markers aren't showing up for me. Is this a known bug? Perhaps a file wasn't added to the repository?
I checked the logs. There's not mention of a problem or a visit (as far as I can tell). It only affects that one marker. Also, If I zoom out to 1/4, all the markers suddenly appear.
[10:11:28] [Client thread/INFO] [antiqueatlas]: Put marker in Atlas #0 "ec" at (180, 218)
[10:11:28] [Server thread/INFO] [antiqueatlas]: Created new marker #7"ec"@(180, 218)
Update: The markerType for the end city markers appears to have only end_city_far.png as a resource. Also, clipMax is -2.
Edit: Hang on, that's explicitly specified. Is there supposed to be a mechanism to seamlessly transition between END_CITY and END_CITY_FAR?
Naturally generated end cities use the end_city.png for zoom levels above 1/4. This only happens with manually placed markers.
The marker, when naturally generated, works. When you go to place a marker, and select the end city icon, it only works for zoom levels below 1/2. Because the END_CITY_FAR marker is in the registry, it appears as a local marker option. However, because it only supports two zoom levels, it disappears when zoomed in. I'm suprised something similar doesn't happen for the END_CITY marker.
The END_CITY marker should disappear, it just does it when it reaches very far zoom levels.
If you mark them as technical when they're registered they should be removed from the marker selector.
Then all that's missing is a .setIsTechnical(true)
call in MarkerTypes.java:
END_CITY = marker("EndCity", Textures.MARKER_END_CITY, Textures.MARKER_END_CITY_MIP_32, Textures.MARKER_END_CITY_MIP_16);
END_CITY.setAlwaysShow(true).setClip(-1, 1000).setIsTile(true).setSize(2).setCenter(0.5, 0.75).setIsTechnical(true);
END_CITY_FAR = marker("EndCity_Far", Textures.MARKER_END_CITY_FAR);
END_CITY_FAR.setClip(-1000, -2);//TODO: .setIsTechnical(true)
I'll test and commit this change momentarily