Hi, I’m developing a nodejs-based backend for my PlayCanvas online project and I’ve reached the point where I need to perform collision detection (bullets, player colliding with other objects, etc).
I’m wondering if using PlayCanvas Engine in the backend would be a good or a bad idea. Using the same code base and API for physics and server-side collision detection would be awesome, but I don’t want the server to “draw” anything, as I’d just need to run a “light” version (basically physics on low-poly entities) of the game scene.
What do you think? Is this something feasible? Can you use PlayCanvas without actually rendering anything?
@devMidgard Did you use a headless version of the PlayCanvas engine in the backend for some of your IO games?
Ah, here we go: Need Help With An Authoritative WebSocket Server
Thanks for the hint @yaustar, that seems a little bit tricky but might work. I’ll explore JSDOM and similar ways of mocking the browser in a server.
I was hoping that there was an option in the engine that “turns off” the rendering or something like that. Something like what you mentioned here: Is the engine viable for multiplayer? where can we find that “no render” flag?
This disables the rendering but doesn’t remove it: https://developer.playcanvas.com/en/api/pc.Application.html#autoRender
Now that the engine has moved to ES6 modules, it might be easier now to remove the rendering part of the engine so it’s worth a look to see if that is possible.
Been there, done that.
If you want to squeeze the max out of your servers, forget about using the PlayCanvas engine. It’s better to start with a blank nodejs app and just build into it.
My suggestion is grab PlayCanvas’ Physics Engine (AmmoJS), slap it into nodejs (like I do) and put also uWS into it. Boom, you suddenly get a full fledged Physics Engine on server side to do your world simulation at, and you also get the best network lib there is for nodejs.