[MISC] CraftProxy 0.2.0 - Reduce bandwidth use by caching chunk data [1.6]

Discussion in 'Archived: Plugin Releases' started by Raphfrk, May 1, 2011.

  1. Offline


    CraftProxy - Reduce bandwidth use by caching chunk data
    Version: 0.2.0


    This plugin and local client allows chunk data to be cached locally by players. This reduces the bandwidth required for hosting the server. It also helps users who are on slower connections.

    I am not sure what the status of this system is. It doesn't count as a plugin, since it has 2 parts.

    Even when running the plugin, players who don't use the client proxy can still connect. However, they will use the full bandwidth.

    The system can reduce bandwidth by 70-90% (after the 2nd login).



    Add the plugin file to the plugins folder


    Start minecraft client and login
    Double click on the client jar file
    Enter login details
    Enter the server location/port in the GUI
    Press start on the GUI
    Connect to localhost on the minecraft client

    Stable Builds

    None yet

    Dev Builds

    Warning: These may not be stable


    Had it get the compress/decompression gain backwards.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 14, 2016
    Jushy, Martin1704, Nathan C and 24 others like this.
  2. Offline


    Hello @Raphfrk ! Just letting ya know CraftProxy doesn't work in 1.1. I get stuck at "Logging in..." on the client, with no errors on the CraftProxy window. I'm not running it as a plugin. Can you update it? Thanks a lot! :D
  3. Offline


    [edit] using 1.1
    i tried changing version to 12 in the cfg, but it still doesnt login

    how do i see the version number mojang uses?

    [edit] tried clientversions: 12, 13 and 20

    ill just wait... :)
  4. Offline


    Yeah, it isn't going to work with 1.1, since they changed the protocol. Hopefully, they have only made small changes and I can just tweak the code.

    Yeah, pretty small changes, should only take 10 mins to change.
  5. Offline


    Oh yay! Go Raphfrk! :D

    Hey I've been thinking, would it be too hard to make a client mod for CraftProxy? I think my players would be more willing to use it if it was embedded into the client. I have no problem with the current setup (I have a script to make it start up with Windows and run in the background) but try explaining the process (or why it's required/beneficial in the first place) to a 10 year old... :'(

    You probably already knew but I think this may be relevant to CP:
    "Add fix for new login protocol"
  6. Offline


    Spout already does the caching function and it is an entirely self-contained client.

    I was actually thinking that I could write a simple packet decoder (so the client side program is much less complex). In principle, that could be converted into a client mod.

    Having said that, as one of the Spout Team, it would be going against the principles of having mods use an API :p.

    Again, Spout is intended to help with that, since it has its own launcher.

    Hmm, don't want this to become a Spout advertisement though :p.

    Thanks, I don't read everything. However, as far as I can see, that is just intended for people who connect with the < 1.1 protocol.
  7. Offline


    Confirmed CraftProxy dont work with ModLoaderMP, just falling trough the floor.
    I run a server with BuildCraft, IndustrialCraft and Redpower. Sadly theese mods puts a lot more load on the internet connection, so if a plugin like craftproxy could be made to work with mod support would be awesome.
    Im afraid i cant be of more help but i will follow this plugin closely for any progress :)
    Thanks for great plugin :)
  8. Offline


    The latest version should support 1.1, if the docs are correct.
    I didn't do testing though :p.
  9. Offline


    Yep! I played with it for about an hour and it worked flawlessly. Thanks a lot Raphfrk! :D
  10. Offline


    Glad to hear it. I just based the changes on the protocol spec changes from here. They do all the work figuring out the change.
  11. Offline


    it still wont work for me

    just wont log in
  12. Offline


    Was it working before ?
  13. Offline


    i worked on 1.0, doesnt since 1.1

    updated to latest version and tried some client versions number in the config (11, 12, 13, 20)

    when logging in, in console it just looks like it always does (login succesfull etc)

    but just hangs on logging in

    [edit] oh, i havent tried using updated client jar... :), let me check

    [edit2] ah dumb me, i used the old .jar for the client :) it works!
  14. Offline


    Tried out the 1.1 version on the github. Unfortunately, I can't use your proxy because with mcbans, it states that everyone is everyone's alternate account. Very annoying and now I need to contact mcbans about it.
  15. Offline


    Craftproxy is working perfect for me and my server / user , (cb 129)
  16. Offline


    Trying to get this to work for the first time. Specifically what commands should I use? I understand there should be two proxies (one on the client side and one on the server side). For the moment, I'm starting both of them on the client machine.

    I start a "server" with:

    java -jar CraftProxyLiter.jar 20000 minecraftserver.tld:25565 info debug auth_off
    and a "client" with:

    java -jar CraftProxyLiter.jar 25565 localhost:20000 local_cache auth_off info debug
    Server ping works but login times out. I see this in the logs:

    [10:50:18 PM] (Alt_255): Connecting using proxy to server connection format
    Perusing the source shows me that if I set a password and put a comma in the hostname, it will use proxy to proxy instead, so I start the client with:

    java -jar CraftProxyLiter.jar 20000 minecraftserver.tld:25565 info debug timeout 10000 auth_off password foo
    Now login doesn't timeout, but then I get the error:

    [10:55:45 PM] (Alt_255): Login failed: Client closed connection before sending login
    If I set bridge_connection on the "server", then I get "Attempted password login failed".

    Also this looks like a bug; if I start the client with:

    java -jar CraftProxyLiter.jar 25565 localhost,:20000 local_cache auth_off info debug timeout 10000 password foo
    then my machine crawls to a halt with pings. Looks like it's starting threads in an infinite loop?
  17. Offline


    Can players hack easier or steal the map, does it improve all bandwidth or just logging on, and does it work with spout
  18. Offline


    Found my problem: I was using v127 instead of the latest v129. Not sure how that happened, but it's fixed now. Both "client" and "server" use "proxy to server protocol". (so what is "proxy to proxy protocol"?). I haven't checked, but I suspect the infinite loop bug still applies.

    Also, it doesn't feel much faster; I see "Loading file xx" in the log, but in Minecraft I'm still waiting for the chunks to load when I walk around (I'm on a slow connection). Can you explain how the caching works? In my head I expect some sort of binary diff between what the server has and what the client has, but I have no idea if that's right.

  19. Offline


    I would recommend using it in GUI mode at the client side. Just double click on the .jar (in windows, at least). It shows compression ratios when you do that and should be pretty much automatically configured as required (you still need to enter server and port for the server's proxy).

    It is possible that with command line it isn't working right. There should be a CPL_cache directory, are there any files in it?

    Also, make sure you connect your client proxy to your server proxy (I didn't check if you had that right).

    See next reply.

    It breaks the chunk into 2048 byte pieces and generates a hash for each piece. The hash is then an index for that piece. It is random, but with 64 bits, it is highly unlikely that there would be 2 pieces with the same hash.

    So, the cache is

    hashA -> array of 2048 byte piece
    hashB -> array of 2048 byte piece
    hashZ -> array of 2048 byte piece

    When sending a chunk, it scans the 8 pieces in the chunk and sees if the hash matches any the client knows. If it does, it just sends the 64 bit hash number instead of the 2048 byte array.

    If you load the same location twice, the second time, most of the chunks will be identical, so it will be mostly sending hash codes.

    This is why when testing, you should login, wait until the chunks around you have loaded, and then log out and back in. The 2nd load should use less bandwidth.

    As for speed, the server throttles sending chunks to around 2 per second, so no matter how small they are, it won't go faster. However, it uses less bandwidth.
  20. Offline


    Hey Raphfrk
    Thought of something... Really haven't got a clue if it's possible or not, but basically use the Proxy to filter to different ports according to what adress they're visiting.
    eg :
    Server1.mc.com:25565 -> MainIP:21000
    Server2.mc.com:25565 -> MainIP:22000

    Is this possible ? It would be amazing for co-hosters, that way people won't have to fight for :25565 and be able to each have a domain name on the main port !

    I'm guessing it depends if Minecraft stores the actual address used to connect, or if it just resolves to the IP and then connects, no ?
  21. Offline


    Exactly, the standard client doesn't send the URL when connecting.

    I could make it work since I control both ends of the connection. However, it would mean that the proxy wouldn't be able to handle normal clients, since they wouldn't have the extra info
  22. Offline


    Could be interesting for Spoutcraft users in that case.
    But how would it handle the connection for a non-Spoutcraft user ?
  23. Offline


    One option would be to ask the user which one to connect to.
  24. Offline


    Hi there Raphfrk

    I was hoping if you have the time, you could provide me with some insight whenever I try to use this plugin, it does the forwarding just fine, but I get a client crash every time I teleport over to a new server.

    Running CB for 1.1, only using Transporter/Essentials/BOSEconomy/Vault/PEX for plugins in a test environment. Running 2 servers on 1 box, forwarding localhost : port to each. Running CraftProxyLiter standalone jar forwarding to server 2. Running into the crash when I teleport to server 1 via Transporter. Also ran into this problem when using your Server Port Suite, so I'm thinking the common thing here is just CraftProxyLiter, so I thought I'd ask you as well as the Transporter guy.

    Thanks for your time, I'm sure you're busy! Any help would be greatly appreciated.
  25. Offline


    Fine. Steal my idea. I had the same idea and I'm planning to buy a VPS with 10 IPs so I can host 10 servers all with default port which actually operate on the same IP (On said IP, I have another 7 dedi's in a complex setup).

    Also, Raphfrk, I'm using version 129, and when I start the proxy:
    I have gone to the future and downloaded the newest version. It is amazing. Either that or you didn't change the thread correctly or typo'd or something.
  26. Offline


    Is this with the latest? I fixed a bug with 129 and reconnects.
  27. Offline


    Yes sir, the "Download", or this link:


    edit: Think this might have something to do with having Zombe's mod installed? I guess I could try a clean minecraft.jar.

    edit2: Clean jar file had no effect.

    Starting Craftproxy-lite version 130
    Name authentication enabled
    WARNING: reconnectfile parameter not set
    WARNING: players will be connected to the default server regardless of last server connected to
    Any problem with the lack of a reconnectfile parameter?
  28. Offline


    I also am getting this client crash every time I try to teleport between servers on the same box. Once I start the client up again and reconnect I spawn in the world I was attempting to teleport to. I am using CraftProxyLiter #130 in standalone server mode, and Transporter 7.4 on both servers to manage the redirect kicks.

    Also, another issue with this build - Spoutcraft clients can not connect. After receiving some complaints I installed spoutcraft myself, and the proxy disconnects it with the error '(Player): Login failed: Client closed connection before sending login'. Normal clients work fine with this craftproxy other than the annoying client crash on server teleports, and using a local craftproxy client to connect also works fine, so I wonder if this is a problem with spoutcraft.

  29. Offline


    I updated again, it should reconnect properly now.
  30. Offline


    Thanks for the quick response, reconnects are now working properly.

    I think I know what is happening here. A player was tripping the same error message in craftproxy, and it turned out he was still using a 1.0 client while the server is 1.1. I tried the spoutcraft dev build and it connected with no errors. If a client can't connect due to a mismatch in client/server versions perhaps the error message could be a little more intuitive.

  31. Offline


    I set this up, and was testing on my very good home wifi, b/c i log in from my schools crappy wifi, and the reloads suck! the decrease in chunk loading was noticable for me. i have only used this plugin/app for about 5 min. very easy to set up, and i have the server side running on the same machine as the MC server i run. i did see a CPU jump when i logged in, but it could have been worse!

    there was no noticable lag added, but when i went to an area that i had loaded earlier, but MC dumped, it was back in a millisecond, compared to the normal 4-6 seconds. Raphfrk, you are a GENIUS!

    After more testing, i found that on my Mid 2010 Macbook Pro, i actually gained at least half an hour of battery, and my system seems to run a bit cooler, the fans arn't quite as loud... and the temp monitor i have running says it is about 10-20 degrees F cooler... i know 30 min dont sound like much... but with the proxy my laptop says 2:08 @ 82%, with out it is 1:32 @ 82% i did the test the same way. same progs running, and i move about 4 blocks in each direction, and about 8 up/down.

Share This Page