<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Timing of movement]]></title><description><![CDATA[<p>Can anyone give me some advice on technical design around accepting and processing player input? I am using Unity for the client side.</p>
<p>Atm I am just sending a message to the server every frame as long as a key is held down and I am just adding a value to x/y when the command arrives. Would it be better to have a short timeout between sending such messages?</p>
<pre><code>private void Update()
{
	if (Input.GetKey(KeyCode.LeftArrow))
	{
		client.Send(Msg_MoveLeft);
	}

...

movePlayer(client: Client, action: string)
{
    if (action === &quot;L&quot;) 
    {
        this.players[client.sessionId].x -= 0.1;
    } 
</code></pre>
<p>How would one deal with movement speed server side? I was thinking I should collect the player's wanted actions like, move left, right, etc; and then in the &quot;update&quot; function, which is a setSimulationInterval callback, I would do the actual movement so that it is locked to some time interval (movement speed).</p>
]]></description><link>http://discuss.colyseus.io/topic/95/timing-of-movement</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 13:41:08 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/95.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 08 Jun 2018 15:47:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Timing of movement on Fri, 08 Jun 2018 15:47:54 GMT]]></title><description><![CDATA[<p>Can anyone give me some advice on technical design around accepting and processing player input? I am using Unity for the client side.</p>
<p>Atm I am just sending a message to the server every frame as long as a key is held down and I am just adding a value to x/y when the command arrives. Would it be better to have a short timeout between sending such messages?</p>
<pre><code>private void Update()
{
	if (Input.GetKey(KeyCode.LeftArrow))
	{
		client.Send(Msg_MoveLeft);
	}

...

movePlayer(client: Client, action: string)
{
    if (action === &quot;L&quot;) 
    {
        this.players[client.sessionId].x -= 0.1;
    } 
</code></pre>
<p>How would one deal with movement speed server side? I was thinking I should collect the player's wanted actions like, move left, right, etc; and then in the &quot;update&quot; function, which is a setSimulationInterval callback, I would do the actual movement so that it is locked to some time interval (movement speed).</p>
]]></description><link>http://discuss.colyseus.io/post/303</link><guid isPermaLink="true">http://discuss.colyseus.io/post/303</guid><dc:creator><![CDATA[plyoung]]></dc:creator><pubDate>Fri, 08 Jun 2018 15:47:54 GMT</pubDate></item><item><title><![CDATA[Reply to Timing of movement on Invalid Date]]></title><description><![CDATA[<p>Hi <a class="plugin-mentions-user plugin-mentions-a" href="http://discuss.colyseus.io/uid/90">@plyoung</a>,</p>
<p>I think a better approach would be to send when the key is active. Activating the &quot;left&quot; command when the key is first pressed, and de-activating it when it's released. This would avoid sending too many messages per frame.</p>
]]></description><link>http://discuss.colyseus.io/post/304</link><guid isPermaLink="true">http://discuss.colyseus.io/post/304</guid><dc:creator><![CDATA[endel]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Timing of movement on Invalid Date]]></title><description><![CDATA[<p>Ah yes, that would be much better.  Thanks.</p>
<p>My first time trying to create a &quot;real time&quot; multiplayer game. I've only done turn-based, in multiplayer games, before so I'm not quite sure about all the correct ways to approach this.</p>
]]></description><link>http://discuss.colyseus.io/post/305</link><guid isPermaLink="true">http://discuss.colyseus.io/post/305</guid><dc:creator><![CDATA[plyoung]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>