Saturday 10 June 2017

Adding server-side libraries for javascript

I am currently coding my offline game into an online game by use of node.js and socket.io

In my game, I use vectors from a library called p5.js to store position of player, collision related movement, etc.

However, the server side (a txt file called "server.js") does not have p5.js like the client, so I can't send information about the player's with vectors.

Here is my question: How could I make the server.js file have access to my p5.js library?

Note: Simply sending x and y values, and then using them to make a vector would be a difficult solution, as I would no longer be able to send a single array holding all the information of all players. Also, enemies, food, trail positions, and much more also depend on vectors. Coverting all of these would be difficult to code.



via Canatron

No comments:

Post a Comment