I haven’t worked with networking but from what I’ve been reading, I believe you’d actually want to send the walkDirection vector from the server rather than the world location. The Better Character Control does store a world location, but it is protected in the BetterCharacterControl class and can only be altered by using .setWalkDir();, otherwise you use the charControl.warp() method to move the control.
So for the AI and NPCs in your game, you would send any pathing or movement results to their respective character control on each client.
And for the players you’d want to send the input event from each client to the server when they make a movement action such as pressing “w” “a” “s” “d”, and then you interpret this input on the server, and send back the corresponding walk direction. You shouldn’t send the player’s coordinates to the server because, if im correct, sending a variable like a Vector would allow players to hack your game much more than if you send, for example, strings that each simply represent an input event.
I agree 100% - good developers don’t ditch the documentation. Good developers carefully read the documentation and keep it handy for reference because the more you use documentation the better the quality of your code is likely to be and you’re less likely to waste precious time chasing your tail in circles because you didn’t read the documentation. I’ve been developing in Java for about 8 years now, and I still spend a good deal of time reading through the JDK javadocs - because the possible ways I could think to solve a problem off of the top of my head may very well not be the best ways to solve the problem. In general, I find that the more attention I pay to documentation the better my code is and the easier my life is (much less time spent chasing down bugs that could have been avoided by reading documentation first).
It’s good that you have a good background in programming, but just because you can program doesn’t mean you can dive into a brand new framework (and field - as I recall in another thread you mentioned being new to 3D programming) and expect to get good results without taking your time to first learn the new framework (or field). jME is not a small or simple engine. It’s an extremely powerful and well designed engine, but it’s going to take time to learn. Taking a few hours now to read the documentation and carefully design your code could save you weeks of frustration later, especially as you are talking about multiplayer games and servers. Oftentimes trivially simple things in single player games become 100x harder to do right in a multiplayer game. As far as your current problem goes, a few hours reading the documentation could save you many hours of duplicating built-in engine functionality (collisions) in order to get something that’s far less capable than what’s already in the engine.
You’re moving your character -0.2 world units straight down when you add him. If he’s appearing under the floor when you start the game I’d suggest you move him up until he’s above the floor.
You set the speed with setWalkDirection(yourWalkDir.multLocal(4f));
The cam place is your thing, dude!
From now on, I am not going to help you anymore, because everything you ask is explained in the WIKI
WIKI
WIKI
WIKI
WIKI
People invested god knows how many hours to write this, so please show respect and read this!!!
update method:
/**
* Move and rotate model
*/
walkDirection.set(0, 0, 0);
if (Left) {
walkDirection.addLocal(camLeft.mult(speed));
}
if (Right) {
walkDirection.addLocal(camLeft.mult(speed).negate());
}
if (Up) {
walkDirection.addLocal(camDir.mult(speed));
//rotate_channel.setLoopMode(LoopMode.DontLoop);
}
if (Down) {
walkDirection.addLocal(camDir.mult(speed).negate());
}
characterControl.setWalkDirection(walkDirection.multLocal(8f));
float[] angles = new float[3];
camRotation.toAngles(angles); // we get the cam angles here
angles[0] = 0; // you don't want to rotate along the x-axis, so we set it to 0
angles[2] = 0; // you don't want to rotate along the z-axis, so we set it to 0
characterModel.setLocalRotation(characterModel.getLocalRotation().fromAngles(angles));
slow
camera have low position…
you want say what not need set position (hands program method)?