JTG2003's Profile User Rating: -----

Reputation: 0 Apprentice
Active Members
Active Posts:
51 (0.04 per day)
29-February 12
Profile Views:
Last Active:
User is offline Sep 29 2013 05:58 PM

Previous Fields

Dream Kudos:
Icon   JTG2003 has not set their status

Posts I've Made

  1. In Topic: Integer and Double Arithmatic

    Posted 29 Sep 2013

    View Postpbl, on 29 September 2013 - 05:47 PM, said:

    That is why you should never compare double with the == operator
    calculations can produce
    x = 15.0000000000000001
    y = 14.9999999999999999

    both will be considered as != even if, in certain contexts, equal

    Well in the code I accidentally posted, I used Math.floor(double)!=int which I think is working correctly..
  2. In Topic: Integer and Double Arithmatic

    Posted 29 Sep 2013

    Hm, didn't mean to post that last post there. Was halfway through creating it (realized the code didn't really make sense as is) when I figured out a part of my problem.. but I somehow posted it anyways and didn't realize until it was too late to edit it.

    Please disregard the last post.
  3. In Topic: Integer and Double Arithmatic

    Posted 29 Sep 2013

    Hmm, ok. I've been working on this one part for a couple nights now and I can't seem to properly wrap my head around it. This is what I have:

    private class moveThread extends Thread
    		Entity ent;
    		int URN,endX,endY,movingX,movingY,dX,dY,delay;
    		boolean change = false;
    		public smoothMoveThread(int URN, int[] newCoords, int delay)
    			System.out.println("New smoothMoveThread. URN :" + URN + " X: " + newCoords[0] + " Y: " + newCoords[1] + " Delay: " + delay);
    			this.URN = URN;
    			ent = getEntityByURN(URN);
    			endX = newCoords[0];
    			endY = newCoords[1];
    			movingX = ent.getX();
    			movingY = ent.getY();
    			dX = endX - movingX;
    			dY = endY - movingY;
    			this.delay = delay;
    			double dXd = (double)dX/delay;
    			double dYd = (double)dY/delay;
    			System.out.println("Delay: "+ delay + " dX: " + dX + " dX/delay: " + (double)dX/delay + " dY: " + dY + " dY/delay: " + (double)dY/delay);
    		public void run()
    			System.out.println("smoothMoveThread start");
    			for(int i=0;i<10;i++)
    				System.out.println("i: "+i);
    				double newX = movingX + (((double)dX / delay) *i);
    				double newY = movingY + (((double)dY / delay) *i);
    				System.out.println("Dec X: " + newX + " Dec Y: " + newY);
    					movingX = (int) Math.floor(newX);
    					System.out.println("Moved X updated to " + movingX);
    					change = true;
    					movingY = (int) Math.floor(newY);
    					System.out.println("Moved Y updated to " + movingY);
    					change = true;
    					System.out.println("Updating coords");
    					// Possibly trigger redraw here?
  4. In Topic: Networked Player Movement - Restricting Messages + Interpolation

    Posted 6 Sep 2013

    View PostBBeck, on 06 September 2013 - 02:09 PM, said:

    Is it 2D or 3D?

    2D Top-Down 8 directions

    View PostBBeck, on 06 September 2013 - 02:09 PM, said:

    In my mind, the server always must know the current state of the game <...> anything that actually changes the state of the game world has to be recorded on the server.

    Right. I'm just worried about sending too much to the server.

    View PostBBeck, on 06 September 2013 - 02:09 PM, said:

    You could basically hit the "rewind" button on certain things display wise.

    I think this is getting a little beyond what I'm going for. I'm OK with someone jumping around if they have severe lag. I might look into smoothing this later, but for now the main two goals are

    1) You must see your own player moving in real-time. If you lag out, yeah you might jump back a bit when the server needs to correct you, but this should not be a regular occurrence.
    2) You must see other player moving smoothly. They will have a built in lag for the interpolation so their position will be 100-200ms behind their actual server-side position, but it will ensure a smooth display. Again, lag spikes aside.

My Information

Member Title:
D.I.C Head
Age Unknown
Birthday Unknown

Contact Information



JTG2003 hasn't added any friends yet.


JTG2003 has no profile comments yet. Why not say hello?