Multiplayer by Default with Dreamlab

How Dreamlab's multiplayer-first design makes game development seamless and fun
Published Friday, October 25, 2024Posted by Dreamlab Team

Multiplayer features in action in Dreamlab. 👉 Star us on GitHub!

Dreamlab was created with one key mission in mind: making multiplayer easy and accessible for everyone. While single-player games are fun, adding multiplayer brings a new layer of excitement and challenge. But in 2024, adding multiplayer to a game can still be tricky due to fragmented solutions and complicated networking systems.

Dreamlab tackles this issue head-on, providing a multiplayer experience by default—designed to integrate seamlessly from day one of your game development.

Why "Multiplayer by Default"?

We believe that multiplayer should be a core feature, not an afterthought. In Dreamlab, all games are multiplayer-ready out of the box, eliminating the usual hassle of networking integrations. This approach allows developers to focus on gameplay, without getting bogged down in backend complexities.

Dreamlab offers:

  1. Real-time Synchronization - All players can see game state changes in real-time, with seamless syncing between clients.
  2. Server Management - Dreamlab hosts your game servers, so you don't have to worry about configuration or maintenance.
  3. Easy Debugging - With real-time feedback and in-editor debugging tools, fixing multiplayer-related issues becomes much easier.
  4. TypeScript-Powered Scripts - TypeScript scripting allows you to define networked properties in an easy, type-safe way.

How Dreamlab's Multiplayer Stands Out

Unlike traditional engines, Dreamlab's networking is built-in and designed to scale. Our engine is developed with Deno and TypeScript, prioritizing performance, security, and simplicity.

Here are a few features that make Dreamlab's multiplayer unique:

Real-Time Syncing with Networked Properties

Dreamlab uses a unique approach to handling networked properties, allowing you to define values as networked in TypeScript. This makes it extremely easy to sync properties between the server and clients automatically.

For example, here's how you can make an object's speed networked:

import { Behavior } from '@dreamlab/engine'

export default class SpinBehavior extends Behavior {
  speed: number = 1

  setup() {
    // Make the "speed" value visible in the editor and networked between clients
    this.defineValue(SpinBehavior, 'speed')
  }

  onTick() {
    // Only run on the server
    if (!this.game.isServer()) return
    // Rotate the entity!
    this.entity.transform.rotation += this.speed
  }
}