Navigation

    Colyseus
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. shophk
    shophk

    shophk

    @shophk

    Chat Follow Unfollow
    1
    Reputation
    8
    Posts
    1290
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Continue chat with shophk
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    shophk Follow

    Posts made by shophk

    RE: How to join a room using javascript game engine Cocos Creator?

    Found solution here.

    https://github.com/gamestdio/colyseus.js/issues/8

    posted in Questions & Help •
    How to join a room using javascript game engine Cocos Creator?

    Hi, I'm testing cocos creator (Javascript) to connect to Colyseus server, any known examples shown how to use javascript client through cocos creator to connect to Colyseus server? Or advise how I should go about doing this?

    posted in Questions & Help •
    RE: About setting number of rooms for a registered room on the server.

    @endel Yes, I would like to limit the number of rooms. I want to have the first 10 rooms to have bonus or special effects.
    after the first 10 rooms, users will get put into another registered room.

    So in a way, yes, I want to limit the number of rooms the server can spawn base on some criteria.

    posted in Questions & Help •
    About setting number of rooms for a registered room on the server.

    Hi,

    I'm trying to find a way to set the number of rooms.
    My code trace has led me to believe I can make changes here:

    MatchMaker.prototype.create = function (roomName, clientOptions) { ...}
    Change the function so that it checks some flag to decided whether a room should be returned.

    My question: I am not suppose to change the code for the files in the Colyseus folder right? What would be the recommended actions or approach to take for handling what I want to do?

    posted in Questions & Help •
    RE: How to push a variable?

    My solution to this is using JSON.stringify to parse the variable into a string. I'm hoping there is a better solution.

    var roomname = {
    roomName : 'a room passed as string'
    }
    var text = JSON.stringify (roomname);
    console.log("stringify text: " + text);

       this.state.roomname.push (text);
    posted in Questions & Help •
    How to push a variable?

    I have the following:

    class ChatRoom extends Room {

    constructor () {
    super();

    this.setState({
      players: {},
      messages: [],
      roomname: []
    });
    

    }

    In onJoin(client)...

    //it works if I do this, I can retrieve the string in Unity.
    this.state.roomname.push ('a room passed as string');

    var roomname = {
    roomName : 'a room passed as string'
    }

    //it doesn't work if I do this, I get a '1' as the result when i try to read the object.
    this.state.roomname.push (roomname);

    How do I push a variable?
    I'm thinking like in socket.io . I can send currentUser, in Unity I use a Json deserialiser to read the contents.

    var currentUser = {
    		msg:data.msg,
    		id:id,
    		position:data.position,
    	}
    socket.emit('move', currentUser);
    

    Can I do something similar using this.state.roomname.push(currentUser) ?

    posted in Questions & Help •
    Beginner learning to use Colyseus

    Summary:
    Learning to use Colyseus as a beginner.
    Things I had considered when I started and trying out room handlers, specifically requestJoin(option) function.
    https://codefalls.wordpress.com/2017/10/28/learning-colyseus-0-5-0/

    posted in Links & Resources •