SEARCH

Menu

Menu

Puls Events

Required

Your game runs on top of the Puls Runtime, which provides platform functionalities that you can interact with.

When your game is hosted on Puls Games, it must inform the platform runtime that it is ready to be played and initialize the player's session. To do this, you have access to the window.puls object and can call its methods.


Loading Progress

To display a loading progress bar while your game is initializing or loading its resources, you can call window.puls.loading(progress: number), where the progress value ranges from 0 to 100. This will render a progress bar with the given percentage progression on the loading screen.

Starting Session

After your game is loaded, preferably on the main menu screen and ready to be played, call window.puls.start() to initiate monetization and start the player's game session.


Engine-Specific Integration

The following sections provide generic guidance on integrating Puls Events with popular game engines.

Unity

Calling Puls Events in Unity is possible in the generated index.html file, where the Unity Engine is loaded and initialized. This is a good place to pass the loading progress into the window.puls.loading() function. After the engine is successfully loaded, you can call window.puls.start() to start the session. This function can also be called from C#, depending on your preference.


// index.html

script.onload = () => {
  createUnityInstance(canvas, config, (progress) => {
    progressBarFull.style.width = 100 * progress + "%";

    // Loading progress
    // ---
    // While the engine is loading and initializing
    // pass the progress into puls to display the current progress.
    window.puls.loading(100 * progress);
  }).then((unityInstance) => {
    loadingBar.style.display = "none";

    // Starting session
    // ---
    // The unity is loaded and initialized, now
    // you can start the player's session.
    window.puls.start();
  }).catch(alert);
};
Godot

Calling Puls Events in Godot is possible in the generated index.html file, where the Godot Engine is loaded and initialized. This is a good place to pass the loading progress into the window.puls.loading() function. After the engine is successfully loaded, you can call window.puls.start() to start the session. This function can be called either from the index.html file or from within your Godot project, depending on your preference.


// index.html

engine.startGame({
  'onProgress': function (current, total) {
    if (total > 0) {
      statusProgressInner.style.width = `${(current / total) * 100}%`;
      
      // Loading progress
      // ---
      // While the engine is loading and initializing
      // pass the progress into puls to display the current progress.
      window.puls.loading(current / total * 100);

      setStatusMode('progress');
      if (current === total) {
        setTimeout(() => {
          setStatusMode('indeterminate');
        }, 500);
      }
    } else {
      setStatusMode('indeterminate');
    }
  },
}).then(() => {
  setStatusMode('hidden');
  initializing = false;
  
  // Starting session
  // ---
  // The godot is loaded and initialized, now
  // you can start the player's session.
  window.puls.start();

}, displayFailureNotice);
Others

Puls Events are platform-agnostic and can be used with any game engine that runs on the web. The key is to enable communication between your game engine and the web platform. While Puls Events are not crucial during development, as they don't affect game functionality, you will need to integrate them after exporting your game. Simply add the Puls Events to your index.html file or use a method that suits your game engine.

Notes

Please note that implementing Puls Events is a required step to ensure the correct functionality of your game on our platform.

Notes

Please note that implementing Puls Events is a required step to ensure the correct functionality of your game on our platform.

Notes

Please note that implementing Puls Events is a required step to ensure the correct functionality of your game on our platform.

Version 1.2.0

Need some help? Discord

Version 1.2.0

Need some help? Discord

Version 1.2.0

Need some help? Discord

Copyright belongs to SIMPLIO s.r.o. All rights reserved.

Puls Games © 2024