<div dir="auto">In the web client, I did a periodic CP_UPDATES packet, which just repeatedly requests the server to keep using the same update rate we're already using: <a href="https://github.com/apsillers/html5-netrek/blob/e99e25d10166dda662c534a671689142f62d4301/js/main.js#L246">https://github.com/apsillers/html5-netrek/blob/e99e25d10166dda662c534a671689142f62d4301/js/main.js#L246</a><div dir="auto"><br></div><div dir="auto"><div dir="auto">setInterval(function() { net.sendArray(CP_UPDATES.data(UPDATE_RATE)); }, 10000);</div><div dir="auto"><br></div><div dir="auto">I'm also curious if there's a better way or not.</div><div dir="auto"><br></div><div dir="auto">Andrew</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 28, 2019, 8:14 PM Darrell Root <<a href="mailto:darrellroot@mac.com">darrellroot@mac.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">netrek-dev folks,<div><br></div><div>Question 1: On <a href="http://continuum.us.netrek.org" target="_blank" rel="noreferrer">continuum.us.netrek.org</a>, if my client doesn’t send any commands for 20-30 seconds, I get ghostbusted.  It seems like the server wants some sort of activity keepalive.  Any ideas?  There is a SP_PING and a CP_PING_RESPONSE, but I don’t see a CP_PING.  What should I send periodically?</div><div><br></div><div>Question 2:<br><div><br></div><div>I’m having trouble with the “picking team” logic in my netrek client.</div><div><br></div><div>The server sends an SP_MASK packet:</div><div><pre style="word-wrap:break-word;white-space:pre-wrap">struct mask_spacket { /* SP_MASK py-struct "!bbxx" #19 */
    char type;
    char mask;
    char pad1;
    char pad2;
};
</pre><pre style="word-wrap:break-word;white-space:pre-wrap">Here’s what the currently online servers send:</pre></div><div><a href="http://continuum.us.netrek.org" target="_blank" rel="noreferrer">continuum.us.netrek.org</a> sends mask = 15 (fed + rom + kli + ori)</div><div><a href="http://netrek.beesenterprises.com" target="_blank" rel="noreferrer">netrek.beesenterprises.com</a> sends mask = 3  (fed + rom)</div><div><a href="http://pickled.netrek.org" target="_blank" rel="noreferrer">pickled.netrek.org</a> sends mask = 2 (rom)</div><div><br></div><div>Then the client sends a CP_OUTFIT packet:</div><div><pre style="word-wrap:break-word;white-space:pre-wrap">struct outfit_cpacket { /* CP_OUTFIT py-struct "!bbbx" #9 */
    char type;
    char team;
    char ship;
    char pad1;
};</pre><pre style="word-wrap:break-word;white-space:pre-wrap">It looks like the “Team” has to be an integer between 0 and 3 inclusive:</pre><pre style="word-wrap:break-word;white-space:pre-wrap"><span style="font-family:Menlo;font-size:11px">netrek-server-vanilla/ntserv/getentry.c:</span></pre><pre style="word-wrap:break-word;white-space:pre-wrap"><span style="font-family:Menlo;font-size:11px">            if (teamPick < 0 || teamPick > 3) {</span></pre><pre style="word-wrap:break-word;white-space:pre-wrap"><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">                new_warning(UNDEF,"Get real!");</span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">                sendPickokPacket(0);</span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">                teamPick= -1;</span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">                continue;</span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">            }</span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><br></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo">On <a href="http://beesenterprises.com" target="_blank" rel="noreferrer">beesenterprises.com</a>, when I send team = 0 I end up rom.  Anything else I am rejected.</div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo">On <a href="http://pickled.netrek.org" target="_blank" rel="noreferrer">pickled.netrek.org</a> when I send team = 0 I end up rom. Anything else I am rejected. </div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo">On <a href="http://continuum.us.netrek.org" target="_blank" rel="noreferrer">continuum.us.netrek.org</a>, when I send team = 0, I end up rom.  Anything else I am rejected.</div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><br></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo">Is there a way to select teams?  What does the team = 0 or 1 or 2 or 3 mean in the CP_OUTFIT packet?</div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><br></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo">I have a pulldown menu with the “preferred team”, but it doesn’t work the way a player would expect.</div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><br></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo">Darrell</div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><br></div></pre></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div>_______________________________________________<br>
netrek-dev mailing list<br>
<a href="mailto:netrek-dev@us.netrek.org" target="_blank" rel="noreferrer">netrek-dev@us.netrek.org</a><br>
<a href="http://mailman.us.netrek.org/mailman/listinfo/netrek-dev" rel="noreferrer noreferrer" target="_blank">http://mailman.us.netrek.org/mailman/listinfo/netrek-dev</a><br>
</blockquote></div>