How to run multiple instances of the engine at once?

hey there.

Cant find anything about it.

Maybe a stupid question, but, is there a way to “multiple run a project from editor”?

i.e. working on network stuff (server/client) its much easier to run a project for 2 or more times directly from the editor. If I build it (STRG-B) there can be just 1 running game.

For some cases it would be nice to run a project twice (or more).

I mean, sure, I could export to a binary and run that one and one from the editor but this is a mess while developing.
I saw some screens from @britzl at his DefNet Example where 2 or 3 game-windows are open at the same time :slight_smile:

It’s quite easy to launch multiple instances of the engine if you download the dmengine for your platform from d.defold.com and put the dmengine/dmengine_release/dmengine_headless in the project root. Once you’ve built and launched your project once from within the editor you can launch the downloaded dmengine as many times as you want to get multiple instances running at the same time.

2 Likes

You can try something like that (linux or Mac):

#!/bin/bash

# Will launch a second instance of the game if there is already one running
# from the Defole editor

while [ true ]
do

player1_running=$(ps aux | grep unpack | grep dmengine | wc -l | tr -d ' ')
player2_running=$(ps aux | grep 'dmengine_release' | grep -v 'grep' | wc -l | tr -d ' ')
echo "Player 1 running: ${player1_running}"
echo "Player 2 running: ${player2_running}"

if [ $player1_running == "1" ]
then
    if [ $player2_running == "0" ]
    then
        ./dmengine_release --config=userdata=local &
    fi
fi

sleep 1

done
2 Likes