Purpose: To remove the 'Walking lag' problem in DeltaClean
Difficulty: 1
Explanation: For those using my 'DeltaClean' Base located [Only registered and activated users can see links. ], Most of you notice there is a problem with walking and it is laggy, Follow the steps below to fix this and continue learning good habits.
Step 1:
Open up 'Process.java',
Step 2:
Replace EVERYTHING in there with the following:
Code:
public class Process extends Thread {
public static int cycleTime = 500;
@Override
public void run() {
int waitFails = 0;
long lastTicks = System.currentTimeMillis();
long totalTimeSpentProcessing = 0;
int cycle = 0;
while (!Server.shutdownServer) {
try {
if (Server.updateServer)
Server.calcTime();
Server.playerHandler.process();
Server.npcHandler.process();
Server.itemHandler.process();
Server.shopHandler.process();
long timeSpent = System.currentTimeMillis() - lastTicks;
totalTimeSpentProcessing += timeSpent;
if (timeSpent >= cycleTime) {
timeSpent = cycleTime;
}
try {
Thread.sleep(cycleTime - timeSpent);
} catch (java.lang.Exception _ex) {
}
lastTicks = System.currentTimeMillis();
cycle++;
if (cycle % 100 == 0) {
float time = ((float) totalTimeSpentProcessing) / cycle;
}
if (Server.ShutDown == true) {
if (Server.ShutDownCounter >= 100) {
Server.shutdownServer = true;
}
Server.ShutDownCounter++;
}
} catch (Exception e) {
e.printStackTrace();
}
}
// shut down the server
EventManager.getSingleton().shutdown();
Server.playerHandler.destruct();
Server.clientHandler.killServer();
Server.clientHandler = null;
}
}
Step 3:
Save, compile, and test it out.
Note: I havn't tested this, but it should work, so if somebody could test and confirm this would be much appreciated.
Also, depending on the success of this tutorial and overall use of DeltaClean i may release a crash patched version to stop the crashing. Thanks
Sorry I forgot that usually when there is a problem with walking you dont look in where walking is handled rather where the process is handled. Cause thats every ones first instinct.
[Only registered and activated users can see links. ]
Sorry I forgot that usually when there is a problem with walking you dont look in where walking is handled rather where the process is handled. Cause thats every ones first instinct.
Do you use DeltaClean / Have you tested this? Does it work?