{"id":2091,"date":"2017-12-01T14:40:04","date_gmt":"2017-12-01T05:40:04","guid":{"rendered":"http:\/\/www.codedojo.com\/?p=2091"},"modified":"2020-02-27T10:01:00","modified_gmt":"2020-02-27T01:01:00","slug":"stress-testing-unitys-llapi-what-are-the-limits","status":"publish","type":"post","link":"https:\/\/www.codedojo.com\/?p=2091","title":{"rendered":"Stress testing Unity&#8217;s LLAPI, what are the limits?"},"content":{"rendered":"<div id=\"attachment_2109\" style=\"width: 635px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/unity_nettest.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2109\" class=\"wp-image-2109 size-large\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/unity_nettest-1024x649.jpg\" alt=\"\" width=\"625\" height=\"396\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/unity_nettest-1024x649.jpg 1024w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/unity_nettest-300x190.jpg 300w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/unity_nettest-768x487.jpg 768w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/unity_nettest-624x395.jpg 624w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/unity_nettest.jpg 1206w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><p id=\"caption-attachment-2109\" class=\"wp-caption-text\">NetTest &#8211; a tool for stress testing the LLAPI, full Unity project download at the bottom!<\/p><\/div>\n<h1>Update 2\/27\/2020:\u00a0 <em>Don&#8217;t use LLAPI, Unity is going to stop working on it at the end of 2020 so you&#8217;ll be screwed I guess.\u00a0 <\/em><\/h1>\n<h1><em>Luckily their replacement netcode isn&#8217;t ready yet so now you don&#8217;t know what to do except maybe try third party libraries or use simple TCP sockets.\u00a0 Thanks, Unity<\/em><\/h1>\n<h1><\/h1>\n<h1>Seth, what the hell do you know about netcode, anyway?!<\/h1>\n<p>Woah, with the attitude already.\u00a0 Look, I&#8217;m all about multiplayer.\u00a0 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Legend_of_the_Red_Dragon\">Have<\/a> <a href=\"http:\/\/www.rtsoft.com\/pages\/funeral_quest.php\">been<\/a> for a <a href=\"http:\/\/www.rtsoft.com\/pages\/tanked.php\">long time<\/a>.\u00a0 I&#8217;ve gone from being excited to get <a href=\"https:\/\/youtu.be\/hTxHTwo6wVY?t=66\">two people walking on the same ANSI map in LORD2<\/a>\u00a0in the early 90s to hitting the 70,000 concurrent user mark during busy times in <a href=\"https:\/\/growtopiagame.com\">Growtopia<\/a>.<\/p>\n<p>In addition to writing my <a href=\"http:\/\/protonsdk.com\">own junk<\/a>, I regularly play with Unity and Unreal and am constantly trying to see how they can fit my developing style &#8211; mostly\u00a0I need them because it&#8217;s becoming a losing battle to try to maintain your own 3D engine if you also want to actually design and release games too.<\/p>\n<h1>What&#8217;s LLAPI, anyway?<\/h1>\n<p>LLAPI stands for Low Level Application Programming Interface.\u00a0 It&#8217;s what Unity&#8217;s HLAPI (High level) API is built on.\u00a0 I guess both of those can be called part of UNet. (Unity networking)<\/p>\n<h1>Why not just use the HLAPI like a normal person?<\/h1>\n<p>That might be ok for some projects, especially round-based networked games without too many players.<\/p>\n<p>When you are targeting MMO level network performance where a server may have to track stats of millions of players and simulate a world for weeks instead of minutes, the first rule is:<\/p>\n<h3><strong>Stay as low level as you reasonably can.\u00a0<\/strong><\/h3>\n<p>I don&#8217;t want someone else&#8217;s net code to even think about touching my gameobjects, I just want it to deliver reliable\/unreliable packets that I write\/read straight bytes to.\u00a0 That&#8217;s it.\u00a0 I want to handle things like prediction, dead reckoning, and variable serialization, myself!<\/p>\n<h1>What&#8217;s the deal with UDP, TCP, and WebSockets?<\/h1>\n<p>Both <strong>UDP<\/strong> and <strong>TCP<\/strong> are internet protocols built on top of IP.<\/p>\n<p><strong>TCP<\/strong>\u00a0is a bidirectional socket based connection that insures your data is correct and sent in the right order.<\/p>\n<p>It&#8217;s like calling Jeff, he picks up the phone and you can both talk until one of you puts the phone down.\u00a0 Oh, and after you say something, you make sure Jeff understood you correctly each time, so that eats up a bit of time.<\/p>\n<p><strong>UDP\u00a0<\/strong>is is a stateless connection where single packets get sent.\u00a0 You write your message on a rock and throw it at Jeff&#8217;s window.\u00a0 While it gets there fast, it&#8217;s possible you&#8217;ll miss and Jeff will never see it. If dozens of people are throwing rocks, he needs to examine each one carefully to figure out which pile to put it with so the text is attributed to the right thrower.\u00a0 He might read the second rock you threw before the first one.<\/p>\n<p><strong>WebSockets<\/strong>\u00a0are basically <strong>TCP<\/strong> with a special handshake that&#8217;s done over HTTP first.\u00a0 To continue this already questionable analogy, it&#8217;s as if you had to call Jeff&#8217;s mom for permission, and then she gave you his cell number to call.<\/p>\n<p>In theory WebSocket performance could be similar to TCP but in practice they are much slower and unreliable, I don&#8217;t really know why but hey, that&#8217;s what we get.\u00a0 I suspect this will improve later.<\/p>\n<p>For games, UDP is nice because you can send some of your packets fast with no verification that they were received, and others (more important packets, like dying) with verification which sort of makes those packets work like TCP.<\/p>\n<p>That said, most games probably would be ok with a straight TCP\u00a0 steam as well and having a connected state can make things easier, like easily applying SSL to everything and not worrying about unordered packets.<\/p>\n<h1>Why use WebSockets instead of UDP or TCP? Just use UDP or TCP for everything, moran<\/h1>\n<p>BECAUSE I CAN&#8217;T!\u00a0 Browsers won&#8217;t allow the Unity plugin to run anymore, they just allow straight javascript\/WebGL these days.\u00a0 It hurts.\u00a0 I mean, I wrote a cool\u00a0<a href=\"http:\/\/www.codedojo.com\/?p=1760\">multiplayer space taxi test<\/a> for Unity using TCP sockets and now nobody can even play it.<\/p>\n<h1>What does LLAPI use?<\/h1>\n<p>It can read from both sockets (UDP) and WebSockets at the same time and route them so your game can let them play together.\u00a0 But how fast is it, and does it work?<\/p>\n<p>This brings us to the second rule of netcode:<\/p>\n<h3>Use stress tests without game code to notice glaring problems early and more clearly<\/h3>\n<p>Which finally brings us to the point of this post.\u00a0 <strong>NetTest<\/strong> is a little utility I wrote that can:<\/p>\n<ul>\n<li>Run as a client, server, or both<\/li>\n<li>If you connect as &#8220;Normal client&#8221; you can all chat with eachother<\/li>\n<li>Run with a GUI or as headless (meaning no GUI, which is what you want for a server usually)<\/li>\n<li>Can open &#8220;Stress clients&#8221; for testing, a single instance can open 100+ clients sockets<\/li>\n<li>When stress mode is turned on, the stress clients will each send one random sentence per second.\u00a0 The server is set to re-broadcast it to ALL clients connected, so this generates a lot of traffic.\u00a0 (300 stress clients cause the server to generate 90K+ packets per second for example)<\/li>\n<li>Server can give interesting stats about packets, payload vs Unity junk % in the packets, bandwidth and server speed statistics<\/li>\n<li>Built in telnet server, any telnet client can log on and get statistics directly or issue commands<\/li>\n<li>Tested on Windows, linux, WebGL<\/li>\n<li>Supports serializing variables and creating custom packet types, although the stress test only uses strings<\/li>\n<li>Everything is setup to push performance.\u00a0 Things that might mess with the readings like Unity&#8217;s packet merging or modifying values based on dropped packets is disabled.\u00a0 All processing is done as fast as possible, no throttling or consideration to sleep cycles.<\/li>\n<li>Keep in mind a real game server is going to also being doing tons of other things, this is doing almost nothing CPU wise except processing packets.\u00a0 Testing things separately like this make it easier to see issues and know what the baseline is.<\/li>\n<\/ul>\n<h1>ABOUT TEST RESULTS<\/h1>\n<p>These tests are presented &#8216;as is&#8217;, do your own tests using my Unity project if you really want exact info and to check the settings.<\/p>\n<p>My windows machine is a i7-5960X, the remote linux box is similar and hosted on a different continent, I get a 200 ping to it.<\/p>\n<p>All packets in NetTest are being sent over the &#8216;reliable&#8217; channel.\u00a0 No tests involve p2p networking, only client&lt;&gt;server.<\/p>\n<p>Settings:<\/p>\n<pre>config.AcksType = ConnectionAcksType.Acks32; \/\/NOTE: Must match server or you'll get a CRC error on connection\nconfig.PingTimeout = 4000; \/\/NOTE: Must match server or you'll get a CRC error on connection\nconfig.DisconnectTimeout = 20000;\u00a0\/\/NOTE: Must match server or you'll get a CRC error on connection\nconfig.MaxSentMessageQueueSize = 30000; \nconfig.MaxCombinedReliableMessageCount = 1;\nconfig.MaxCombinedReliableMessageSize = 100; \/\/in bytes\nconfig.MinUpdateTimeout = 1;\nconfig.OverflowDropThreshold = 100;\nconfig.NetworkDropThreshold = 100;\nconfig.SendDelay = 0;<\/pre>\n<h1>TEST 1: 300 CLIENT IDLE (LOCALHOST, WINDOWS BOX)<\/h1>\n<p>Ok, here I&#8217;m curious how many bytes LLAPI is going to use with clients doing nothing.<\/p>\n<p>Server is set to localhost.\u00a0 I&#8217;ve got 4 NetTest&#8217;s running &#8211; the one on the bottom right has had &#8220;Start local host&#8221; clicked, and the three others each have added 100 stress clients.<\/p>\n<p><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_300_win.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2095 size-large\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_300_win-1024x696.jpg\" alt=\"\" width=\"625\" height=\"425\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_300_win-1024x696.jpg 1024w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_300_win-300x204.jpg 300w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_300_win-768x522.jpg 768w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_300_win-624x424.jpg 624w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_300_win.jpg 2024w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>Results:<\/p>\n<ul>\n<li>Around 30 bytes per stay alive packet per client.\u00a0 (23KB total over 7.74 seconds, sent 2.2 packets per client over 8 seconds, so roughly what I would expect for the 4000 ms ping timeout setting)\u00a0 Are stay alives sent over the reliable channel?\u00a0 Hmm.<\/li>\n<li>Adding and removing test clients is a blocking operation and gets progressibly slower as more are added &#8211; why does it get slower and cause my whole system to act a bit weird?<\/li>\n<li>While closing the instances looks normal, the instances are actually spending an additional 30 seconds or so to close sockets that were opened<\/li>\n<li>Side note: Having a client ping the host (at localhost) takes about 2 ms.\u00a0 (normally this would be bad, but given that it can&#8217;t check until the next frame, then once more to get the answer, this seems to match the framerate decent enough)<\/li>\n<\/ul>\n<p>I&#8217;m not going to worry about the socket slowness, this may be related to a windows 10 resource thing.\u00a0 I&#8217;ll launch with less clients in future tests to help though.\u00a0 The server itself has zero speed\/blocking issues with actually connecting\/disconnecting though, so that&#8217;s good.<\/p>\n<h1>TEST 2: 200 CLIENT STRESS (LOCALHOST SERVER, WINDOWS BOX)<\/h1>\n<p>Ok, now we&#8217;re getting serious.\u00a0 I have 5 instances &#8211; 4 have 50 stress clients, 1 is the server.\u00a0 (I could have run the server on one of the stress client instances, but meh)<\/p>\n<p><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2097 size-large\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress-1024x647.jpg\" alt=\"\" width=\"625\" height=\"395\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress-1024x647.jpg 1024w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress-300x190.jpg 300w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress-768x486.jpg 768w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress-624x395.jpg 624w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>First I enabled 50 clients in &#8220;stress mode&#8221; &#8211; this should generate 10,000 packets (50*200) per second.\u00a0 The server gets 50 lines of text from clients, then broadcasts each one to each of the 200 clients.\u00a0 Huh, stats show it only sending around 6,000 packets per second, not 10,000.\u00a0 However, we can see all the lines of text are being delivered.<\/p>\n<p><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress200_win.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2098 size-large\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress200_win-1024x647.jpg\" alt=\"\" width=\"625\" height=\"395\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress200_win-1024x647.jpg 1024w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress200_win-300x190.jpg 300w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress200_win-768x485.jpg 768w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/11\/localhost_200_stress200_win-624x394.jpg 624w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>That seemed fine so I upped it to all 200 clients doing the stress test &#8211; this should cause the server to send 40,000 packets a second (and receive 200 from the clients).<\/p>\n<p>The stats show only 24,549 packets and 5.3 MB per second being sent. About 15% is unity packet overhead, seems like a lot but ok.\u00a0 Server FPS is good, slowest frame was 0.02 (20 ms) so not bad.<\/p>\n<p>Is unity combining packets even though I set\u00a0config.MaxCombinedReliableMessageCount = 1; ?\u00a0 Oops, I bet that needs to be 0 to do no combining.<\/p>\n<p>I also notice 4,346 per second packets being received by the server.\u00a0 200 for my messages, and I assume the rest are part of the &#8220;reliable guarantee&#8221; protocol they are doing for UDP where the clients need to confirm they received things ok.\u00a0 Oh, and UNet&#8217;s keep alives too.<\/p>\n<p>In the screenshot you can see an error appearing of &#8220;An abnormal situation has occurred: the PlayerLoop internal function has been called recursively&#8230; contact customer support&#8221;.\u00a0 Uhh&#8230; I don&#8217;t know what that&#8217;s about.\u00a0 Did I screw up something with threads?\u00a0 It didn&#8217;t happen on the server, but one of the four client instances.<\/p>\n<p>I let it run at this rate for a while &#8211; a few clients were dropped by the server for no reason I could see.\u00a0 \u00a0Not entirely stable at these numbers I guess, but possible it would be if I ran it on multiple computers, it&#8217;s a lot of data and ports.<\/p>\n<h1>TEST 2: 100 CLIENTS STRESS (REMOTE SERVER, HEADLESS LINUX)<\/h1>\n<p>As nice as it is to be able to turn on both the server (localhost) and the client directly from the same app in the Unity editor to test stuff, eventually you&#8217;ll probably want to get serious and host the server on linux in a data center somewhere.\u00a0 This test let&#8217;s us do that.<\/p>\n<p>I&#8217;ve changed the destination address to the remote IP. (You can click the GameLogic object to edit them, I was too lazy to make a real GUI way))<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2100\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_properties.jpg\" alt=\"\" width=\"313\" height=\"372\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_properties.jpg 313w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_properties-252x300.jpg 252w\" sizes=\"auto, (max-width: 313px) 100vw, 313px\" \/><\/p>\n<p>I have a .bat file that builds the Unity project (on Windows) and copies it to the remote server, then triggers a restart.\u00a0 It&#8217;s run on Linux like this:<\/p>\n<pre>cd ~\/NetTest\nchmod +x .\/linux64headless\n.\/linux64headless -batchmode -nographics -logFile log.txt<\/pre>\n<p>Here is a screenshot of the 100 clients (using one instance of NetTest) connecting to the linux server (which is also NetTest) (And no, that&#8217;s not the real port\/ip, stop trying to hack me, Mitnick)<\/p>\n<p><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_100_100_linux.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2102 size-large\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_100_100_linux-1024x604.jpg\" alt=\"\" width=\"625\" height=\"369\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_100_100_linux-1024x604.jpg 1024w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_100_100_linux-300x177.jpg 300w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_100_100_linux-768x453.jpg 768w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_100_100_linux-624x368.jpg 624w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_100_100_linux.jpg 2040w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>So let&#8217;s try to digest this data.<\/p>\n<ul>\n<li>NetTest Client: The 100 clients are self reporting receiving about 1,150,000 (1.15 MB) bytes of actual payload data per second. (10000 lines of text).\u00a0 Zero packets in the send queue<\/li>\n<li>Windows system: Windows says 12.1 Mbps per second, so 1.5 MB, close enough, who knows what else I&#8217;m streaming\/downloading<\/li>\n<li>Linux system: iotop shows server sending 10.Mb (1.25 MB per second) so that seems right<\/li>\n<li>Linux NetTest: (using telnet) it&#8217;s reporting it&#8217;s sending 1.22 MB per second (only 3,458 packets per second, yeah, definitely some packet merging happening)\u00a0 The total stats went negative, I ran this a while, uh&#8230; I guess I need to be using larger numbers, probably rolled over.<\/li>\n<li>Linux: Server is running at 1100 FPS, so zero problems with speed.\u00a0 You&#8217;re probably thinking &#8220;Hey, it&#8217;s headless, what do you mean frames per second? What frames?&#8221;, ok, fine, it&#8217;s really measuring &#8220;update()&#8217;s per second&#8221;, but you know what I mean.\u00a0 Slowest frame out of the 90 second sample time was 0.0137 (13 ms)<\/li>\n<li>I don&#8217;t have it in the screenshot, but top shows the server is not too power hungry, its process seems to use 3% (no load) to 15% (spamming tons of packets).\u00a0 Keep in mind we aren&#8217;t actually DOING anything game related yet, but for just the networking, that isn&#8217;t bad<\/li>\n<\/ul>\n<p>I tried 200X200 (4x the total bandwidth &amp; packets, so 5 MB a second) but the outgoing packet queue started to fill up and I started dropping connections.<\/p>\n<h1>TEST 3: WebGL (REMOTE SERVER, HEADLESS LINUX)<\/h1>\n<p>I&#8217;m not going to bother making pics and somehow this post already got way out of control, but here is what seemed to be the case when I played with this earlier:<\/p>\n<ul>\n<li>No WebSocket stats are included in the stuff UNet reports &#8211; &#8220;the function called has not been supported for web sockets communication&#8221; when using things like\u00a0NetworkTransport.GetOutgoingFullBytesCountForHost on it<\/li>\n<li>WebGL\/WebSockets be slow.\u00a0 Real slow. If pushed the bandwidth to over 18KB per second (per Chrome tab), packets started to get backed up.\u00a0 I don&#8217;t know if things are getting throttled by the browser or what.\u00a0 The server eventually freaks out when the send queue gets too big and starts throwing resource errors.<\/li>\n<li>When creating stress test clients, a single WebGL tab seems limited to 14 WebSockets max (Chrome at least)<\/li>\n<li>I suspect there could be issues with a naughty WebSocket filling up the queue and not sending acknowledges of receives, your game probably needs to carefully monitor packets sent\/received to disconnect people quick if they abuse the connection<\/li>\n<li>WebSocket queue\/etc issues don&#8217;t affect or slow down normal connections, so that&#8217;s something<\/li>\n<li>Mixing WebSocket and normal Sockets (UDP) clients work fine, that&#8217;s a very handy thing to be able to do<\/li>\n<\/ul>\n<h1>Final thoughts<\/h1>\n<p>All in all, I think directly using LLAPI in Unity 2017.1+ is promising.\u00a0 Previously, I assumed I&#8217;d need to write my own C++ server to get decent socket performance (that&#8217;s how I did the Unity multiplayer space taxi demo) but now I don&#8217;t think so, if you&#8217;re careful about C#&#8217;s memory stuff.<\/p>\n<p>Issues\/comments:<\/p>\n<ul>\n<li>How is it ok that Unity&#8217;s text widget\/scroller can only show like 100 lines of text? (65,535 vert buffer errors if you have too much text, even though most of it is off screen)\u00a0 Maybe I&#8217;m doing something wrong<\/li>\n<li>Unity&#8217;s linux builds don&#8217;t seem to cleanly shutdown if you do a pkill\/sigterm. OnApplicationQuit() does not get run, this is very bad for linux servers that could restart processes for reboots or upgrades. (if it&#8217;s a dedicated server you can work around it, but still!)<\/li>\n<li>WebGL builds can&#8217;t do\u00a0GetHostAddresses() so I had to type the real IP in for it to connect (I should try switching to the experimental 4.6 net libs)<\/li>\n<li>To my great surprise, my telnet host contined to run and send answers even after stopping the game in the editor.\u00a0 How could that game object still exist?! Threads and references are confusing, I fixed it by properly closing the telnet host threads on exit.<\/li>\n<li>The Unity linux headless build worked perfectly on my CentOS 7.4 dedicated server, didn&#8217;t have to change a single thing<\/li>\n<li>It&#8217;s weird that you&#8217;ll get CRC errors if\u00a0PingTimeout\/AcksType\/DisconnectTimeout don&#8217;t perfectly match on the client and server. I wonder why there is not option to just let the server set it on the client during the initial handshake as you want to be able to tweak those things easily server-side.\u00a0 I guess the client could grab that data via HTTP or something before the real connect, but meh.<\/li>\n<\/ul>\n<h1>NetTest download<\/h1>\n<h2><a href=\"\/files\/NetTest_Unity_Source.zip\">Download the NetTest Unity project with full source here<\/a><\/h2>\n<p><a href=\"http:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_batchfile.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2108\" src=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_batchfile.jpg\" alt=\"\" width=\"466\" height=\"435\" srcset=\"https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_batchfile.jpg 466w, https:\/\/www.codedojo.com\/wp-content\/uploads\/2017\/12\/nettest_batchfile-300x280.jpg 300w\" sizes=\"auto, (max-width: 466px) 100vw, 466px\" \/><\/a><\/p>\n<p>Note:\u00a0 I left in my .bat files (don&#8217;t mock the lowly batch file!), thought they may be useful to somebody.\u00a0 They allow you to build everything for linux\/win\/webl, copy to the remote servers and restart the remote server with a single click.\u00a0 Nothing will work without tweaking (they assume you have ssh, rsync etc working from a dos prompt) but you could probably figure it out.<\/p>\n<p>Source is released under the &#8220;do whatever, but be cool and give me an attribution if you use it in something big&#8221; license.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update 2\/27\/2020:\u00a0 Don&#8217;t use LLAPI, Unity is going to stop working on it at the end of 2020 so you&#8217;ll be screwed I guess.\u00a0 Luckily their replacement netcode isn&#8217;t ready yet so now you don&#8217;t know what to do except maybe try third party libraries or use simple TCP sockets.\u00a0 Thanks, Unity Seth, what the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,6,21],"tags":[],"class_list":["post-2091","post","type-post","status-publish","format-standard","hentry","category-development","category-tech-tips","category-unity"],"_links":{"self":[{"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/posts\/2091","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2091"}],"version-history":[{"count":31,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/posts\/2091\/revisions"}],"predecessor-version":[{"id":2579,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=\/wp\/v2\/posts\/2091\/revisions\/2579"}],"wp:attachment":[{"href":"https:\/\/www.codedojo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2091"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2091"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codedojo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2091"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}