Author Topic: Some feedback and a couple of issues.  (Read 103 times)

Pollyfun

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Some feedback and a couple of issues.
« on: September 15, 2021, 09:41:35 AM »
I've used the WMSK asset now for a couple of months, and I have probably tried out all of the features I'll use in the game.
Most of them works great out of the box.

For some of the others I've had to do some changes in the asset. It would be good if these changes is added in the codebase so I don't have to reapply them when I update the asset.

WorldMapStrategyKit\Scripts\Core\Internal\WMSKPrivMountPoints.cs
I've made these methods public since I need access to them:
Code
 public List<MountPoint>GetMountPoints (int countryIndex)
 public List<MountPoint>GetMountPoints (int countryIndex, int provinceIndex)

D:\BitBucket\Kronnect3\Assets\WorldMapStrategyKit\Scripts\WMSKCities.cs
Code
  public bool FlyToCity(string cityName, string countryName) {
return FlyToCity(name, countryName, _navigationTime);  <-- bug. 1st parameter must be cityName

The last parameter in BlinkProvince doesn't make it blink correctly. Compare different values with _map.BlinkCity() which works.
Code
map.BlinkProvince(provinceIndex, Color.white, Color.red, 2.0f, 2.5f);

WorldMapStrategyKit\Scripts\Core\Internal\WMSKPrivCountry.cs
I need access to frontiers to create custom frontiers, so I've made it public. Perhaps you could add a GetFrontiers() method or property.
Code
public Vector3[][] frontiers;

Frontiers issue

WorldMapStrategyKit\Scripts\WMSKProvinces.cs

Code
public List<Vector2>GetProvinceBorderPoints (int provinceIndex1, int provinceIndex2, int extraWidth = 0) {
When using this method, the border-points that's returned are often not in a sequence.
The points should optimally start in one end, and end in the other end. Now it often starts in the middle of border.
I use the border points to create custom frontiers with a LineRenderer. When the points starts in the middle it gives this effect:



All the red border sequences starts in the middle, so the lines will look bad. Then green marked borders are correct since the points
returned from GetProvinceBorderPoints() are in order. Currently I have to manually edit the borders to fix them:

Code
private List<Vector2> FixFrontierPoints(List<Vector2> frontiersPoints, int index)
{
int qtyToMove = 0;
if (index == 0)
qtyToMove = 16;
if (index == 1)
qtyToMove = 43;
if (index == 2)
qtyToMove = 9;
if (index == 3)
qtyToMove = 10;
if (index == 4)
qtyToMove = 63;
if (index == 5)
qtyToMove = 41;
if (index == 6)
qtyToMove = 92;

List<Vector2> adjustedList = frontiersPoints.GetRange(qtyToMove, frontiersPoints.Count -qtyToMove);
adjustedList.AddRange(frontiersPoints.GetRange(0, qtyToMove));
return adjustedList;
}



Obviously this is not optimal, since it's manual work added after creating the world. It would be great to:
* Either have them returned in the correct sequence
* Or, provide a method that sorts them


REQUESTS

These things I haven't fixed, so they are feature requests that would be useful.

REQUEST 1

void DrawProvinceLabels (int countryIndex)

Add a Color variable, so it can be called like this:
Code
_map.DrawProvinceLabels(1, countryColor1);
_map.DrawProvinceLabels(2, countryColor2);
I've tried this sequence, but it doesn't work since the second call overwrites the first one, and the same color is used:
Code
_map.provinceLabelsColor = Color.red;
_map.DrawProvinceLabels(1); /* color will be wrong four country 1 */
_map.provinceLabelsColor = Color.yellow;
_map.DrawProvinceLabels(2);


REQUEST 2

It would be great if the highlighting of enclaves when hovering the surrounding province was removed. Now it looks wrong.



If it's too time-consuming to fix, perhaps you could give some general guidance on where this can be fixed?

Thanks

« Last Edit: September 15, 2021, 09:48:57 AM by Pollyfun »

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7262
    • View Profile
Re: Some feedback and a couple of issues.
« Reply #1 on: September 15, 2021, 12:25:33 PM »
Hi,

I think I've added all the issues and requests to latest beta. Let's check:

1) GetMountPoints public methods added.

2) Fixed FlyToCity method parameter bug.

3) BlinkProvince behaviour should now work correctly regardless of the smoothBlink value (also added to BlinkCity)

4) frontiers and frontiersIndices are now public.

5) GetProvinceBorderPoints request: this is tricky as the conections along two provinces can be interrupted by other provinces so it's not always a single sequential line. I added an optional last parameter which returns the index of the points in the polygon vertex list. So if two points have sequential indices, you know they're part of the same line segment. That way you can at least detect if a point belongs to a different segment (ie: 1, 2, 3, 4, 5...) or if it's part of another segment (ie: 1, 2, 3, 37, 38, 39... here, a different segment starts at 4th point).

