- Joined
- Aug 9, 2012
- Messages
- 69
- Reaction score
- 10
The major problem people seem to be complaining about with any server using PokeNet as its backbone is the movement delay. We all know it, we've all experienced and we've all seen the fix in action on certain servers. Well, I am here today to share this fix with the community of RageZone.
I'd like to give a special thanks to:
xkl
Pokemonium
Instructions
I'd like to give a special thanks to:
xkl
Pokemonium
Instructions
First off, you'll want to open up GameClient.java which is located in the client files of PokeNet. This is the only file we'll be editing today so no need to worry about the rest.
Now that we've got that open, look for some lines at the top similar to
Add in an extra line so that the above now looks like this
Now, we'll search for a line that should look like
above that comment space we'll add in this code
The code above is the main fix, but to get it to all come together you'll need to make a few more edits. We'll now look for a line of code similar to..
Remove the override and the comments above it and make it look like the code below..
And finally, above that we'll place this chunk of code in
Save your client, and compile. Run your server and your client and use the arrow keys to move around, you'll notice it's a LOT better. This fix can be applied to the other WASD movement keys as well but if you are that concerned you will be able to do that yourself.
Now that we've got that open, look for some lines at the top similar to
Code:
//The gui display layer
private Display m_display;
private WeatherService m_weather;// = new WeatherService();
Add in an extra line so that the above now looks like this
Code:
//The gui display layer
private Display m_display;
//Movement Fix
private int lastPressedKey;
private WeatherService m_weather;// = new WeatherService();
Now, we'll search for a line that should look like
Code:
* Check if we need to loads maps
above that comment space we'll add in this code
Code:
if (lastPressedKey > -2) {
if (gc.getInput().isKeyDown(lastPressedKey))
{
handleKeyPress(lastPressedKey);
}
if ((lastPressedKey != Input.KEY_UP) && (lastPressedKey != Input.KEY_LEFT) && (lastPressedKey != Input.KEY_DOWN) && (lastPressedKey != Input.KEY_RIGHT))
{
lastPressedKey = -2;
}
}
The code above is the main fix, but to get it to all come together you'll need to make a few more edits. We'll now look for a line of code similar to..
Code:
public void keyPressed(int key, char c) {
Code:
public void handleKeyPress(int key) {
lastPressedKey = key;
And finally, above that we'll place this chunk of code in
Code:
/**
* Accepts the user input.
* @param key The integer representing the key pressed.
* @param c ???
*/
public void keyPressed(int key, char c)
{
lastPressedKey = key;
}
Save your client, and compile. Run your server and your client and use the arrow keys to move around, you'll notice it's a LOT better. This fix can be applied to the other WASD movement keys as well but if you are that concerned you will be able to do that yourself.
Last edited: