babalae/better-genshin-impact · error · MapPositionNotRecognizedException

大地图特征点匹配识别位置失败

Error message

大地图特征点匹配识别位置失败

What it means

Thrown by GetBigMapCenterPoint(private overload) when RecognizeBigMapCenterPoint returns an empty Point2f (IsEmpty() true). The MapScaleButton was found (confirming the map interface is open), but the underlying feature-point matching (GetBigMapPosition) could not locate the current map center position.

Source

Thrown at BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs:2143

    }

    public Point2f GetBigMapCenterPoint(string mapName)
    {
        return GetBigMapCenterPoint(mapName, null);
    }

    private Point2f GetBigMapCenterPoint(string mapName, Point2f? expectedCenterPoint)
    {
        // 判断是否在地图界面
        using var ra = CaptureToRectArea();
        using var mapScaleButtonRa = ra.Find(GetQuickTeleportRecognitionObject("MapScaleButton", ra));
        if (mapScaleButtonRa.IsExist())
        {
            var p = RecognizeBigMapCenterPoint(mapName, ra.CacheGreyMat, expectedCenterPoint);

            if (p.IsEmpty())
            {
                throw new MapPositionNotRecognizedException("大地图特征点匹配识别位置失败");
            }

            return p;
        }
        else
        {
            throw new InvalidOperationException("当前不在地图界面");
        }
    }

    private Point2f RecognizeBigMapCenterPoint(string mapName, Mat greyMat, Point2f? expectedCenterPoint = null)
    {
        Point2f p;
        try
        {
            var map = MapManager.GetMap(mapName, _mapMatchingMethod);
            p = expectedCenterPoint is Point2f expectedCenter
                ? map.GetBigMapPosition(greyMat, map.ConvertGenshinMapCoordinatesToImageCoordinates(expectedCenter))

View on GitHub (pinned to a7cb36712d)

Solutions

  1. Update map feature-point assets to match the current game version.
  2. Provide an accurate expectedCenterPoint to narrow the search area.
  3. Pan the map to a more feature-rich area before calling.
  4. Switch _mapMatchingMethod to a more robust algorithm if multiple are available.
  5. Retry after ensuring the map is fully rendered (no loading animation).
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    var center = task.GetBigMapCenterPoint(mapName, expectedCenter);
}
catch (MapPositionNotRecognizedException ex) when (ex.Message == "大地图特征点匹配识别位置失败")
{
    // Pan to a feature-rich area or provide a more accurate expectedCenter
    throw;
}

Prevention

When it happens

Trigger: Called from GetBigMapCenterPoint(mapName, expectedCenterPoint). The MapScaleButton exists, so we are on the map. But RecognizeBigMapCenterPoint → map.GetBigMapPosition returns an empty point, indicating no feature match.

Common situations: The current map view is over a low-feature area (open water, featureless terrain); map matching assets are outdated; the expectedCenterPoint hint is inaccurate causing the search to look in the wrong area; capture quality issues (blur, compression).

Related errors


AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13). Data as JSON: /api/errors/a90a3a382d3672e9. Report an issue: GitHub.