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

Client-Sided Computers

Started by Gumball, 17 December 2015 - 10:46 AM
Gumball #1
Posted 17 December 2015 - 11:46 AM
Basically, this improves the speed of Computers on a server, by that I mean they are controlled client-sided by the user who interacted with it first from the most recent boot-up. Since they're client-sided, then it can send the events to the server, so another viewer can see whats happening, and interact too. The only reason they computer would be temporarily server-sided is when another viewer does a large scale action, such as a screen clear. Text is very low density, which would be fine for it to be handled mostly-client sided. This idea can be improved, like changing the condition the computer is temporarily server-sided to something else. Thanks for reading this!
Creator #2
Posted 17 December 2015 - 02:21 PM
What happens when the client disconnects? Or gets a power loss, so sending info back will not work. This too complicated. I do not think it is a good idea. If that does not convince you, maybe this will: Dan has most probably thought of this idea before, so if it was feasible he would have.
Lupus590 #3
Posted 17 December 2015 - 02:39 PM
What happens when the client disconnects? Or if the client crashes? You'll lose data.

Also the current Lua that CC is using can't save coroutines (which is related to why we can't transmit them via rednet), so you can't move a computer running on a client onto the server. However, there seams to be plans for an update to the Lua VM, which would allow the saving of coroutines.
Edited on 17 December 2015 - 01:41 PM
SquidDev #4
Posted 17 December 2015 - 02:40 PM
I'd suggest having a read through this thread (don't bump it though). The general gist is that whilst it is technically feasible, it probably isn't a good/practical idea. Or don't read through that thread - normally nice people end up being pretty horrible in it.

Minecraft's client is mostly a thin-client: logic runs on the server. You can see this when a server begins to lag: you can flick a lever but redstone will not activate. The same goes for computers - most valuable tile entity data will only be stored on the server, so mods like OpenPeripheral cannot access most data if they are running on the client side.

The idea of moving the computer between client and server isn't really feasible with LuaJ. It would involve serializing the entire Lua state, sending it over the network and recreating it - a similar process to making computers persistent which LuaJ also doesn't support.
Edited on 17 December 2015 - 01:45 PM
Gumball #5
Posted 17 December 2015 - 07:19 PM
Okay. It was just a suggestion. Thanks for replying though.
Lyqyd #6
Posted 17 December 2015 - 07:39 PM
Another issue is that it would break the don't-trust-the-clients principle. A door lock would be pretty useless if a player can install a client-side mod that would trick the server into thinking the computer is outputting redstone signals on an arbitrary side.
Gumball #7
Posted 18 December 2015 - 03:27 PM
Another issue is that it would break the don't-trust-the-clients principle. A door lock would be pretty useless if a player can install a client-side mod that would trick the server into thinking the computer is outputting redstone signals on an arbitrary side.

Fair point.
3d6 #8
Posted 19 December 2015 - 10:30 PM
Maybe this would be okay with pocket computers, if they weren't wireless. The only opportunity there would be to open a pocket computer without actually owning one, and it wouldn't really be able to interact with the world or its computers. You might as well just open an emulator.
Creator #9
Posted 19 December 2015 - 11:05 PM
They do interact with world, when they read the files. The client might still mess around and put a 10TB file, that will crash the server.
Engineer #10
Posted 20 December 2015 - 01:24 PM
They do interact with world, when they read the files. The client might still mess around and put a 10TB file, that will crash the server.
Luckily ComputerCraft caps this; unless the server owners allow infinite computer (from cc) space which would be a stupid idea. To reach such a large file size it would take quite long and can be noticed.
Creator #11
Posted 20 December 2015 - 01:50 PM
I am just saying that theoretically it could be an issue.
3d6 #12
Posted 20 December 2015 - 05:50 PM
Well, if it's a client side pocket computer, the files would be client sided anyways.
Creator #13
Posted 20 December 2015 - 06:32 PM
The files would be stored on the server, @3d6. How would other people access them?
3d6 #14
Posted 20 December 2015 - 10:05 PM
Ideally, they never would
Creator #15
Posted 20 December 2015 - 10:11 PM
What happens if you give the pocket computer to someone else? Do the files get transferred.