Horrible response issue
Right now, there seems to be a two frame delay on any action.
It seems like, and this is just my observations,
I can be moving along a corridor. Suddenly, monsters spawn. I know they spawn, because my system stops completely. Depending on the spawn, it can take 2-6 seconds before the graphics get loaded into my video card (or at least, I'm guessing that this is what's taking so long), and then there will be one more slow frame. After that, the frame rate gets up to playable.
But what happens? I have the initial stop. I turn on my shield. I see a second frame, and again a gap. Then I see a third frame, and then my shield is up.
So what's happening? Here are some guesses.
What I want to see happening:
As soon as I press "X", the client sends a "shield: on" message to the server. The server processes it. My client eventually updates the display.
What I think is happening:
The client is getting info from the server, fetching images and animations from the disk, and stuffing them into the video card. It then updates the display, sends data to the server, and starts the next loop.
At the start of the loop, it checks for user input. It sees the X, and the lack of movement. It fetches information from the server, including my new location (I've just moved for several seconds). It updates the display, with a jump causing a delay, sends data to the server, and starts the next loop
Now it check for input. Still X, no movement. One more delay caused jump, no more movement, but now displays the shield graphics.
So what can be done to make things more responsive?
Well, the first idea is to send user input to the server at the start of the loop, before trying to adjust the display.
The second idea, possibly much harder, is to check for user input more frequently in the loop.
The third (and I don't know how well Java supports this) is to have the user input queue read by another thread. Have one thread at high priority, just sitting on the user input queue (or system event queue, not sure how Swing sequences input events). When input comes in, process it -- move the mouse, or send new facing instructions to the server, or send movement/attack/shield commands to the server as soon as they come in . If it's something that does not go to the server, re-queue it onto a different event queue being read by the main loop.
That main loop then processes events from the server, supplemental events provided by the system on the main event queue that were not turned into messages to the server, etc.
The result? With this set up, as soon as I see the frame freeze, I hit X, and release the arrow; the input processing thread gets woken up, sends "shield: on" and "Move: stop" to the server. A few seconds later, the main thread will read a new location and shield status from the server, but meanwhile I'm not taking damage while waiting for the graphics to catch up.
It's not just when monsters spawn. When there's a bunch of monsters moving around, trying to aim and shoot is painful. I'm always aiming at where something was two frames ago, and with a frame rate dropped from 15 per second to 3-4 per second, that's a good gap; a lot of shots miss, and since the key press rate has to be low enough that the frames see key down, key up, key down, etc, my max fire rate is low.
Now, that's a good reason to buy a weapon with high damage, low fire rate (which I have done).
And, it's a really good reason to have a strong sword (damage several opponents on top of me at once when I do get a swing off).
But it's very annoying that my frame per second rate isn't just my display update rate, but also my ability to issue commands and actions.
Also, two frames is not an accurate timeframe, since computers do have varying framerates, your two frame delay and my two frame delay could be whole seconds apart.