This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
hego555's profile picture

Server Type Lag

Started by hego555, 10 September 2012 - 05:02 AM
hego555 #1
Posted 10 September 2012 - 07:02 AM
When I use CC on my server the keys typed is slow ;(

So I type and there is a second delay… I am guessing the way the mod works is that when you type it sends the key to the server and the server sends it back…

This cause's there to be lag between the client and the server when typing!!!
Can we change it?

or add a config option?
Cloudy #2
Posted 10 September 2012 - 07:55 AM
I'm afraid there is no way round this. All processing is carried out server side - which means telling the clients what they should show on their screen. The process when you type a character when read() is on is as follows:

Client presses key
Key gets picked up by Java
Key gets sent by packet to server
Server Java receives packet
Server Java sends key to server Lua
Server Lua looks at the key, decides it is text and calls term.write()
Server Java sends terminal update packet
Client Java receives, updates the terminal

As you can see, all that is what needs to happen for one key to be processed while read is active - including a round trip with processing time.
hego555 #3
Posted 10 September 2012 - 11:40 PM
Cant we have it so it shows you the character on your screen while sending the packet to the server.

Like

*Press's A

print's A
send's A to server
receives conformation of A
Noodle #4
Posted 11 September 2012 - 03:33 AM
Cant we have it so it shows you the character on your screen while sending the packet to the server.

Like

*Press's A

print's A
send's A to server
receives conformation of A
They could but this would be inconvenient because of "ghost characters". Its going to have to stay this way, just look thru the computers on the server. Some have lag programs which are annoying.
hego555 #5
Posted 11 September 2012 - 07:02 AM
What are ghost characters?

Do you mean characters you have but the server didnt receive? or you mean the server cant sanitize some things if it goes through the client first!
Cloudy #6
Posted 11 September 2012 - 07:28 AM
What are ghost characters?

Do you mean characters you have but the server didnt receive? or you mean the server cant sanitize some things if it goes through the client first!

How does the client know what the sever is going to do with the key? Sure, if you're using read() it will be displaying it - but what if you're playing worm? If you press w s a or d there you don't want them to show on the screen.
hego555 #7
Posted 11 September 2012 - 07:30 AM
I see, here is a solution, add a method to the OS that allows the client to know if the key is supposed to be hidden…
Cloudy #8
Posted 11 September 2012 - 08:35 AM
I see, here is a solution, add a method to the OS that allows the client to know if the key is supposed to be hidden…

That is unreliable. We have no way of knowing where the key should actually be - say I press down, or up while in the shell - it will add a new block of text and set the cursor pos. How would the client know where the new cursor pos was? Due to that very same input lag you mention, if you press a character there, it will get placed at the wrong place.

Now, say we are within edit? If you press down there, the line to write on goes down. How would we predict that client side?
hego555 #9
Posted 11 September 2012 - 08:54 AM
I see, too many problems to make it worth it