Ask coding questions

← Back to all posts
Increasing API response time
h
sojs

Hi everyone!

I have a problem

A biggie to.
On line 249 of the given repl, the problem is illuminated.

For those of you who are not sure what is going on.

Ignore everything but lines 240-253.

They are unimportant. What matters is that that I created a request to an API that I made, https://replit.com/@sojs/MultiSnake-R-500#index.js, and it logs the time that it took to respond.
The below is a nice screenshot of that.

But. We have a problem. For those of you that delve deep into the games code you will see that the API runs a bot for my game. It gets all the data, and returns a direction for the snake to travel in. You will notice that the game loop runs once every 120 milliseconds. Look back at the response times. 400ms. 200ms. But not one below 120. Any suggestions on either the game (be glad to hear them) or how to lower the response time? Remember, I do not want to buy hacker plan and add a boost. I have already tried setting a timeout to the request but that just meant that my bots never moved becuase the servers could never respond within the timeout. How do I change this? Open to any suggestions.

Thanks!

Voters
sojs
Comments
hotnewtop
ch1ck3n

it's just based on your repl speed (the speed of the computer it is hosted on)

so maybe get hacker plan and turn on boost?

https://replit.com/site/pricing?referrer=ch1ck3n

sojs

Looking for alternatives to that.

I do not want to buy hacker plan and turn on boost
@ch1ck3n

ch1ck3n

@sojs or just ask me for a code I'll get you one

sojs

ahahaha i see where ur going with this :) :)
my old code that I would use "thankyou" stopped working so ive been haning dry. @ch1ck3n