Skip to content

Unity SDK for the GameCloud backend service - a powerful solution for implementing turn-based multiplayer games with server-side validation, matchmaking, and player authentication. Supports optional UniTask integration for enhanced performance.

License

Notifications You must be signed in to change notification settings

turanheydarli/GameCloud-Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GameCloud-Unity

Unity Version License Development Status

GameCloud Unity Logo

πŸ“‹ Overview

GameCloud-Unity is a Unity package that provides seamless integration with the GameCloud backend-as-a-service (BaaS) platform. Designed for game developers, it simplifies implementing cloud-based multiplayer features, player authentication, game state synchronization, and more in Unity projects.

⚠️ Note: This package is currently in development. APIs may change before the stable release.

πŸš€ Key Features

  • Simplified API Integration

    • Connect to the GameCloud backend with just a few lines of code
    • Automatic serialization and deserialization of game data
    • Comprehensive error handling and connection management
  • Optional UniTask Support

    • Use standard C# Tasks or enable UniTask for better performance
    • All async methods follow the Async naming convention
    • Memory-efficient asynchronous operations
  • Rich Multiplayer Functionality

    • Matchmaking system integration
    • Lobby management
    • Turn-based game synchronization
    • Real-time player statistics
  • Cross-Platform Compatibility

    • Works on all platforms supported by Unity (including WebGL)
    • Consistent API experience across platforms
    • Platform-specific optimizations where needed

βš™οΈ Installation

Using Unity Package Manager (Recommended)

  1. Open the Package Manager window in Unity (Window > Package Manager)
  2. Click the "+" button in the top-left corner
  3. Select "Add package from git URL..."
  4. Enter: https://github.com/turanheydarli/GameCloud-Unity.git
  5. Click "Add"

Manual Installation

  1. Clone this repository:
git clone https://github.com/turanheydarli/GameCloud-Unity.git
  1. Copy the contents into your Unity project's Packages folder
  2. Restart Unity if it's already running

πŸ”§ Getting Started

1. Configuration

Before using GameCloud-Unity, you need to configure your API credentials:

  1. Navigate to Edit > Project Settings > GameCloud
  2. Enter your API credentials from the GameCloud Developer Portal
  3. Configure additional settings like environment (Production/Staging) and timeout values
  4. Save the settings

2. Using UniTask (Optional)

To enable UniTask support:

  1. Add the UniTask package to your project
  2. Add the UNITASK_SUPPORT scripting define symbol in Project Settings > Player > Scripting Define Symbols

3. Basic Usage

using GameCloud;
using UnityEngine;
using System.Threading.Tasks;

public class GameCloudExample : MonoBehaviour
{
    private IGameCloudClient _client;
    
    async void Start()
    {
        // Load settings from the project configuration
        var settings = GameCloudSettings.Load();
        
        // Initialize the GameCloud client with settings
        _client = GameCloudClient.FromSettings(settings);
        
        try {
            // Connect to the GameCloud service
            await _client.InitializeAsync();
            Debug.Log("Successfully connected to GameCloud!");
            
            // Create or join a game session
            var session = await _client.Sessions.CreateOrJoinAsync("my-game-type");
            Debug.Log($"Joined session: {session.Id}");
        }
        catch (GameCloudException ex) {
            Debug.LogError($"GameCloud error: {ex.Message}");
        }
    }
}

4. Using with VContainer (Optional)

If you're using VContainer for dependency injection:

using GameCloud;
using UnityEngine;
using VContainer;
using VContainer.Unity;

// Register GameCloud services in your LifetimeScope
public class GameLifetimeScope : LifetimeScope
{
    protected override void Configure(IContainerBuilder builder)
    {
        // Load settings from the project configuration
        var settings = GameCloudSettings.Load();
        
        // Register GameCloud client as a service
        builder.Register<IGameCloudClient>(r => GameCloudClient.FromSettings(settings), Lifetime.Singleton);
        
        // Register other services that depend on GameCloud
        builder.Register<IMatchmakingService, MatchmakingService>(Lifetime.Singleton);
        builder.Register<IPlayerService, PlayerService>(Lifetime.Singleton);
        
        // Register game managers
        builder.RegisterEntryPoint<GameManager>();
    }
}

πŸ“š Documentation

Naming Conventions

GameCloud-Unity follows these naming conventions:

  • All asynchronous methods have the Async suffix (e.g., InitializeAsync(), GetPlayerDataAsync())
  • Service interfaces begin with I (e.g., IGameCloudClient, IMatchmakingService)

Core Interfaces

Interface Description
IGameCloudClient Main client interface for interacting with GameCloud services
ISessionService Manage multiplayer game sessions
IMatchmakingService Find and create matches between players
IPlayerService Handle player authentication and profiles
ILobbyService Create and manage game lobbies

Examples and Tutorials

Tutorial Description
Getting Started Set up the package and make your first API call
UniTask Integration Working with UniTask in GameCloud
Turn-Based Multiplayer Build a simple turn-based game with GameCloud
WebGL Support Special considerations for WebGL builds

πŸ“¦ Package Structure

GameCloud-Unity/
β”œβ”€β”€ Documentation~/ - Documentation files
β”œβ”€β”€ Editor/ - Unity editor extensions
β”‚   β”œβ”€β”€ GameCloudSettings.cs - Settings provider
β”‚   └── GameCloudWindow.cs - Debug window
β”œβ”€β”€ Runtime/ - Core runtime scripts
β”‚   β”œβ”€β”€ Api/ - API client implementations
β”‚   β”œβ”€β”€ Models/ - Data models
β”‚   β”œβ”€β”€ Interfaces/ - Core service interfaces
β”‚   └── GameCloudClient.cs - Main client class
β”œβ”€β”€ Samples~/ - Example projects
β”‚   β”œβ”€β”€ BasicIntegration/
β”‚   └── MultiplayerGame/
└── Tests/ - Unit and integration tests

πŸ” Requirements

  • Unity 2020.3 or higher
  • .NET Standard 2.0 compatible project
  • Internet connection for API communication
  • GameCloud developer account (Sign up here)

🀝 Contributing

Contributions are welcome! Here's how you can help improve the package:

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add some amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ› Reporting Issues

If you encounter any bugs or have feature requests, please open an issue on GitHub. Include as much detail as possible:

  • Unity version
  • Package version
  • Steps to reproduce
  • Expected vs. actual behavior

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Authors

πŸ”— Links

About

Unity SDK for the GameCloud backend service - a powerful solution for implementing turn-based multiplayer games with server-side validation, matchmaking, and player authentication. Supports optional UniTask integration for enhanced performance.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages