{"id":177,"date":"2023-08-30T22:50:54","date_gmt":"2023-08-30T22:50:54","guid":{"rendered":"https:\/\/speckoh.com\/?p=177"},"modified":"2023-08-31T15:33:04","modified_gmt":"2023-08-31T15:33:04","slug":"daily-dev-blog-player-chat-fog-of-war-etc","status":"publish","type":"post","link":"https:\/\/speckoh.com\/index.php\/2023\/08\/30\/daily-dev-blog-player-chat-fog-of-war-etc\/","title":{"rendered":"Daily Dev Blog &#8211; Player Chat, Fog of War, etc."},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"177\" class=\"elementor elementor-177\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-dd2d0b1 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"dd2d0b1\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-940135b\" data-id=\"940135b\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e333f30 elementor-widget elementor-widget-text-editor\" data-id=\"e333f30\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>I missed a month of Daily Blogging.&nbsp; To be honest, I&#8217;ve been a bit down on luck with the Job Market.&nbsp; It&#8217;s definitely makes me a bit sad&#8230;&nbsp;<\/p>\n<p>Anyway, I&#8217;ve been coding in Unity for awhile and I enjoy it and there&#8217;s still so much to learn.&nbsp; The Software Engineering field is just so vast that I&#8217;m a bit overwhelmed with everything out there.&nbsp; Sure, I can code decently in Unity for 2D games and other projects that I&#8217;ve built, but if I were to code in something else outside of Unity, it just feels a bit foreign.&nbsp; Bootcamp in General Assembly wasn&#8217;t hard to pass and get my Certificate, but that&#8217;s mostly Web Development which I&#8217;m pretty sure I can pick up again if I spend more time with it.&nbsp; But that&#8217;s the thing, there&#8217;s never really enough time to learn everything and I really have a strong urge to specialize in Unity 2D games.&nbsp; Seems like Employers expect one to know everything or maybe I&#8217;m just not searching hard enough.<\/p>\n<p>Aside from another project that I have to do some maintenance on from time to time, I&#8217;ve been spending the other portion of my free time continuing on Building Battle of Bases (Metal Marines Inspired).&nbsp; I got some Menus built to get to the gameplay portion which includes the Lobby where players connect through LAN and can chat.&nbsp; There&#8217;s also a grid like preview of the map where the player can choose where to plant their base.&nbsp; It&#8217;s a bit like Battleship where you plant your ships.&nbsp; So aside from the Test Map, usually a player can place up to 3 Bases.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-70004c0 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"70004c0\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-08470f4\" data-id=\"08470f4\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-de303b6 elementor-widget elementor-widget-image\" data-id=\"de303b6\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"640\" height=\"360\" src=\"https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_lobby-1024x576.jpg\" class=\"attachment-large size-large wp-image-179\" alt=\"\" srcset=\"https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_lobby-1024x576.jpg 1024w, https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_lobby-300x169.jpg 300w, https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_lobby-768x432.jpg 768w, https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_lobby.jpg 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-f797904 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f797904\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f486114\" data-id=\"f486114\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1447b75 elementor-widget elementor-widget-text-editor\" data-id=\"1447b75\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The next major thing I worked on aside from some UI adjustments have been the Fog of War.&nbsp; This thing was a major pain to implement and I couldn&#8217;t find any perfect tutorial for it.&nbsp; Although, implementing the Minimap&#8217;s Fog of War was a Breeze thanks to James Doyle covering that aspect in his Udemy Roguelike course.&nbsp; I initially did the method of Spawning a grid of Fog Tiles per grid position.&nbsp; So with a map size of 65 x 65, the screen ended up having over 4000 Objects.&nbsp; Did it work?&nbsp; Sure, but the framerate was horrendous.&nbsp; Dropped to 20-30 Frames per second.&nbsp; After a few days of fiddling with that along with trying other methods or solutions to increase the Framerate, I completely scrapped that way of doing it.&nbsp;&nbsp;<\/p>\n<p>So, I had to make use of the Tilemap somehow but I&#8217;m still pretty new to Tilemapping.&nbsp; I used to actually just drag prefab objects and snap them into the scene but Tilemaps are just so much better for performance.&nbsp; And it&#8217;s supposed to speedup things map\/dungeon designing.&nbsp; But Tilemaps does make Visualizing each tile more difficult as it seems like one Merged Object.&nbsp; So I can&#8217;t click each object individually to check.&nbsp; And I never understood how one can get properties of each Tile in the Tilemap.&nbsp; During this road block, I learned much more about how Scriptable Objects work now in Unity.&nbsp; I also got more familiar with custom classes, structs, a bit on Dictionaries and ways to reference those Tiles which helps with the Visualizing.&nbsp; I haven&#8217;t really had the need to use them much in the past.&nbsp; It&#8217;s still a major pain as opposed to just adding a trigger collider onto an Tile.&nbsp; But since I can&#8217;t find a way to give each tile a unique collider that triggers separately, I had to go back to studying Trigonometry again and make each Fog Tile show (or not) based on the Distance from a structure for instance.&nbsp; All in all, after much effort, I&#8217;m happy with the results as now it performs over 100 Frames faster than the previous method of spawning a few thousand GameObjects.&nbsp; Also, shooting missiles blackens the terrain.&nbsp; I just have to draw some Animations now for the Explosion!<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-80a1c90 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"80a1c90\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c1fc4ce\" data-id=\"c1fc4ce\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-374fc7e elementor-widget elementor-widget-image\" data-id=\"374fc7e\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"640\" height=\"360\" src=\"https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_fow-1024x576.jpg\" class=\"attachment-large size-large wp-image-180\" alt=\"\" srcset=\"https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_fow-1024x576.jpg 1024w, https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_fow-300x169.jpg 300w, https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_fow-768x432.jpg 768w, https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_fow.jpg 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-176e8c8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"176e8c8\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-16bbc5c\" data-id=\"16bbc5c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e6b32d3 elementor-widget elementor-widget-image\" data-id=\"e6b32d3\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"640\" height=\"360\" src=\"https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_deto-1024x576.jpg\" class=\"attachment-large size-large wp-image-181\" alt=\"\" srcset=\"https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_deto-1024x576.jpg 1024w, https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_deto-300x169.jpg 300w, https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_deto-768x432.jpg 768w, https:\/\/speckoh.com\/wp-content\/uploads\/2023\/08\/screenshot_deto.jpg 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>I missed a month of Daily Blogging.&nbsp; To be honest, I&#8217;ve been a bit down on luck with the Job Market.&nbsp; It&#8217;s definitely makes me a bit sad&#8230;&nbsp; Anyway, I&#8217;ve been coding in Unity for awhile and I enjoy it &hellip; <a href=\"https:\/\/speckoh.com\/index.php\/2023\/08\/30\/daily-dev-blog-player-chat-fog-of-war-etc\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/speckoh.com\/index.php\/wp-json\/wp\/v2\/posts\/177"}],"collection":[{"href":"https:\/\/speckoh.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/speckoh.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/speckoh.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/speckoh.com\/index.php\/wp-json\/wp\/v2\/comments?post=177"}],"version-history":[{"count":13,"href":"https:\/\/speckoh.com\/index.php\/wp-json\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":193,"href":"https:\/\/speckoh.com\/index.php\/wp-json\/wp\/v2\/posts\/177\/revisions\/193"}],"wp:attachment":[{"href":"https:\/\/speckoh.com\/index.php\/wp-json\/wp\/v2\/media?parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/speckoh.com\/index.php\/wp-json\/wp\/v2\/categories?post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/speckoh.com\/index.php\/wp-json\/wp\/v2\/tags?post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}