Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  1. Home
  2. hardik_sl
  3. Posts
  • Profile
  • More
    • Continue chat with hardik_sl
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

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 • 5 Jan 2019, 03:22
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 • 4 Jan 2019, 07:48
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 • 31 Dec 2018, 07:13
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 • 29 Dec 2018, 05:22
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 • 22 Oct 2018, 08:04
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 • 18 Oct 2018, 10:00
RE: How to connect colyseus monitor In java script

@endel Yay !! thats work Thanks.

posted in Questions & Help • 5 Sept 2018, 05:57
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 • 4 Sept 2018, 12:17
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 • 4 Sept 2018, 09:56
How to connect colyseus monitor In java script

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

cant use this

posted in Questions & Help • 22 Aug 2018, 06:38
Help ! Creating Card Game , Create new (table) room in Unity

i'm creating multiplayer card game. i want make a private table (room) , but when i'm connecting to server it all connect to same room.

my code:

public string serverName = "localhost";
public string port = "3553";
public string roomName = "chat";

public IEnumerator Start()
{
String uri = "ws://" + serverName + ":" + port;
Debug.Log(uri);
client = new Client(uri);

    client.OnOpen += OnOpenHandler;
    client.OnClose += (object sender, EventArgs e) => Debug.Log("CONNECTION CLOSED");

    Debug.Log("Let's connect the client!");
    yield return StartCoroutine(client.Connect());
    room = client.Join(roomName);
}

public void Join()//button event
{
    StartCoroutine(ConnectToRoom(rname.text));
    rname.text = "";
}

public void Create()//button event
{
    StartCoroutine(ConnectToRoom(rname.text));
    rname.text = "";
}

IEnumerator ConnectToRoom(String Room_Name)
{
    Debug.Log("Let's join the room!");

    //if Client Dose not Set room name;
    if (Room_Name.Equals(""))
    {
        Room_Name = "NO ROOM NAME";
    }

    //Client Connect to Existing room
    if (!isExistingRoom)
    {
        room = client.Join(roomName, new Dictionary<string, object>()
        {
            { "create", true },
            { "name", Room_Name }
        });
    }
    else
    {
        room = client.Join(Room_Name);
        isExistingRoom = false;
    }

    room.OnReadyToConnect += (sender, e) =>
    {
        Debug.Log("Ready to connect to room!");
        StartCoroutine(room.Connect());
    };
    room.OnJoin += OnRoomJoined;
    room.OnStateChange += OnStateChangeHandler;

    room.Listen("players/:id", this.OnPlayerChange);//players array
    room.Listen("players/:id/:axis", this.OnPlayerMove);//x and y coridinates
    room.Listen("messages/:number", this.OnMessageAdded);//message array
    room.Listen(this.OnChangeFallback);

    room.OnMessage += OnMessage;

    while (true)
    {
        client.Recv();
        yield return 0;
    }
}
posted in Questions & Help • 21 Aug 2018, 12:45
RE: Dose colyseus provide any api for determining turn ?

Thanks @endel it is really helpfull

posted in Questions & Help • 28 Jul 2018, 04:46
Dose colyseus provide any api for determining turn ?

i want to make multiplayer playing card game so , is there any way to determine the turn or restrict players if it is not their turn. or i just have write my own logic??

posted in Questions & Help • 23 Jul 2018, 12:15
How to create new project from scratch??

i'm totaly new to npm . iwas able to run example project but i dont know how can i create my own from scratch

posted in Questions & Help • 17 Jul 2018, 11:32

© 2023 Endel Dreyer