Where the box should be created in both client and server?


After watching and trying the code from this tutorial link http://www.youtube.com/watch?v=4medGxTsz_U, I got a question: why the box should be created in both client and server ? Can only server have the box and then let client to see it?

Many many thanks!

There server probably doesn’t usually need graphical representation. Just position and physics data.


The server should only know enough about the “box” to do the game logic. Only the client needs the “mesh” unless the server is also doing physics.

A lot will depend on your game architecture. In my server, the only JME classes I use are the networking and math classes… and I’m slowly phasing the math classes out in favor of my own double-based versions.

1 Like

in the video, the client fires a ray and I check if the ray collided with the box on the server; so the server needs a box also. You can check if the ray collides on the client and send a “successful” hit message to the server, but I didn’t think that was a good idea

1 Like

Cool! got some ideas~