Universally emulating lag

Siren Amber
I'd like for every action or response to basically have a 1-2 second interval before executing to emulate playing a MUD. I can set this manually for everything using "SetTimeout (1)" but that seems like a bloated way to go about it. Is there some sort of universal way of applying this?

HegemonKhan
I don't think so, unless you're a network expert and intentionally make your game connection, lag, lol.

or, if you're an expert coder, I'm sure there's a way to craft an advanced code structure that 'calls upon' your Timer's delay, first... before it does that individual code block.

Siren Amber
I was afraid of that, haha...Thanks anyway!

jaynabonne
I took an initial stab at this by copying the core HandleCommand function into a game, renaming it to "CoreHandleCommand" and then creating my own HandleCommand function with a SetTimeout(1) that then invoked the original Core function. That didn't work straight away since SetTimeout loses the parameters passed to the enclosing function, and those parameters need to be passed on.

A hack solution would be to store the parameters in the game object so that, after the timeout, the script could access them and pass them on. That would work if the player types a command and then waits for something to happen. However, if the player types a command (or clicks a link or something) and then enters another command before the initial timeout ends, then it would stomp on the variables in the game object and lose any previous command.

This can be solved by having a list of command/metadata pairs in the game object, as a queue for pending commands. The question is, is all of this really worth it? Especially since the goal is to make the game experience (in my opinion) worse for the player. If you do still want it, I could try to make the code work.

Edit: Also, keep in mind that if you offer the game online on the Quest website, there will be a lag in there anyway since the online player is server based. (I wish I could get *rid* of that in my games.) You could try publishing your game privately online and see if it's not a problem to begin with. lol

The Pixie
jaynabonne wrote:Edit: Also, keep in mind that if you offer the game online on the Quest website, there will be a lag in there anyway since the online player is server based. (I wish I could get *rid* of that in my games.) You could try publishing your game privately online and see if it's not a problem to begin with. lol

Yeah, the lag is enough to be annoying anyway. i would not advise deliberately making it worse!

Siren Amber
This particular game is for my own personal use, for testing. I wanted the delay because I've played MUD's for years and am used to seeing a 1-2 second lag between what I type and what the response is. So to me, having something respond instantly is foreign!

Thank you all for your ideas but no need to spend time on it -- I'll just get used to it!

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums