New Network / Stream Room System

Get the latest news on new features, bug fixes and version updates right here!

Re: New Network / Stream Room System

Postby robaldred » Fri Feb 07, 2014 4:42 pm

The streamRoomId() method is available on a IgeScene2d, ensure you are calling it on the correct object.
Any entities mounted to that scene will inherit the room's id until mounted to a different scene.

This is very new, I think there could be some issues with unmounting and when mounting to other scenes. that don't have a _streamRoomId, but like i said it's early days with this.

Here's the basics, dev branch only for the foreseeable i expect.

Code: Select all
var scene = new IgeScene2d()
scene.streamRoomId("secret-room")

var player = new IgeEntity()
player.mount(scene)

console.log(player._streamRoomId == scene._streamRoomId); // should log true
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: New Network / Stream Room System

Postby Smileypop » Thu Mar 06, 2014 2:52 am

What is the proper way to close a room and remove all entities from the stream? My server is running multiple rooms kept inside an object by roomId. When a game attached to a room finishes, that room should be removed from memory and all info stopped from streaming to the client.

I have created a Room.js class, and put the following inside the destroy call.

Code: Select all
destroy: function () {

        console.log('destroying '+this.roomId);

        if (ige.isServer)
        {
            this.streamDestroy();
            delete ige.server.rooms[this.roomId];
        }

        // Call the super class
        IgeEntity.prototype.destroy.call(this);

        delete this;

    }


Can you please tell me the proper way to do this?
Smileypop
 
Posts: 28
Joined: Fri Dec 13, 2013 6:44 am

Re: New Network / Stream Room System

Postby Doidel » Thu Mar 06, 2014 10:49 am

Well good Smileypop, I guess having a "destroyRoom" function might be a good addition to the network libraries. But for the time being try something similar to what you already begun with:
Code: Select all
destroy: function() {
   console.log('destroying '+this.roomId);

   if (ige.isServer)
   {
      //this.streamDestroy(); - no need, this is called automatically
      delete ige.server.rooms[this.roomId];
   
      // And maybe you want to set a new room for all clients which are currently connected to this room?
      var clientIds = Object.keys(ige.network.clients(this.roomId));
      for (var x = 0; x < clientIds.length; x++) {
         ige.network.clientLeaveRoom(clientIds[x], this.roomId);
         ige.network.clientJoinRoom(clientIds[x], 'lounge'); //or whichever room that would be :)
      }
   }

   // This will also destroy all mounted children. Sooo all you need to do for this to take effect is mount your entities onto this room.
   // If you don't do that you can ofc also manuall iterate over your entities and destroy them.
   IgeEntity.prototype.destroy.call(this);

   //delete this; - Don't think this is necessary.
}

It's untested, tell me whether it worked for you.

Good luck!

PS: For help requests like these please create a new thread ;)
User avatar
Doidel
 
Posts: 59
Joined: Tue Jan 14, 2014 5:05 pm

Re: New Network / Stream Room System

Postby Rikhart » Thu Mar 20, 2014 1:31 am

Hi Im interested in use the framework just days ago Im checking it, now i need to use the functionality for creation of rooms, and I have problems with that, because I run an example and get the error: "Object #<IgeClass> has no method 'streamRoomId'" the example that I found is https://github.com/Solib/exemple-stream-romId, that I suppose that works well, please can you help me with this trouble. Nowadays I'm using the Trial Version. Maybe you could suggests me a github link where i will find a well implementation. or Maybe the error is for the version that I'm using. How limited is the Trial version?
Rikhart
 
Posts: 3
Joined: Thu Mar 20, 2014 1:03 am

Re: New Network / Stream Room System

Postby rob » Thu Mar 20, 2014 1:42 am

The trial version does not include the latest updates or access to the dev branch. It gets updated once every four months usually.

If you would like access to the latest version please purchase a license.
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
User avatar
rob
Site Admin
 
Posts: 316
Joined: Tue Oct 22, 2013 5:08 pm

Re: New Network / Stream Room System

Postby Killersan » Sun Feb 15, 2015 12:11 am

Hello guys,

I'm looking for working example of this Stream Room System to understand it correctly.
I would be appreciated if You could provide me one.
User avatar
Killersan
 
Posts: 24
Joined: Sat Jun 21, 2014 1:45 pm

Re: New Network / Stream Room System

Postby robaldred » Mon Feb 16, 2015 1:17 pm

Hello.
There is no specific example to describe this feature. It's quite an advanced feature of the engine, so i'd recommend really having an in-depth understand of the core engine architecture. Especially surrounding networking and streaming.

There a plenty of snippets throughout this thread, specifically the OP showing how to implement rooms.
You should be able to put them together with any of the 24-1-network-stream example.

To actually setup the rooms is actually quite simple.
Just call streamRoomId('room1') on the scene that defines a room or cluster of entities.

Code: Select all
var room = new IgeScene2d()
    .streamRoomId('room1')
    .streamMode(1)
    .compositeStream(true);


Anything mounted to that will only be streamed to clients in 'room1'

Define a method on the server that can allow a user to join a room across the network

Code: Select all
ige.network.define('joinRoom', clientJoinRoom);

function clientJoinRoom (data, clientId, requestId) {
    ige.network.clientJoinRoom(clientId, data.roomId);
    ige.network.response(requestId, {success: true});
}


Then on the client, you can request to join 'room1':

Code: Select all
ige.network.request('joinRoom', {roomId: 'room1'}, function (cmd, result) {
        if (result.success) {
            // success! you're in the room
        }
});
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: New Network / Stream Room System

Postby Killersan » Sat Feb 28, 2015 7:39 pm

Just to inform You with this simple problem which we had last days.

Scene created on the client side by default has undefined parameter _ignorecamera, which is treated as false.
While we have scene created on the server side (with undefined parameter _ignorecamera) with Stream Room System, and the stream is starting to flow (sync) between server and client, then on the client _ignorecamera parameter is set to true automatically.
This behaviour reflects on the auto tracking entity for example, which in this case won't work properly.

The workaround for this issue is to set on the server side parameter _ignorecamera to false, which in this case will be streamed into the client and in the client will be set to false too.

For those of You who had or will have some problems similar to above one, it is good to set default _ignorecamera parameter to false on the server side.
Because I made a mistake with github master repo yesterday (I'm not really familiar with that solution) I would like to ask one Rob or Another :) (RobAldred) to implement this simple fix to the proper repo. It will prevent other people to have similar problems.

Thx in advance.
User avatar
Killersan
 
Posts: 24
Joined: Sat Jun 21, 2014 1:45 pm

Re: New Network / Stream Room System

Postby robaldred » Sun Mar 01, 2015 11:40 pm

Hey, sure, I think the solution will be to ensure that the ignoreCamera property defaults are synced property during entity creation. I'll try and take a look asap.
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: New Network / Stream Room System

Postby Killersan » Mon Mar 02, 2015 1:11 am

Hello. IgnoreCamera is properly synced but there is a conditional if this parameter on the server is not false then it's default value is set to true on the client.
I think that definition of default value in init will solve the problem, because rest of the sync will work ok.



Code: Select all
streamSectionData: function (sectionId, data) {
      switch (sectionId) {
         case 'ignoreCamera':
            if (data !== undefined) {
               // Setter
               if (data === 'false') {
                  this.ignoreCamera(false);
               } else {
                  this.ignoreCamera(true);
               }
User avatar
Killersan
 
Posts: 24
Joined: Sat Jun 21, 2014 1:45 pm

Previous

Return to New Features, Latest Versions & General Updates

Who is online

Users browsing this forum: No registered users and 1 guest
cron