Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - zammbi

Pages: 1 2 [3]
31
Support / Sync the server position
« on: September 06, 2008, 05:12:04 pm »
I'm a totally stuck on the maths trying to sync the movement on the server with the client. Before this I had it so the client sync with the server but that caused annoying warp backs, so I'm trying to make it so the server syncs to the client.
Hopefully I'm too confusing trying to explain this.

The server holds the current client position(CC), current server position (CS), old client position(OC).
The server on every cycle sync as much as it can to the client.

This is done by creating a guess position(G) which the CS goes towards that direction to N (The new position).
G is worked out by the angle of OC and CC, then translate CC with this new angle.
N is worked out by the angle of CS and G, then translate CS with this new angle.

This is my current code but doesn't work as expected, just moves in one direction. Hopefully someone understands this and able to tell me whats wrong.

Code: [Select]
float differenceAngle = oldrotation - rotation; //has the player turned since last cycle.

final Object3D guessPos = new Object3D(0), charObj = new Object3D(0), newPos = new Object3D(0);

guessPos.translate(clientX, y, clientZ);
guessPos.rotateY(calcAngle(new SimpleVector(oldClientX,y,oldClientZ),new SimpleVector(clientX,y,clientZ)) + differenceAngle);

charObj.translate(x, y, z);
charObj.rotateY(rotation);

final SimpleVector charPos = charObj.getTranslation();

SimpleVector a = guessPos.getZAxis();
a.scalarMul(xSpeed);

newPos.translate(x, y, z);
newPos.rotateY(calcAngle(new SimpleVector(charPos.x,charPos.y,charPos.z),new SimpleVector(a.x,a.y,a.z)));

clientX = a.x;
clientZ = a.y;
clientRotation = a.z;

a = newPos.getZAxis();
a.scalarMul(xSpeed);

               a = m.getWorld().checkCollisionEllipsoid(charPos, a, Zone.ELLIPSOID_RADIUS, 2);

charObj.translate(a);
a = charObj.getTranslation();

x = a.x;
y = a.y;
z = a.z;

oldClientX = clientX;
oldClientZ = clientZ;
oldClientRotation = clientRotation;
oldrotation = rotation;


32
Support / Grab y rotation from matrix
« on: September 01, 2008, 11:15:27 am »
I'm having a little trouble with grabbing the y rotation from a matrix. I found a nice example for 3x3 matrix but I'm totally lost with jpct matrix.

33
Projects / Casters of Fate
« on: August 29, 2008, 04:34:21 pm »
Currently I'm working on a 3d online medieval RPG browser(light download) game called Casters of Fate built by the wonderful Jpct  8)
This is my current blog on what I have done, for those who wish to know about the project.
I haven't been working on this long, only learnt project darkside last week, and then built the current server and client this week, so not much to show off atm.
Here's the sshot:

34
Support / Need help on the feud Gui
« on: August 29, 2008, 06:50:54 am »
I have been using the feud gui for my game but having a little trouble.
Window prints/moves fine but I'm unable to setup labels or text boxes right, no text is printing. I have imported all needed files and I am using the needed font.gif image.
Heres my setup method, I don't see any problems here.
Code: [Select]
    private void setupGui(){
   
        SimpleStream ss = new SimpleStream("Models/chatgui.png");
        Texture backDrop = new Texture(ss.getStream());
        try {
ss.close();
} catch (IOException e) {}
TextField field = new TextField(1, 100, 100, 10);
field.setVisible(true);
Label chatlabel = new Label(1,1);

        try {
window = new Window(backDrop, 50, 50);
window.add(field);
window.add(chatlabel);
window.setVisible(true);

} catch (Exception e) {
e.printStackTrace();
}
field.setText("Chat");
chatlabel.setText("Welcome to Casters of Fate");
    }

Also another problem is when I'm in window mode using frames Window isn't printed right. Its about 15 pixels out of place in the y direction, which also messes up when trying to move it, since you can only move 15 pixels below the gui image.
If I wanted to fix this problem where in the code this change needs to happen.

35
Support / Need example with jpct and project darkside.
« on: August 20, 2008, 06:59:02 am »
Hey I been learning project darkside for a little while, I wanted to know if anyone has examples using it with jpct?
It would help a lot if someone could post an example using both for a basic server. So I know how to set it up right.

36
Support / Animation help for md2
« on: July 08, 2008, 12:09:14 pm »
I have basic animation working, but have a problem with some frame names.
I'm using models which name there frames like so for walking:
WB01, WB02, WB03F, WB04....
F meaning play the footstep sound.
Is there a way to get the animation name?
Also the above example jpct splits that up into 3 seq, how would I play this smoothly?

37
Support / My animation isn't working
« on: July 03, 2008, 03:40:56 pm »
I have started learning jpct and finding it great. So far haven't had much trouble though wish there were tutorials to help.
Anyway one trouble I've had is my animation.
I am using md2 and animating like so:

Code: [Select]

if(walkframe >1){
walkframe = 0;
}
walkframe += .1f;
character.animate(walkframe,18);

If I change my sub-sequence I can see the model changing but if I change the index the model doesn't change at all. Even with a sub-sequence of 0.

Pages: 1 2 [3]