Webpack bundle colyseus typescript

Hi @halome,

It seems you're trying to import the server module (colyseus). Try importing the client-side one instead colyseus.js.

Let me know if that works for you.
Cheers!

Hi @endel
but i want to use server-side :)

Ok, i am trying to build phaser as local module right now and import that via npm, seems like it hase sense

Nah, dont working

@endel
What i am trying is to combine Colyseus server with Phaser.
I wish to make that in TypeScript so that's why i am doing that with webpack because otherwise Phaser-ce wouldnt work because there is some troubles with PIXI there.
So i am trying to pack everything with Webpack but then i got those errors i sent earlier.
Try to build app with Colyseus server + Phaser-CE :)

@halome AFAIK it's not possible to load Phaser on server-side. It relies heavily on the browser environment. You may be able to load it by using jsdom.

It's not a recommended to compile server code with webpack.

On the client-side you'd need to load the Colyseus client instead (colyseus.js package)

@endel

I want to create client with Phaser so i thought it would be good idea to have Phaser on server side too, so the physics and whole logic would be on server etc.
So how to make that properly? Maybe i should create some kind of HEADLESS Phaser client that will be treat as another server that the Colysues one will ask for every states? What do you thing about that or please let me know what is the best proper way. I dont want to give client physics to simulate etc.

@halome I see. That's alright! Having a "headless" Phaser would be ideal to leverage its physics engine and such. I personally haven't runned Phaser on node environment yet. I hope it's achievable without too much effort. Let me know about your results!

@endel
Ok, so i ended up with p2.js on the server side and this is working and looking really great.
Synchro between clients is perfectly matched and its really lightweigt :)
When i will make something trully playable then i can provide that to you so you could put that as example if you want to :)

Please take a look at this gif: https://imgur.com/7t17Qfw

Cheers

Awesome @halome, it's looking good! Another option would be MatterJS: https://github.com/liabru/matter-js

Good luck with your project! Don't hesitate if you need any help with Colyseus here!