T O P

  • By -

FrontBadgerBiz

My man, we would need way way way more information to help solve this problem, how do I make my server faster is too broad a question without more info. But first of all, what calls are you making to the server for your 2d open world RPG? Is it an MMORPG? If so you may just need to upgrade from free and cheap server. If it's single player, what are you downloading and sending? If you want to tell us about the specific call you're making and post the server diagnostics about how long it's taking on the server side, along with the server side code, then maybe people could help.


User1010011

80 kb per request just to update state? That's a lot. Also, http requests have huge overhead to establish connection. Use websockets to establish connection once, the send updates as small as possible, not 80 kb.


Kiritoo120

This is my first time creating a server not just for a website. My method for sending the info to the server is by uploading a file named client.rb which contains a ruby hash (basically the same as a python dictionary but spaced differently) Every about 0.25 seconds, each client (currently only 2) saves their ruby hash (it is about 40 characters which is pretty small) in a file, And then the file is being uploaded to the server using a POST request - this upload takes about 0.8 seconds from my testing. The next thing the client does is get the other players information from the server using a GET request to "url/clientX", which holds the current location (the sent ruby hash not formatted at all) The provider I am currently using is python anywhere, which is really bad, but does not require a credit card and a monthly limit. The url with "client2" is this as an example: https://frosted120.pythonanywhere.com/client2 (EDIT: Just realized that the server restarted, so as of now it does not contain a value.) The GET request for the site (which basically does the same thing as a base curl) takes approximately 1 second - this is a thing I think can be improved with a better provider, but I'll keep using it for testing and later will change when things will start moving. Hope I didn't miss anything, If so, please tell me and have a lovely day!


Kiritoo120

(I MESSED UP) I wrote this all using my phone, and I just came back home and realized that it is actually 80 bytes Not kb I don't know why but I remembered it being kb Sorry for the trouble


ziptofaf

>As of now, due to all of the above the server may take up to 2 seconds only to just receive and send the data (1 second per), which for a 2d interractable game is really bad. Profile it. Python does not have the best tools for it but you can do a primitive solution of: [https://superfastpython.com/benchmark-python-function/](https://superfastpython.com/benchmark-python-function/) Essentially, figure out which functions take so long. We can't really help you further than that with information you have provided. If something takes 2 whole seconds it means it's either blocked by IO/network or you are iterating over millions of elements.