6) Added color parameter to DrawProvinceLabels. Also added Province Labels Fade options to the inspector.

7) Highlighting a province should now exclude any enclave but I have not been able to test it as I don't have the proper geodata.

Let me know how it goes.

Regards

Pollyfun

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Some feedback and a couple of issues.
« Reply #2 on: September 15, 2021, 01:23:55 PM »
Sounds great  :)  But when I installed the latest beta I didn't seem to get any of the changes above (methods still private etc).
I used the link that says:   Last Edit: Today at 12:10:03 PM by Kronnect
Was it packaged with the correct code?

Thanks

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7262
    • View Profile
Re: Some feedback and a couple of issues.
« Reply #3 on: September 15, 2021, 01:52:46 PM »
Could you please download it again? Changes should be there.

Pollyfun

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Some feedback and a couple of issues.
« Reply #4 on: September 15, 2021, 02:07:44 PM »
Ok, I've redownloaded, and just to be sure that I'm not missing something I created a new Unity-project and imported the package.

But for example, these looks unchanged (not public):

WorldMapStrategyKit\Scripts\Core\Internal\WMSKPrivMountPoints.cs




Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7262
    • View Profile
Re: Some feedback and a couple of issues.
« Reply #5 on: September 15, 2021, 02:20:40 PM »
Those methods are no longer inside that file. Are you getting the beta from https://kronnect.com/support/index.php/topic,5412.0.html ?

Pollyfun

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Some feedback and a couple of issues.
« Reply #6 on: September 15, 2021, 03:33:05 PM »
Ah, okay that explains it. I thought it was this download that was also edited today https://kronnect.com/support/index.php/topic,5340.0.html

Code looks updated now, I'll test it out shortly.

Pollyfun

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Some feedback and a couple of issues.
« Reply #7 on: September 19, 2021, 09:58:26 PM »
Number 1 to 5 fix works fine now, that's great.

Code
6) Added color parameter to DrawProvinceLabels. Also added Province Labels Fade options to the inspector.

This is not working as expected. I've sent a project where the problems are recreated. In the GUI there's two icons.
When the first one is hovered, it shows labels on all land provinces, and when the second one is hovered, it shows labels on ocean provinces.
Most of the time, it doesn't use the selected colors. And sometimes it shows all labels instead of just land or ocean labels.



Code
7) Highlighting a province should now exclude any enclave but I have not been able to test it as I don't have the proper geodata.

Just hover any ocean province with land enclaves in it and it's visible.

Thanks.

« Last Edit: September 20, 2021, 12:25:34 PM by Pollyfun »

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7262
    • View Profile
Re: Some feedback and a couple of issues.
« Reply #8 on: September 20, 2021, 02:55:44 PM »
Hi,

Latest beta solves the province color issue. However, the following code should be used:

Code
        public void EnterIcon(int id)
        {
            if (id == 2)
            {
                // show land labels - color font by country
                _map.HideProvinceLabels();
                _map.showAllCountryProvinceNames = true;

                Color countryColor1 = _map.GetCountry(1).labelColor;    // ERROR: sometime black, sometime magenta, never red.
                _map.DrawProvinceLabels(1, Color.red); 

                Color countryColor2 = _map.GetCountry(2).labelColor;    // ERROR: sometime black, sometime magenta
                _map.DrawProvinceLabels(2, Color.black);
            }
            else if (id == 3)
            {
                // show ocean labels   
                _map.HideProvinceLabels();
                _map.showAllCountryProvinceNames = true;

                _map.DrawProvinceLabels(0, Color.yellow);   // ERROR: labels are green
            }
        }

Notice the HideProvinceLabels call. This is added so all province labels are removed before the DrawProvinceLabels call (which doesn't remove any existing label).

The enclave issue is mostly fixed as well. The issue comes from the territory importer which produced interior shapes as independent regions which were overlapping with the enclaves as well (resulting in lot of redundant regions, see picture):




There're two solutions to fix those ocean regions containing extra regions:
1) Reimport them again. The importer now calls MergeAdjacentRegions when generating the country/province regions.
2) Or.. in the Map Editor, select the Ocean province and click "Sanitize". This button will also call MergeAdjacentRegions. I noticed that, because regions are snapped, some enclaves might not work because two of those regions are sharing some vertex. Using the Map Editor to separate them a bit, fixes that.

Please try it and let me know how it goes.



Pollyfun

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Some feedback and a couple of issues.
« Reply #9 on: September 20, 2021, 08:42:59 PM »
Great, that fixed it. Thanks for the updates!