aeon0/multiplayer-babylon-js-game

dist/src/index.js

neofitik opened this issue · 4 comments

I do not find the "server/dist/src/index.js" file

aeon0 commented

Hi, you need to install typescript:

>> npm install -g typescript

and in then transpile the typescript code to javascript with

>> tsc

you have to transpile both server and client. So calling tsc in the server folder generates the server/dist folder and calling tsc in the client folder will create client/public/js folder

Sorry, but i have error in /client :

src/controller.ts(22,51): error TS2345: Argument of type '{ initial: States.CONNECTING_TO_SERVER; events: [{ name: Events.CONNECTED; from: States.CONNECTIN...' is not assignable to parameter of type 'StateMachineConfig<States, Events>'.
Types of property 'events' are incompatible.
Type '[{ name: Events.CONNECTED; from: States.CONNECTING_TO_SERVER; to: States.LOADING_GAME; }, { name:...' is not assignable to type '[{ name: Events; from: States | States[]; to: States; }]'.
Types of property 'length' are incompatible.
Type '3' is not assignable to type '1'.

And when I open the site I get:

babylon.js:1 Uncaught SyntaxError: Unexpected token <
Oimo.js:1 Uncaught SyntaxError: Unexpected token <

server.js:18 Start Server
server.js:20 Connected to Server
controller.js:42 Create BabylonJS Game

game.js:37 Uncaught ReferenceError: BABYLON is not defined
at new Game (game.js:37)
at eval (controller.js:43)
at StateMachine.input (state_machine.js:41)
at WebSocket.Server.socket.onopen (server.js:21)

aeon0 commented

I took a fresh clone and followed the instructions on the readme and I can't reproduce your error :/
The error in the browser is of course because there already was an error in transpiling typescript.

Thanks for the answer.