Navigation

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

    hardik_sl

    @hardik_sl

    Chat Follow Unfollow
    1
    Reputation
    15
    Posts
    1465
    Profile views
    1
    Followers
    0
    Following
    Joined Last Online

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

    Posts made by hardik_sl

    RE: Error ! installing colyseus@0.9.24 node package

    @endel thank you, i will try this.

    posted in Questions & Help •
    Error ! installing colyseus@0.9.24 node package

    Error !

    colyseus@0.9.24 postinstall /home/fancytee/nodevenv/game_server/8/lib/node_modules/colyseus
    npm run -s donate

    while running npm install on my server through ssh

    here is a screen shot

    image not found

    in case image not visible
    https://drive.google.com/file/d/1VM9z4aAC2nuPnkNWQr4FnKwbzBFfePoP/view?usp=sharing

    posted in Questions & Help •
    RE: Listen to state not getting proper data [Unity Client]

    @endel thank you. and i am just using cards array for push and pop only i am not mutating and thanks again for help.

    posted in Questions & Help •
    Listen to state not getting proper data [Unity Client]

    My state is like this:

    onInit(options)

    this.maxClients = 5;
    this.minClients = 3;
    
    this.setState({
      players: {},
      apid: [],
      dpid: [1, 2, 3, 4, 5],
    }); 
    

    onJoin(client, options) {

    var id;
    id = this.state.dpid.shift();
    this.state.apid.push(id);
    
    this.state.players[client.sessionId] = {
      playerId: id,
      cards: [],
      state: 1,
      pack: 0,
      trickData: {
        Rank: 0,
        Sum: 0,
        c1: 0,
        c2: 0,
        c3: 0
      }
    }
    

    C# code for listen to state change is:

    room.Listen("players/:id", OnPlayerChange);
    //room.Listen("players/:id/:playerId", OnPlayerIdChange);
    //room.Listen("players/:id/:pack", OnPlayerPack);
    room.Listen("players/:id/:cards/:number", OnCardsChange);

    Problem is when palyersId change the OnPlayerIdChange and OnPlayerPack both getting the this data of state

      trickData: {
        Rank: 0,
        Sum: 0,
        c1: 0,
        c2: 0,
        c3: 0
      }
    

    i want to listen to only playerId and pack when this variable changes

    posted in Questions & Help •
    RE: Error: Failed to auto-create room [Unity Client]

    [SOLVED]
    Thanks @endel but as i am making card game i need to have options for client to choose whether to create a room ( private table ) or join the room ( if there is no room available then auto create room with)

    posted in Questions & Help •
    Error: Failed to auto-create room [Unity Client]

    Whenever i try to join room with quick match i get this error

    Error: Failed to auto-create room "table" during join request using options "
    {"create":false,"requestId":1,"clientId":"7klsqdU1v","sessionId":"eYHS93fBq"}"
    at MatchMaker.create (D:\Colysues Server Unity\Server\node_modules\colyseus\lib\MatchMaker.js:228:19)
    at MatchMaker.<anonymous> (D:\Colysues Server Unity\Server\node_modules\colyseus\lib\MatchMaker.js:114:31)
    at Generator.next (<anonymous>)
    at fulfilled (D:\Colysues Server Unity\Server\node_modules\colyseus\lib\MatchMaker.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

    although if there is any available room it worked just fine and join that room. problem occurs when there is no room available to join (should not it automatically create a room ?)

    here's server onJoin method

    requestJoin (options, isNew) {
    console.log("request join!", options);
    return (options.create)? (options.create && isNew) : this.clients.length > 0;
    }
    onJoin (client, options) {
    console.log("client joined! ", options);
    }

    Unity client code

    string roomName = "table"
    //for Quick Join
    public void Join()
    {
    room = client.Join(roomName, new Dictionary<string, object>()
    {
    { "create", false}
    });
    StartCoroutine(ConnectToRoom());
    }
    //for Creting new room
    public void Create()
    {
    Debug.Log("Let's Crete & join the room!");
    room = client.Join(roomName, new Dictionary<string, object>()
    {
    { "create", true },
    });
    StartCoroutine(ConnectToRoom());
    }

    posted in Questions & Help •
    RE: How to connect colyseus monitor In java script

    @endel Yay !! thats work Thanks.

    posted in Questions & Help •
    RE: How to connect colyseus monitor In java script

    @endel here the code

    const http = require("http");
    const express = require("express");
    const monitor = require("@colyseus/monitor");
    const colyseus = require("colyseus");
    const GameRoom = require('./game_room');

    const PORT = process.env.PORT || 3553;

    const app = new express();
    const gameServer = new colyseus.Server({
    server: http.createServer(app)
    });

    // Register GameRoom as "table"
    gameServer.register("table", GameRoom);

    app.get("/something", function (req, res) {
    console.log("something!", process.pid);
    res.send("Hey!");
    });

    //colyseus game server monitor panel
    app.use("/colyseus", monitor(gameServer));

    // Listen on specified PORT number
    gameServer.listen(PORT);

    console.log("Running on ws://localhost:" + PORT);

    posted in Questions & Help •
    RE: How to connect colyseus monitor In java script

    @anubiscode i mean that if i use typescript then i can use this code to attach monitor ->
    app.use("/colyseus", monitor(gameServer));

    but if i use java script that will not work so any other way to attach monitor to game server??

    posted in Questions & Help •