{"id":414356,"date":"2024-06-29T23:42:34","date_gmt":"2024-06-29T23:42:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=414356"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T23:42:34","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=414356","title":{"rendered":"<span>\u041c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u0435\u0440\u043d\u0430\u044f \u0438\u0433\u0440\u0430 \u043d\u0430 Rust + gRPC \u0441\u043e \u0441\u043f\u0435\u043a\u0442\u0430\u0442\u043e\u0440 \u043c\u043e\u0434\u043e\u043c. \u0427\u0430\u0441\u0442\u044c 2<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041a\u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 <a href=\"https:\/\/habr.com\/ru\/post\/585958\/\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043b\u0435\u0436\u0438\u0442 <a href=\"https:\/\/github.com\/loothood\/ping_pong_multiplayer\/tree\/v1.0\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u043a \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041e\u043d\u0438 \u0443\u0447\u0442\u0435\u043d\u044b \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u043a\u043e\u0441\u0442\u044b\u043b\u044f\u043c\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d <a href=\"https:\/\/github.com\/loothood\/ping_pong_multiplayer\/tree\/v1.1\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u0443\u0447\u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0443\u0447\u0438\u043c \u0438\u0433\u0440\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0442\u0435\u043c\u0443 \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. \u0412 \u0444\u0430\u0439\u043b <code>game.proto<\/code> \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:<\/p>\n<pre><code class=\"yaml\">   rpc WorldUpdateRequest (ClientActions) returns (WorldStatus);  message ClientActions {   uint32 playerNumber = 1;   uint32 clickedButton = 2; }  message WorldStatus {   FloatTuple player1Position = 1;   FloatTuple player2Position = 2;   Ball ball = 3;   uint32 playersCount = 4;   uint32 winner = 5; }<\/code><\/pre>\n<p><code>WorldUpdateRequest<\/code> &#8212; \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u0442 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u044b. \u041e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430 &#8212; <code>clickedButton<\/code> &#8212; \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 0 \u0438\u043b\u0438 1. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0430\u0436\u0430\u043b \u0438\u0433\u0440\u043e\u043a &#8212; \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u043a\u0435\u0442\u043a\u0438 \u0432\u0432\u0435\u0440\u0445 \u0438\u043b\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u043a\u0435\u0442\u043a\u0438 \u0432\u043d\u0438\u0437. \u0412\u043e\u043e\u0431\u0449\u0435, \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u0432 \u0442\u0438\u043f\u0435 <code>bool<\/code> . \u041d\u043e \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u043e\u0433\u0438\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u0430\u0443\u0437\u0443 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u0438 \u0435\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0434\u0440\u0443\u0433\u043e\u0433\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0435\u0431\u044f \u043a\u0435\u043c-\u0442\u043e \u0438\u0437 \u0441\u043f\u0435\u043a\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u0442.\u0434. \u041f\u043e\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u0447\u0438\u0441\u043b\u043e. \u0422\u0430\u043a \u0436\u0435, \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c <code>playerNumber<\/code> &#8212; \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u0432\u043e\u0439 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0438\u0433\u0440\u0430\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u042d\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u043d\u0438\u043c\u0430\u043b \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0436\u0430\u043b \u043a\u043d\u043e\u043f\u043a\u0443. \u0421\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0432\u044b\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u044f\u0447\u0430, \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u043a\u0435\u0442\u043e\u043a \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 <code>WorldStatus<\/code>. \u0412 <code>WorldStatus<\/code> \u0432\u0441\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u043e \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>winner<\/code>. \u0412\u0435\u0440\u043d\u0435\u0435 \u0435\u0435 \u0442\u0438\u043f. \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0438\u0433\u0440\u043e\u043a\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u0438\u043f <code>bool<\/code>, \u043d\u043e \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0437\u0430\u043c\u0435\u043d\u0443 \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u043d\u0430 \u0441\u043f\u0435\u043a\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0438\u043b\u0438 \u0435\u0449\u0435 \u043a\u0430\u043a\u0443\u044e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0438 \u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0443\u044e \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043b\u043e\u0433\u0438\u043a\u0443, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0442\u044c. \u041f\u043e\u0442\u043e\u043c\u0443 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d \u0442\u0438\u043f \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0446\u0435\u043b\u043e\u0435. <\/p>\n<p><strong><em>\u041f\u0440\u043e\u0448\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u0442 \u0438\u0433\u0440\u044b &#8212; \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u0430\u044f \u0438\u0434\u0435\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438\u0433\u0440. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u0434\u0432\u0438\u0436\u043a\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u044f \u0437\u043d\u0430\u043a\u043e\u043c, \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u0442\u0430\u043a\u0442 \u0438\u0433\u0440\u044b &#8212; \u044d\u0442\u043e 1\/60 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u0422\u043e \u0435\u0441\u0442\u044c, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <\/em><\/strong><code>update<\/code><strong><em> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f 60 \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 60 \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 &#8212; \u044d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0441\u0442\u0440\u0438\u043c\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f gRPC. \u042d\u0442\u043e \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u0441 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u0435\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0448\u0443\u0442\u0435\u0440 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0433\u0440\u0430\u044e\u0449\u0438\u0445 \u0438\u0433\u0440\u043e\u043a\u043e\u0432, \u0442\u043e gRPC \u043d\u0435 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u044b\u0431\u043e\u0440.<\/em> <\/strong><\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043d\u0430\u0434\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0440\u044e\u043a. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u043d\u0430\u0435\u0442, \u043e\u043d \u043d\u0430\u043f\u0438\u0448\u0435\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0418\u0442\u0430\u043a, \u043c\u044b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 <code>cleint.rs<\/code> \u0438 <code>server.rs<\/code> \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0441\u0430\u043c\u044b\u0439 \u0432\u0435\u0440\u0445 \u044d\u0442\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code class=\"rust\"> fn main() {}<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0448\u0435\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 <\/p>\n<pre><code> cargo build <\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u0444\u0430\u0439\u043b\u0435 <code>game.rs<\/code>. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c <code>cleint.rs<\/code> \u0438 <code>server.rs<\/code> \u0432 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h3>C\u0435\u0440\u0432\u0435\u0440<\/h3>\n<p>\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434<\/p>\n<pre><code class=\"rust\"> async fn world_update_request(         &amp;self,         request: tonic::Request&lt;ClientActions>,     ) -> Result&lt;tonic::Response&lt;WorldStatus>, tonic::Status><\/code><\/pre>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u043d\u0430\u0434\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0438\u0437\u0438\u043a\u0443 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u044b. \u0422\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u044b \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u0438\u0440. \u0414\u0430\u043b\u0435\u0435, \u043c\u044b \u0435\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c:<\/p>\n<pre><code class=\"rust\"> let mut world = Arc::clone(&amp;self.world).lock().unwrap().as_ref().unwrap().clone();         if players_count >= 2 {             PlayGame::update_world(&amp;mut world, clicked_button, player_number,);         }         self.apply_new_world(&amp;world);<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0438\u0440\u0430. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0438\u0437\u0438\u043a\u0438 \u0438\u0433\u0440\u044b, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>Entity<\/code> :<\/p>\n<pre><code class=\"rust\">      fn width(&amp;self) -> f32 {         self.texture_size.x     }      fn height(&amp;self) -> f32 {         self.texture_size.y     }      fn centre(&amp;self) -> Vec2&lt;f32> {         Vec2::new(             self.position.x + (self.width() \/ 2.0),             self.position.y + (self.height() \/ 2.0),         )     }      fn bounds(&amp;self) -> Rectangle {         Rectangle::new(             self.position.x,             self.position.y,             self.width(),             self.height(),         )     }<\/code><\/pre>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>Rectangle<\/code> \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 <code>tetra::graphics::Rectangle<\/code> .<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043c\u0435\u0442\u043e\u0434\u0443 <code>bounds<\/code> \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0442\u043e \u043c\u044f\u0447\u0438\u043a \u0443\u0434\u0430\u0440\u0438\u043b\u0441\u044f \u043e\u0431 \u0440\u0430\u043a\u0435\u0442\u043a\u0443:<\/p>\n<pre><code class=\"rust\">        let player1_bounds = world.player1.bounds();         let player2_bounds = world.player2.bounds();         let ball_bounds = world.ball.bounds();          let paddle_hit = if ball_bounds.intersects(&amp;player1_bounds) {             Some(&amp;world.player1)         } else if ball_bounds.intersects(&amp;player2_bounds) {             Some(&amp;world.player2)         } else {             None         };<\/code><\/pre>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043c\u0435\u0441\u0442\u0430 \u0443\u0434\u0430\u0440\u0430 \u043e\u0431 \u0440\u0430\u043a\u0435\u0442\u043a\u0443, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043c\u044f\u0447\u0438\u043a\u0430:<\/p>\n<pre><code class=\"rust\"> if let Some(paddle) = paddle_hit {             world.ball.velocity.x =                 -(world.ball.velocity.x + (BALL_ACC * world.ball.velocity.x.signum()));              let offset = (paddle.centre().y - world.ball.centre().y) \/ paddle.height();              world.ball.velocity.y += PADDLE_SPIN * -offset;         }          if world.ball.position.y &lt;= 0.0             || world.ball.position.y + world.ball.height() >= world.world_size.y         {             world.ball.velocity.y = -world.ball.velocity.y;         }<\/code><\/pre>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435, \u0432\u0441\u044f \u0444\u0438\u0437\u0438\u043a\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 <a href=\"https:\/\/tetra.seventeencups.net\/tutorial\" rel=\"noopener noreferrer nofollow\">\u0433\u0430\u0439\u0434\u0435<\/a> \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430 tetra. \u0422\u0430\u043c \u0436\u0435 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043e \u0431\u0430\u0433\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043b\u043e\u0436\u0435\u043d \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435: \u0435\u0441\u043b\u0438 \u0448\u0430\u0433 \u043c\u044f\u0447\u0438\u043a\u0430 \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0448\u0438\u0440\u0438\u043d\u0430 \u0440\u0430\u043a\u0435\u0442\u043a\u0438, \u0442\u043e \u043c\u044f\u0447\u0438\u043a \u043f\u0440\u043e\u043b\u0435\u0442\u0438\u0442 \u0441\u043a\u0432\u043e\u0437\u044c \u0440\u0430\u043a\u0435\u0442\u043a\u0443.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<p>\u0411\u0438\u043b\u0434\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043d\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"bash\">% cargo run --bin server     Finished dev [unoptimized + debuginfo] target(s) in 0.14s      Running `target\/debug\/server` Server listening on [::1]:50051 <\/code><\/pre>\n<h3>\u041a\u043b\u0438\u0435\u043d\u0442<\/h3>\n<p>\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u0435\u0449\u0438: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u043e\u0439 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<pre><code class=\"rust\"> fn update(&amp;mut self, ctx: &amp;mut Context) -> tetra::Result {         Ok(())  }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f <code>GameState<\/code>:<\/p>\n<pre><code class=\"rust\">#[tokio::main]     async fn world_update_request(&amp;self, clicked_button_number: u32, player_number: u32) -> WorldStatus {         let request = tonic::Request::new(ClientActions {             player_number,             clicked_button: clicked_button_number,         });         let mut client = self.client.clone();         client.world_update_request(request)             .await.expect(\"Cannot get World Update from the server\").into_inner()     } <\/code><\/pre>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c 60 \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443:<\/p>\n<pre><code class=\"rust\">fn update(&amp;mut self, ctx: &amp;mut Context) -> tetra::Result {         let mut clicked_button = 2;         if input::is_key_down(ctx, Key::Up) {             clicked_button = 0;         }                  if input::is_key_down(ctx, Key::Down) {             clicked_button = 1;         }          let world_update_request =             self.world_update_request(clicked_button, self.player_number);         self.set_updated_values(world_update_request);          Ok(())     }<\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u0442 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043c, \u043d\u0430\u0436\u0430\u043b \u043b\u0438 \u0438\u0433\u0440\u043e\u043a \u043a\u043b\u0430\u0432\u0438\u0448\u0443 &#171;\u0441\u0442\u0440\u0435\u043b\u043a\u0430 \u0432\u0432\u0435\u0440\u0445&#187; \u0438\u043b\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0443 &#171;\u0441\u0442\u0440\u0435\u043b\u043a\u0430 \u0432\u043d\u0438\u0437&#187;. \u0415\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b. \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>set_updated_values<\/code> \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0430\u0440\u0441\u0438\u043c \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0433\u0440\u044b.<\/p>\n<p>\u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0439 \u0432 \u0438\u0433\u0440\u0435, \u043c\u0435\u0442\u043e\u0434 <code>draw<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"rust\"> fn draw(&amp;mut self, ctx: &amp;mut Context) -> tetra::Result {         graphics::clear(ctx, Color::rgb(0.392, 0.584, 0.929));         \/\/ 0 - Player 1 won         \/\/ 1 - Player 2 won         if self.winner == 2 {             self.player1.texture.draw(ctx, self.player1.position);             self.ball.texture.draw(ctx, self.ball.position);             self.player2.texture.draw(ctx, self.player2.position);         } else {             let text_offset: Vec2&lt;f32> = Vec2::new(16.0, 16.0);             let mut message = format!(\"Winner is: Player \");             if self.winner == 0 {                 message += \"1\";             } else {                 message += \"2\";             }             let mut t: Text = Text::new(message,                                         Font::vector(ctx, \".\/resources\/DejaVuSansMono.ttf\",                                                      16.0)?,             );             t.draw(ctx, text_offset);         }         Ok(())     }<\/code><\/pre>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442 \u0433\u043e\u0442\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c. <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<pre><code class=\"bash\"> cargo run --bin server<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442:<\/p>\n<pre><code class=\"bash\">cargo run --bin client <\/code><\/pre>\n<p>\u0418 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u0414\u0430\u0436\u0435 \u043d\u0435\u0442 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u043d\u0430\u0436\u0430\u0442\u044b\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438. \u042d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u0436\u0434\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u043c\u044f\u0447\u0438\u043a \u043d\u0430\u0447\u0430\u043b \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0438 \u0438\u0433\u0440\u0430\u0435\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/344\/c1c\/f43\/344c1cf43c4e0d696d6068051a33ca7d.gif\" width=\"656\" height=\"408\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/344\/c1c\/f43\/344c1cf43c4e0d696d6068051a33ca7d.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043f\u0435\u043a\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c &#171;\u043d\u0430 \u0441\u0434\u0430\u0447\u0443&#187;. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0434\u0445\u043e\u0434\u0443, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0440\u0435\u0442\u0438\u0439, \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439, \u043f\u044f\u0442\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430 \u0431\u0430\u0442\u0430\u043b\u0438\u0435\u0439 \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u0431\u0435\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u043c \u043f\u043e\u043c\u0435\u0448\u0430\u0442\u044c.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0433\u0430\u0439\u0434 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u043a\u0443\u0447\u0443 \u0432\u0441\u0435\u0433\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u0438\u0433\u0440\u044b \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0431\u0435\u0434\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0438\u0433\u0440\u043e\u043a\u043e\u0432, \u0440\u0435\u0430\u043a\u0446\u0438\u044e \u043d\u0430 \u0434\u0438\u0441\u043a\u043e\u043d\u043d\u0435\u043a\u0442 \u0438\u0433\u0440\u043e\u043a\u0430, \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0433\u0440\u0430\u0442\u044c \u0435\u0441\u043b\u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430 \u043d\u0435\u0442. \u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0430 \u0433\u0438\u0444\u043a\u0435 \u0432\u044b\u0448\u0435 \u0441\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0434\u0432\u0430 \u0431\u043e\u0442\u0430. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u043a\u0443\u0447\u0443 \u0432\u0441\u0435\u0433\u043e, \u043d\u043e \u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0440 \u0434\u043b\u044f \u0442\u0432\u043e\u0440\u0447\u0435\u0441\u0442\u0432\u0430. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/586418\/\"> https:\/\/habr.com\/ru\/articles\/586418\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041a\u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u043e\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 <a href=\"https:\/\/habr.com\/ru\/post\/585958\/\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043b\u0435\u0436\u0438\u0442 <a href=\"https:\/\/github.com\/loothood\/ping_pong_multiplayer\/tree\/v1.0\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u043a \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041e\u043d\u0438 \u0443\u0447\u0442\u0435\u043d\u044b \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u043a\u043e\u0441\u0442\u044b\u043b\u044f\u043c\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d <a href=\"https:\/\/github.com\/loothood\/ping_pong_multiplayer\/tree\/v1.1\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u0443\u0447\u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0443\u0447\u0438\u043c \u0438\u0433\u0440\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0442\u0435\u043c\u0443 \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. \u0412 \u0444\u0430\u0439\u043b <code>game.proto<\/code> \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:<\/p>\n<pre><code class=\"yaml\">   rpc WorldUpdateRequest (ClientActions) returns (WorldStatus);  message ClientActions {   uint32 playerNumber = 1;   uint32 clickedButton = 2; }  message WorldStatus {   FloatTuple player1Position = 1;   FloatTuple player2Position = 2;   Ball ball = 3;   uint32 playersCount = 4;   uint32 winner = 5; }<\/code><\/pre>\n<p><code>WorldUpdateRequest<\/code> &#8212; \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u0442 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u044b. \u041e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0434\u0432\u0430 \u0447\u0438\u0441\u043b\u0430 &#8212; <code>clickedButton<\/code> &#8212; \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 0 \u0438\u043b\u0438 1. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0430\u0436\u0430\u043b \u0438\u0433\u0440\u043e\u043a &#8212; \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u043a\u0435\u0442\u043a\u0438 \u0432\u0432\u0435\u0440\u0445 \u0438\u043b\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u043a\u0435\u0442\u043a\u0438 \u0432\u043d\u0438\u0437. \u0412\u043e\u043e\u0431\u0449\u0435, \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u0432 \u0442\u0438\u043f\u0435 <code>bool<\/code> . \u041d\u043e \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043b\u043e\u0433\u0438\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u0430\u0443\u0437\u0443 \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u0438 \u0435\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0434\u0440\u0443\u0433\u043e\u0433\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0435\u0431\u044f \u043a\u0435\u043c-\u0442\u043e \u0438\u0437 \u0441\u043f\u0435\u043a\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u0442.\u0434. \u041f\u043e\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0441\u043e\u0437\u043d\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u0447\u0438\u0441\u043b\u043e. \u0422\u0430\u043a \u0436\u0435, \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c <code>playerNumber<\/code> &#8212; \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u0432\u043e\u0439 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0438\u0433\u0440\u0430\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u042d\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u043d\u0438\u043c\u0430\u043b \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u0436\u0430\u043b \u043a\u043d\u043e\u043f\u043a\u0443. \u0421\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0432\u044b\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u044f\u0447\u0430, \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u043a\u0435\u0442\u043e\u043a \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 <code>WorldStatus<\/code>. \u0412 <code>WorldStatus<\/code> \u0432\u0441\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u043e \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>winner<\/code>. \u0412\u0435\u0440\u043d\u0435\u0435 \u0435\u0435 \u0442\u0438\u043f. \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0438\u0433\u0440\u043e\u043a\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u0438\u043f <code>bool<\/code>, \u043d\u043e \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0437\u0430\u043c\u0435\u043d\u0443 \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u043d\u0430 \u0441\u043f\u0435\u043a\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u0438\u043b\u0438 \u0435\u0449\u0435 \u043a\u0430\u043a\u0443\u044e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0438 \u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0443\u044e \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043b\u043e\u0433\u0438\u043a\u0443, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0442\u044c. \u041f\u043e\u0442\u043e\u043c\u0443 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d \u0442\u0438\u043f \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0446\u0435\u043b\u043e\u0435. <\/p>\n<p><strong><em>\u041f\u0440\u043e\u0448\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u0442 \u0438\u0433\u0440\u044b &#8212; \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u0430\u044f \u0438\u0434\u0435\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438\u0433\u0440. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u0434\u0432\u0438\u0436\u043a\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u044f \u0437\u043d\u0430\u043a\u043e\u043c, \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u0442\u0430\u043a\u0442 \u0438\u0433\u0440\u044b &#8212; \u044d\u0442\u043e 1\/60 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u0422\u043e \u0435\u0441\u0442\u044c, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <\/em><\/strong><code>update<\/code><strong><em> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f 60 \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 60 \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 &#8212; \u044d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0441\u0442\u0440\u0438\u043c\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f gRPC. \u042d\u0442\u043e \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u0441 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u0435\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0443\u044e \u0438\u0433\u0440\u0443. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0448\u0443\u0442\u0435\u0440 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0433\u0440\u0430\u044e\u0449\u0438\u0445 \u0438\u0433\u0440\u043e\u043a\u043e\u0432, \u0442\u043e gRPC \u043d\u0435 \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u044b\u0431\u043e\u0440.<\/em> <\/strong><\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043d\u0430\u0434\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0440\u044e\u043a. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u043d\u0430\u0435\u0442, \u043e\u043d \u043d\u0430\u043f\u0438\u0448\u0435\u0442 \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0418\u0442\u0430\u043a, \u043c\u044b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 <code>cleint.rs<\/code> \u0438 <code>server.rs<\/code> \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0441\u0430\u043c\u044b\u0439 \u0432\u0435\u0440\u0445 \u044d\u0442\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code class=\"rust\"> fn main() {}<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0448\u0435\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 <\/p>\n<pre><code> cargo build <\/code><\/pre>\n<p>\u041d\u043e\u0432\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u0444\u0430\u0439\u043b\u0435 <code>game.rs<\/code>. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c <code>cleint.rs<\/code> \u0438 <code>server.rs<\/code> \u0432 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435. <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h3>C\u0435\u0440\u0432\u0435\u0440<\/h3>\n<p>\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434<\/p>\n<pre><code class=\"rust\"> async fn world_update_request(         &amp;self,         request: tonic::Request&lt;ClientActions>,     ) -> Result&lt;tonic::Response&lt;WorldStatus>, tonic::Status><\/code><\/pre>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u043d\u0430\u0434\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0438\u0437\u0438\u043a\u0443 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u044b. \u0422\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u044b \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u0438\u0440. \u0414\u0430\u043b\u0435\u0435, \u043c\u044b \u0435\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c:<\/p>\n<pre><code class=\"rust\"> let mut world = Arc::clone(&amp;self.world).lock().unwrap().as_ref().unwrap().clone();         if players_count >= 2 {             PlayGame::update_world(&amp;mut world, clicked_button, player_number,);         }         self.apply_new_world(&amp;world);<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0438\u0440\u0430. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0438\u0437\u0438\u043a\u0438 \u0438\u0433\u0440\u044b, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>Entity<\/code> :<\/p>\n<pre><code class=\"rust\">      fn width(&amp;self) -> f32 {         self.texture_size.x     }      fn height(&amp;self) -> f32 {         self.texture_size.y     }      fn centre(&amp;self) -> Vec2&lt;f32> {         Vec2::new(             self.position.x + (self.width() \/ 2.0),             self.position.y + (self.height() \/ 2.0),         )     }      fn bounds(&amp;self) -> Rectangle {         Rectangle::new(             self.position.x,             self.position.y,             self.width(),             self.height(),         )     }<\/code><\/pre>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>Rectangle<\/code> \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 <code>tetra::graphics::Rectangle<\/code> .<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043c\u0435\u0442\u043e\u0434\u0443 <code>bounds<\/code> \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0442\u043e \u043c\u044f\u0447\u0438\u043a \u0443\u0434\u0430\u0440\u0438\u043b\u0441\u044f \u043e\u0431 \u0440\u0430\u043a\u0435\u0442\u043a\u0443:<\/p>\n<pre><code class=\"rust\">        let player1_bounds = world.player1.bounds();         let player2_bounds = world.player2.bounds();         let ball_bounds = world.ball.bounds();          let paddle_hit = if ball_bounds.intersects(&amp;player1_bounds) {             Some(&amp;world.player1)         } else if ball_bounds.intersects(&amp;player2_bounds) {             Some(&amp;world.player2)         } else {             None         };<\/code><\/pre>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043c\u0435\u0441\u0442\u0430 \u0443\u0434\u0430\u0440\u0430 \u043e\u0431 \u0440\u0430\u043a\u0435\u0442\u043a\u0443, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043c\u044f\u0447\u0438\u043a\u0430:<\/p>\n<pre><code class=\"rust\"> if let Some(paddle) = paddle_hit {             world.ball.velocity.x =                 -(world.ball.velocity.x + (BALL_ACC * world.ball.velocity.x.signum()));              let offset = (paddle.centre().y - world.ball.centre().y) \/ paddle.height();              world.ball.velocity.y += PADDLE_SPIN * -offset;         }          if world.ball.position.y &lt;= 0.0             || world.ball.position.y + world.ball.height() >= world.world_size.y         {             world.ball.velocity.y = -world.ball.velocity.y;         }<\/code><\/pre>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435, \u0432\u0441\u044f \u0444\u0438\u0437\u0438\u043a\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 <a href=\"https:\/\/tetra.seventeencups.net\/tutorial\" rel=\"noopener noreferrer nofollow\">\u0433\u0430\u0439\u0434\u0435<\/a> \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430 tetra. \u0422\u0430\u043c \u0436\u0435 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043e \u0431\u0430\u0433\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043b\u043e\u0436\u0435\u043d \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435: \u0435\u0441\u043b\u0438 \u0448\u0430\u0433 \u043c\u044f\u0447\u0438\u043a\u0430 \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0448\u0438\u0440\u0438\u043d\u0430 \u0440\u0430\u043a\u0435\u0442\u043a\u0438, \u0442\u043e \u043c\u044f\u0447\u0438\u043a \u043f\u0440\u043e\u043b\u0435\u0442\u0438\u0442 \u0441\u043a\u0432\u043e\u0437\u044c \u0440\u0430\u043a\u0435\u0442\u043a\u0443.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<p>\u0411\u0438\u043b\u0434\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043d\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"bash\">% cargo run --bin server     Finished dev [unoptimized + debuginfo] target(s) in 0.14s      Running `target\/debug\/server` Server listening on [::1]:50051 <\/code><\/pre>\n<h3>\u041a\u043b\u0438\u0435\u043d\u0442<\/h3>\n<p>\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u0435\u0449\u0438: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u043e\u0439 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<pre><code class=\"rust\"> fn update(&amp;mut self, ctx: &amp;mut Context) -> tetra::Result {         Ok(())  }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f <code>GameState<\/code>:<\/p>\n<pre><code class=\"rust\">#[tokio::main]     async fn world_update_request(&amp;self, clicked_button_number: u32, player_number: u32) -> WorldStatus {         let request = tonic::Request::new(ClientActions {             player_number,             clicked_button: clicked_button_number,         });         let mut client = self.client.clone();         client.world_update_request(request)             .await.expect(\"Cannot get World Update from the server\").into_inner()     } <\/code><\/pre>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c 60 \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443:<\/p>\n<pre><code class=\"rust\">fn update(&amp;mut self, ctx: &amp;mut Context) -> tetra::Result {         let mut clicked_button = 2;         if input::is_key_down(ctx, Key::Up) {             clicked_button = 0;         }                  if input::is_key_down(ctx, Key::Down) {             clicked_button = 1;         }          let world_update_request =             self.world_update_request(clicked_button, self.player_number);         self.set_updated_values(world_update_request);          Ok(())     }<\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u0442 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043c, \u043d\u0430\u0436\u0430\u043b \u043b\u0438 \u0438\u0433\u0440\u043e\u043a \u043a\u043b\u0430\u0432\u0438\u0448\u0443 &#171;\u0441\u0442\u0440\u0435\u043b\u043a\u0430 \u0432\u0432\u0435\u0440\u0445&#187; \u0438\u043b\u0438 \u043a\u043b\u0430\u0432\u0438\u0448\u0443 &#171;\u0441\u0442\u0440\u0435\u043b\u043a\u0430 \u0432\u043d\u0438\u0437&#187;. \u0415\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b. \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>set_updated_values<\/code> \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0430\u0440\u0441\u0438\u043c \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0433\u0440\u044b.<\/p>\n<p>\u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0439 \u0432 \u0438\u0433\u0440\u0435, \u043c\u0435\u0442\u043e\u0434 <code>draw<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"rust\"> fn draw(&amp;mut self, ctx: &amp;mut Context) -> tetra::Result {         graphics::clear(ctx, Color::rgb(0.392, 0.584, 0.929));         \/\/ 0 - Player 1 won         \/\/ 1 - Player 2 won         if self.winner == 2 {             self.player1.texture.draw(ctx, self.player1.position);             self.ball.texture.draw(ctx, self.ball.position);             self.player2.texture.draw(ctx, self.player2.position);         } else {             let text_offset: Vec2&lt;f32> = Vec2::new(16.0, 16.0);             let mut message = format!(\"Winner is: Player \");             if self.winner == 0 {                 message += \"1\";             } else {                 message += \"2\";             }             let mut t: Text = Text::new(message,                                         Font::vector(ctx, \".\/resources\/DejaVuSansMono.ttf\",                                                      16.0)?,             );             t.draw(ctx, text_offset);         }         Ok(())     }<\/code><\/pre>\n<p>\u041a\u043b\u0438\u0435\u043d\u0442 \u0433\u043e\u0442\u043e\u0432. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c. <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<pre><code class=\"bash\"> cargo run --bin server<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442:<\/p>\n<pre><code class=\"bash\">cargo run --bin client <\/code><\/pre>\n<p>\u0418 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u0414\u0430\u0436\u0435 \u043d\u0435\u0442 \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u043d\u0430\u0436\u0430\u0442\u044b\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438. \u042d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u0436\u0434\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u043c\u044f\u0447\u0438\u043a \u043d\u0430\u0447\u0430\u043b \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0438 \u0438\u0433\u0440\u0430\u0435\u043c:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043f\u0435\u043a\u0442\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c &#171;\u043d\u0430 \u0441\u0434\u0430\u0447\u0443&#187;. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0434\u0445\u043e\u0434\u0443, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0440\u0435\u0442\u0438\u0439, \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u0439, \u043f\u044f\u0442\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430 \u0431\u0430\u0442\u0430\u043b\u0438\u0435\u0439 \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0438\u0433\u0440\u043e\u043a\u043e\u0432 \u0431\u0435\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u043c \u043f\u043e\u043c\u0435\u0448\u0430\u0442\u044c.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0433\u0430\u0439\u0434 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u043a\u0443\u0447\u0443 \u0432\u0441\u0435\u0433\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u0438\u0433\u0440\u044b \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0431\u0435\u0434\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0438\u0433\u0440\u043e\u043a\u043e\u0432, \u0440\u0435\u0430\u043a\u0446\u0438\u044e \u043d\u0430 \u0434\u0438\u0441\u043a\u043e\u043d\u043d\u0435\u043a\u0442 \u0438\u0433\u0440\u043e\u043a\u0430, \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0433\u0440\u0430\u0442\u044c \u0435\u0441\u043b\u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430 \u043d\u0435\u0442. \u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0430 \u0433\u0438\u0444\u043a\u0435 \u0432\u044b\u0448\u0435 \u0441\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0434\u0432\u0430 \u0431\u043e\u0442\u0430. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u043a\u0443\u0447\u0443 \u0432\u0441\u0435\u0433\u043e, \u043d\u043e \u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0440 \u0434\u043b\u044f \u0442\u0432\u043e\u0440\u0447\u0435\u0441\u0442\u0432\u0430. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/586418\/\"> https:\/\/habr.com\/ru\/articles\/586418\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-414356","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/414356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=414356"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/414356\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=414356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=414356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=414356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}