Recommended Posts

Hello everyone!

 

So I want to start using babylon.js and I want to calculate the collison on the server (so I guess I need no rendering, only calculating with meshs loaded by loaders). For that I would use node.js for server-side javascript.

The question is, is it possible to use babylon with node.js since node.js is using their module.export way to include other files?

 

Anyone tried it out? I tried it with normal npm install babylonjs but when I require the babylon files with node.js I only get errors like navigator objects is not defined.

 

If anyone knows more on this topic I would be interested to hear (since I am a noob)!

 

greets~

Share this post


Link to post
Share on other sites

That's really not recommended. You will still need some form of rudimentary collision detection in the client or you're going to get a lot of position readjustment "glitches". If it's not real time movement then you'd probably be ok. What you're suggesting will cause the render loop to wait for your packet to the server, collision calculation calcultion, the return message, message processing, etc. You're going to loose a lot of FPS doing it that way.

 

The more standard way to do that is to guess the collisions on the client and then adjust as needed after the server calculates it. You build in an acceptable deviation to minimize the position glitching. This is really only useful when you're trying to stop speed / position hackers in your game.

Share this post


Link to post
Share on other sites

Indeed, I'm working on a project that uses that also. I calculate everything in the client then I post the coordinates on the database (in a PHP server). In the beggining I thought the same has you, but rapidly I saw that it would be impossible to run it smoothly (and my project is not smooth enough, i can assure you, cause of the delay to get the coords for drawing the meshes).

Share this post


Link to post
Share on other sites

Well I want to calculate the collision on the client and server, as you said, the server will check if the new position is possible.

But I still got the problem with the 3d calculation on the server. Since I use node.js as the server I need to get babylon working on node.js (atleast for calculation).

I tried it so far with this gulp-builder (don't know what it is exactly) but I don't get babylon to work with node.js.

 

Thanks anyways.

Share this post


Link to post
Share on other sites

It's not going to be as easy as that. What you're going to have to do is make a custom server that will keep up with movement speed, move start, move end, move direction, and then use a program on the server side that will read positions from a 3D environment and then compare client location with server location. If the positions are not within your margin of error then you have to issue a "move to" packet back to the client to put the moving object where the server thinks it should be.

 

This is the problem with something like the canned node.js. You're going to need a server program that can handle all the 3D math, and position tracking through packet updates from the client. I don't recommend a website back end to process the kind of information that you are wanting to accomplish. It's just not going to be fast enough. We had to make all that for the last version of our game, and we'll have to do it again for the Babylon version. If you're planning to use babylon on the client and server, then right from the start you're going to cut your FPS in half or more. Just gravity collisions alone on a decent size scene can cause a render speed of 10 FPS or less with Babylon.

 

Not trying to discourage you, just trying to give you an idea of what you will probably need based on experience.

Share this post


Link to post
Share on other sites

Thanks grimor that was something I searched for. Yeah I have to emulate it somehow but I am just creating a concept for that so I don't think it will work out in the end with emulating canvas and webgl on node.js.

 

reddozen thanks for the information, I already thought that it would be really complicated. As you say I need a server program which handles the calculation check from the client and then moves the client back if he is "wrong".

That is why I wanted to use node.js and either try to get the babylon math+3D environment libraries working on node.js or use an entirely new option (for examples a c++ server with http socket then using opengl).

 

I like babylon.js and I just want to create a simple 3D multiplayer game at the moment but I still don't know how to concept the verify if the user is "cheating".

If I use node.js for example a user could just simply use the console of his browser and send the server a false positions, so I have to calculate the position somehow on the server.

Share this post


Link to post
Share on other sites

I recommend something faster than javascript. C++ or Standard C would be your fastest / most universal options. You can use C#, but it's a little slower, and not *nix friendly.

 

You probably wont even need openGL. I'm pretty sure we used SDL and Recast & Detour (https://github.com/memononen/recastnavigation) for the navigation / position verification. All you need to do is calculate locations in 3D space and see if the time it took to get them to that position is reasonable. If you try to get too picky, someone with a low latency connection can look like a speed hacker.

Share this post


Link to post
Share on other sites

Thanks very much!

I am now seeing a solution in trying this whole thing with javascript and babylon on the client and the entire server build up with c++ with http sockets and a 3d calculation solution with libraries like this SDL (watched it shortly through) and Recast navigation.

 

Something I am still not sure about are the model loaders. I will have to load the models on the client for the whole rendering thing and on the server only to calculate with them.

Wouldn't it be good if I can use the same model format on the server and client. So I probably need to watch out for the loader on both sides.

Share this post


Link to post
Share on other sites

keeping the format the same would only help for keeping up with everything, or making it more universal. As long as the models have the same vertexes etc you're fine no matter what the format. you wont need textures or anything on the server side either. You would just have to feed the model data into recast.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.