Estimate project

Multiplayer Game With Unity3D and Meteor

Game Development   -  

October 11, 2021

Table of Contents

Before digging into every facet of this post, you are required to have a fairly good background in Meteor and Unity3D. Those who were not able to attend our 4th Meteor Ho Chi Minh Meetup on September 17th could find all about Multiplayer Games with Unity3D and Meteor – one of the main topics of the meetup – in this blog.

FYI: This is one of two topics of our 4th Meteor Meetup, take place on 17th September 2016. The author is Huy Trinh, a young talent member of Designveloper.

Multiplayer Game with Unity3D and Meteor JS

What Is Unity3D?

Unity is a cross-platform game engine developed by Unity Technologies and used to develop video games for PC, consoles, mobile devices, and websites. First announced only for OS X, at Apple’s Worldwide Developers Conference in 2005, it has since been extended to target 24 platforms.

What Is Meteor JS?

Meteor is a full-stack JavaScript platform for developing modern web and mobile applications. Meteor includes a key set of technologies for building connected-client reactive applications, a build tool, and a curated set of packages from the Node.js and general JavaScript community.

If you are a Meteor-novice, no worries! You can discover more about this full-stack JavaScript platform for developing single-page, real-time web and mobile apps at Meteor.com.

Please check out the list of "Meteor for Beginners - Easy and Practical" videos:

Why We Should Use Meteor with Unity3D?

When using Meteor, launching an MVP in 3-4 weeks can be a reality. With JavaScript on the back-end, plus smart packages, Meteor allows you to develop faster.

unity3d and meteor

You don’t need to have experience about implement TCP/IP, UDP, or pure Socket for a Gaming Server. With collection and method, we can easily implement Gaming Network Architecture like Latency Compensation, Client Prediction, Server Reconciling, and other technique.

How to connect MeteorJS with Unity3D

A team in Los Angeles has developed a plugin that makes a bridge between Unity3D and MeteorJS through Websocket and DDP. You can find it here https://github.com/hiddenswitch/Meteor-Unity.

By using this plugin we can use almost Meteor API such as login, method, collection, and publish/subscription. The plugin is great in general but one thing, it hasn’t supported WebGL for Unity3D yet.

1. Mobile

You can watch how to set up and connect step by step here: https://github.com/hiddenswitch/Meteor-Unity

Recommended reading: Creating Cross-Platform Games with Unity and Backend Web Server Using Laravel

2. WebGL

You cannot use the hidden switch plugin with Unity3D WebGL now. But we can use another way to interact with it. Unity3D WebGL support 2 API that helps call from inside WebGL container to javascript on page outside and reserve.

  • To call methods on GameObjects in your content from browser JavaScript, you can use the following code:

SendMessage ('MyGameObject', 'MyFunction', 'foobar');

Read more here: https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html

  • To call a function in the web page that contains the WebGL Player.

Application.ExternalCall

ExternalCall calls functionName in the web page containing the WebGL player, passing the given arguments to it. Supported argument types are the primitive types (string, int, float, string) and arrays of such types. Any other objects can convert to a string using ToString and passed as strings.
For a deeper understanding, you can read here:

https://docs.unity3d.com/ScriptReference/Application.ExternalCall.html

So, did you find some great information on your own in this blog? Do you have any questions? Let me know in the comments and we can discuss it!

Recommended reading: iGaming Website Design: Anti-Money Laundering Guidance

Also published on

Share post on

Insights worth keeping.
Get them weekly.

body

Subscribe

Enter your email to receive updates!

name name
Got an idea?
Realize it TODAY
body

Subscribe

Enter your email to receive updates!