Zoofite Login Flow – From Connection Check to Main Menu

PreBoot Scene – Connection Check

Before anything else is allowed to run, we perform a full connection health check using the AdvancedConnectionChecker component. This verifies:

  • Stable internet access using HEAD requests to a reliable endpoint (e.g., https://www.google.com/generate_204)
  • Average ping time calculation
  • Packet loss calculation across multiple retries
  • Fallback UI activation with retry button if minimum criteria aren’t met
var result = await PerformFullCheckAsync();
if (!result.IsSuccess)
{
    ShowRetryUI(result.ErrorMessage); // Show retry prompt if connection is insufficient
    return;
}

This ensures players cannot proceed without a valid and responsive internet connection, as the game is built to be online-only.

Boot Scene – Controlled Singleton Initialization

Once the connection is verified, the game enters the Boot Scene, where the ZoofiteBooter component ensures all core services are loaded sequentially and safely.

Each system follows this architecture:

  • Exposes an IsReady flag once fully initialized
  • Uses async logic to initialize itself (e.g., PlayFab login, data loading)
  • Is implemented as a MonoBehaviourSingleton using your CoreBehaviourSingleton<T> pattern
  • Only continues when all are ready

Services being initialized:

private bool AreAllServicesReady()
{
    return PlayFabServices.Instance.IsReady
        && PlayerManager.Instance.IsReady
        && PrefabFactory.Instance.IsReady
        && Wallet.Instance.IsReady
        && SeasonManager.Instance.IsReady
        && LobbyManager.Instance.IsReady
        && GameSettings.Instance.IsReady
        && ZoofiteSceneManager.Instance.IsReady;
}

This strict readiness check guarantees that no service is used before it’s ready. Because every system exposes a consistent interface, this pattern avoids any form of race condition or initialization hazard.

Main Menu Scene – Fully Logged-In and Ready

Only once all services have reported IsReady == true, the ZoofiteSceneManager transitions the player to the MainMenuScene:

ZoofiteSceneManager.Instance.LoadScene("MainMenuScene", LoadSceneMode.Single);

At this point:

  • The player is authenticated via PlayFab
  • Player-specific settings and progression data are loaded
  • The Unity Lobby system is ready for matchmaking
  • The XP Manager, Season Manager, Battle Pass, and Wallet are fully initialized
  • All prefabs and item skins are available via the PrefabFactory

Summary

The login flow in Zoofite follows these principles:

  • Robust pre-check for internet connectivity
  • Centralized, predictable service initialization
  • Singletons with exposed IsReady flags
  • No usage of services before they are ready
  • No race conditions or out-of-order dependencies

This system ensures that players never land in a half-initialized state. Everything is loaded, verified, and monitored before any game UI is displayed – a critical foundation for stable online play.

Schreibe einen Kommentar