Core-Game

Core Game Template Project

๐ŸŽฎ Overview

Build fast, scalable mobile and WebGL games with a clean architecture, Addressables, and a lightweight service layer.

Unity License: MIT

Target audience: Unity developers building mobile (iOS/Android) and WebGL games who want a solid starting point with best practices.


๐Ÿ“‘ Table of Contents


๐Ÿš€ Features

๐Ÿ“ฆ Prerequisites

๐Ÿงฐ Quick Start

1) Clone

git clone https://github.com/CoderGamester/Core-Game.git
cd Core-Game

2) Open in Unity Hub (Unity 6000.0.55f1 recommended)

3) Generate Addressables settings

4) Configure UI (optional)

5) Open the โ€œBootโ€ Scene and Play

6) Run the sample and inspect the flow


๐Ÿงญ Project Architecture

The entrypoint Main (Assets/Src/Main.cs) wires services and starts the game state machine.

Key responsibilities of Main:

Example (excerpt from Main.cs):

var installer = new Installer();

installer.Bind<IMessageBrokerService>(new MessageBrokerService());
installer.Bind<ITimeService>(new TimeService());
installer.Bind<GameUiService, IGameUiServiceInit, IGameUiService>(new GameUiService(new UiAssetLoader()));
installer.Bind<IPoolService>(new PoolService());
installer.Bind<ITickService>(new TickService());
installer.Bind<ICoroutineService>(new CoroutineService());
installer.Bind<AssetResolverService, IAssetResolverService, IAssetAdderService>(new AssetResolverService());
installer.Bind<ConfigsProvider, IConfigsAdder, IConfigsProvider>(new ConfigsProvider());
installer.Bind<DataService, IDataService, IDataProvider>(new DataService());

var gameServices = new GameServicesLocator(installer);
installer.Bind<IGameServicesLocator>(gameServices);

_stateMachine = new GameStateMachine(installer);

Lifecycle hooks (excerpt):

private void OnApplicationPause(bool isPaused)
{
    if (isPaused)
    {
        _dataService.SaveAllData();
        _services.AnalyticsService.FlushEvents();
    }
    _services.MessageBrokerService.Publish(new ApplicationPausedMessage { IsPaused = isPaused });
}

State and logic boundaries are orchestrated by GameServicesLocator, GameLogicLocator, and GameStateMachine instances.


๐Ÿ—‚ Folder Structure

Rationale: prioritize Addressables over Resources/ to reduce initial payloads and enable content updates.


๐Ÿ“š Packages and Dependencies

Declared in Packages/manifest.json (selected):

See also:


๐Ÿ—ƒ Addressables Setup and Workflow

  1. Open Addressables window
    • Window > Asset Management > Addressables > Groups
  2. Create/Generate Settings (first time only)
  3. Organize groups (Configs, UI, Scenes, etc.) and assign labels as needed
  4. Build Addressables
    • Build > New Build > Default Build Script
  5. Use generated IDs from AddressableId helpers

Example usage:

// Example from docs
AddressableId.Addressables_Configs_DataConfigs.GetConfig().Address;

Notes


๐ŸŽฌ Scenes and Game Flow


๐Ÿ“ฆ Build and Deployment

WebGL

1) Build Settings

2) Addressables

3) Hosting

Tips

Mobile (Android/iOS)

1) Build Settings

2) Addressables

3) Analytics/Diagnostics


โšก Performance & Optimization


๐Ÿงช Troubleshooting


๐Ÿค Contributing

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

๐Ÿ“„ License

MIT License


๐Ÿ“ž Contact


Unity Project Keybind Shortcuts

Demo URL

https://codergamester.github.io/Core-Game/WebGL_Build/