In this installment, we take a look at just how easy it is to integrate Metajestic's multiplayer engine into your 3d virtual world/game ...
Metajestic Multiplayer Engine (MME) is designed using standard interfacing technology to 3rd party development environments. In addition, we are actively developing our libraries and SDKs to make it even easier.
The basic interface is via a standard websockets implementation. You simple connect your front end digital world or game providing the required attributes and authentication, and your players are connected, Once connected it's easy to update the players positional, rotational, etc. status, and to add your custom attributes.
Example javascript connection json looks like the following:
Add script: src="https://cdn.socket.io/4.5.4/socket.io.min.js"
let socketMultiplayer;
socketMultiplayer = io(multiplayerService,{upgrade: false, transports: ['websocket'], query: {
roomName: roomName,
apiKey: apiKey,
partyId: myPartyId,
jwt: jwt,
x:x,y:y,z:z,rx:rx,ry:ry,rz:rz,rw:rw
},
});
Then add the message listeners to receive the messages from the MME, and add the functions to send updates to the MME.
Example listeners to receive messages are of the format:
socketMultiplayer.on('connect', function(){
console.log("multiplayer socket connected:",socketMultiplayer.connected); });
Message types include: error, connect_error, connect, disconnect, my join collision, my join, user join, closest users, users by distance, update state, update state out of range, my update state, update attributes, my update attributes, user disconnect, etc...
Example sending update to MME:
socketMultiplayer.emit("update state",{x:x,y:y,z:z,rx:rx});
where the x,y,z are the positional updates, rx is a rotational update in this example.