Coder Social home page Coder Social logo

doorbash / colyseus-kotlin Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 6.0 341 KB

⚔ Implementation of Colyseus client using Kotlin

Home Page: https://github.com/colyseus/colyseus

License: MIT License

Kotlin 95.94% Java 4.06%
colyseus multiplayer game multiplayer-game kotlin java networking game-networking game-server multiplayer-server

colyseus-kotlin's People

Contributors

doorbash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

colyseus-kotlin's Issues

Error during Handshake Serializer

Hello @doorbash, thanks for your amazing client sdk for Colyseus.

I'm having an issue during the handshake (Serializer)

W/System.err: java.lang.NullPointerException
at io.colyseus.serializer.SchemaSerializer.handshake(SchemaSerializer.kt:42)
at io.colyseus.Room.parseMessage(Room.kt:92)
at io.colyseus.Room.access$parseMessage(Room.kt:20)
at io.colyseus.Room$connect$3.invoke(Room.kt:75)
at io.colyseus.Room$connect$3.invoke(Room.kt:20)
at io.colyseus.Connection.onMessage(Connection.kt:66)
at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:598)
at org.java_websocket.drafts.Draft_6455.processFrameBinary(Draft_6455.java:862)
at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:821)
at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:379)
at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:216)

Client-side:
Library: 'io.github.doorbash:colyseus-kotlin:0.14.5'
Schema:

class GameLobbySchema : Schema() {
   @SchemaField("0/boolean")
   var boo = Boolean.default
   }

Server-side:
Library: [email protected]
Library Schema: [email protected]
Schema:

class GameLobbySchema extends Schema {
    @type("boolean")
    boo: Boolean;
}

I tried many things, but I'm completly locked right now, can you help me please 😊 ?
Thanks

Updates for 0.11

Hey @doorbash!

As you may know, I'm working on version 0.11 of the server - hopefully, it won't be difficult to implement the changes in the client for Java.

The Client class has been simplified a lot. The matchmaking now occurs in an HTTP request instead of a WebSocket connection: https://github.com/colyseus/colyseus.js/blob/0.11/src/Client.ts#L31-L93

The Room had very few changes:

It would be great if you can keep this client up-to-date! 🙏
Cheers! <3

Dependensy on new version not work

Hello

Thanks for the quick fix for API 24 and lower! Everything works correctly if the source code of your library is included as a separate module.

But, when using the dependency "implementation 'io.github.doorbash: colyseus-kotlin: 0.14.2'" there is an error.

image

Bug at Room class

@doorbash Hi, please fix small mistake.

 /**
 * Send message to the room handler.
 */
public void send(Object data) {
      if (this.connection != null)
          this.connection.send(Protocol.ROOM_DATA, this.id, data);
      // room is created but not joined yet
      for (Listener listener : listeners) {
          listener.onError(new Exception("send error: Room is created but not joined yet"));
      }
}

Problem is with calling onError listener`s function. I think missing else code. Thanks for help.

Unity port http://prntscr.com/mov5zy
Js port http://prntscr.com/mov6c2

Refactor Client

Hi, @doorbash

  1. Please provide additional param to "close" client connection - "leaveRoom". Default value must be false (maybe useful while android lifecycle pause/rotate - only disconnect). If developer manully call "close(true)" - additional action is leave from joined room. http://prntscr.com/mm3zme . My use case is singleton client and I am providing state - reset client http://prntscr.com/mm3veu. So I have "connect" and "stop" functions. It is useful when user call more times dialog create/connect game - show dialog (connect to server: create room or get available rooms), close dialog (disconnect from server with leave room).
  2. Please Client "connect" function change to public and remove from constructor. I have some overhead for using "connect" function now.
  3. Please add new function "setListener" to Client class

Thanks for help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.