Create new kinds of multiuser experiences using hydna and Unity
-
Upload
johan-dahlberg -
Category
Software
-
view
840 -
download
0
Transcript of Create new kinds of multiuser experiences using hydna and Unity
What is hydna
Platform agnostic Bindings for Unity, C#, C++, Obj-C, Erlang, Actionscript, Nodejs, Java,
Javascript, Android, iOS
Scalable hosted networking platform No need for a third party server
using Hydna.Net; !channel = new Channel(); !channel.Connect ("yourdomain.hydna.net?secret", ChannelMode.ReadWrite); !channel.Open += delegate(object sender, ChannelEventArgs e) { Debug.Log("Joined channel, message=" + e.Text); channel.send(“Hello world!”); }; !channel.Data += delegate(object sender, ChannelDataEventArgs e) { Debug.Log(“Received message=" + e.Text); }; !channel.Close += delegate(object sender, ChannelCloseEventArgs e) { Debug.Log(“Failed to join, reason=" + e.Reason); };
Unity/C#
channel = new HydnaChannel("yourdomain.hydna.net?secret", "rw"); !channel.onopen = function(evt) { console.log("Joined channel, message=" + evt.data); channel.send(“Hello world!”); }; !channel.onmessage = function(evt) { console.log(“Recieved message=" + evt.data); }; !channel.onclose = function(evt) { console.log("Failed to join, reason=" + evt.reason); };
Browser/Javascript
behavior("/", { open: function(evt) { if (evt.token == “secret”) { evt.allow(“Welcome”); } else { evt.deny(“Wrong password”); } } });
Behavior
Things you can do with behaviors
Routing Room partitioning
Authentication Password protection
Logging
External services Connect to Facebook, etc
behavior(“/players/{name}“, { open: function(evt) { var lobby = evt.domain.getChannel(“/“); evt.domain.set(“players:” + evt.connection.id, evt.params.name); lobby.emit(“Player “ + evt.params.name + “ joined the game”); evt.allow(“Welcome ” + evt.params.name); }, close: function(evt) { var lobby = evt.domain.getChannel(“/“); evt.domain.del(“players:” + evt.connection.id); lobby.emit(“Player “ + evt.params.name + “ leaved the game”); } });
Behavior
!behavior("/facebook/auth/{uid}", { open: function (evt) { var uid = evt.params.uid; var token = evt.token; var url = 'https://graph.facebook.com/'+ uid + '?access_token=' + token; http.get(url, function(err, body){ var response = JSON.parse(body); ! if (err || response.error){ evt.deny("NOT_ALLOWED"); } ! evt.allow("Welcome facebook user"); }); } });
Authenticate with Facebook
Upcoming featuresGeo-Location
(Track your players)
Persistant storage (User database, scoreboards)
Workers (Server-side game loops)
Open-Source
Try it out today
No credit-card required
Free sign-up (up to 30 concurrent connections)
A lot of examples and docs
Learn morewww.hydna.com
hydna Unity plugin github.com/hydna/hydna-unity-plugin
Chicken Demo github.com/hydna/hydna-unity-chicken-demo
Feedback, questions and suggestions: [email protected]