Skip to content

CoreLayer

Ali Badpa edited this page Dec 27, 2025 · 4 revisions

Definition

The Core is the first and most important layer of RealMethod. All of the fundamental architectural concepts of RealMethod are handled and defined in this section.

Architecture

RealMethod primarily provides the main structure and the communication model between objects in your game. To work effectively with RealMethod, it is necessary to understand these architectural concepts.

Game

The Game class is a simple singleton class that is created before your game reaches the splash screen and remains alive until the game ends. After initialization, all interactions and relationships within the game are handled through this class.

Service

The Services are plain (non-component) classes that can be created at any time by the programmer through the Game class. A service can be added or removed from the game whenever the developer decides, depending on the needs of the runtime logic.

Manager

The Managers are components written by the developer with simple Interface. They are used to manage specific systems or features of the game. Managers are simple components that connect to the RealMethod system. Most importantly, managers are notified whenever any service is created or destroyed, allowing them to adapt their behavior dynamically. * Example: For instance, imagine you have a Music Manager * If a Game State Service exists, the manager automatically selects music based on the current game state. * If that service does not exist, the manager must handle music selection manually.

World

The World component defines the game scene context. This class executes before all other classes inside the scene and is responsible for handling the player’s presence in the game. By customizing the World class, you can implement additional logic during the scene setup phase. After completing its setup, the World registers itself with the Game class, allowing access to the current game world from anywhere in the codebase.

  • Any Scene can have World class, but in game we are just one World class RealMethod handled first and remove other one in game (that you can change this behavior or do something before removing)
  • If you want to set up some scene as an additive scene and all of these parts make your scene, you can use WorldAsset, Which we will address later.

Flow

Now that you are familiar with the concepts, let’s look at how these classes relate to each other:

  • Managers are never created during gameplay; they exist from the beginning.
  • Their behavior may change dynamically based on the availability of services.
  • Managers can only be registered in two places:
    • Alongside the Game class -> [GameScope]
    • Alongside the World class -> [WorldScope]

Because the World class can change whenever a scene changes:

  • Managers attached to the World are destroyed when the scene changes.
  • That means any Manager in WorldScope has a limited lifetime, but any Manager in GameScope lives until QuitGame

First Setup

In the Real Method, the core architecture is divided into two main parts: Game and World.

The Game class is created after the game framework has been initialized. Once this happens, the splash screens are displayed. After the game scene is fully loaded, the World class is the first class that gets executed. These two main classes are responsible for building the entire Real Method structure before the gameplay starts and for initializing all required relationships.

The Game class uses an asset called Project Settings to instantiate and prepare all required classes for use. These include:

  • The main Game service
  • The game config
  • Three prefabs that are placed alongside the Game object, you can call GamePrefabs

(These concepts will be explained in more detail later.)

This asset is loaded into memory by the Game class at runtime. After the initialization process is completed, it is unloaded from RAM. To configure these settings, you must first navigate to the following path: [Edit>ProjectSetting>RealMethod] and open the Real Method Settings window

Game Includes

The Game class, during initialization, creates some other class that you can customize and use it for your game

We know the Game class is a singleton, which means you can access it from anywhere these include.

GameService

One of Game Includes is a Service that name is GameServic you can't remove that, and the GameService is class that created befor all Manager initilize, this class handeling load and unload scene and loadscreen handeled connection between World & Game class you can implement any type of load screen and loading scene with extended or modifying this class in [Edit>ProjectSetting>RealMethod] you can set whitch GameService constructed to game if you want create custom GameService class for your game you can create class in [Project>AddAsset(RightClick)>Scripting>RealMethod>Service>GameService] and select your calss in RealMethod ProjectSetting.

GameConfig

The GameConfig is a config Asset (RealMethod defines some asset type that one of which is a Config Asset we will explain later) that was created and loaded when the Game initialized. It is most commonly used by designer you can define some paramter that hole game use that for example, fadescreen time or any other. That designer created a Game Config and set it to game can test the game with some settings (difficulty, enemy type, even you can define other assets into the GameConfig)

RootA ChildA SubChildA RootB ChildB

Clone this wiki locally