<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: TMcSquared</title>
    <description>The latest articles on DEV Community by TMcSquared (@tmcsquared).</description>
    <link>https://dev.to/tmcsquared</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F58687%2Fb660ca7d-afc9-4806-b868-57f4971f3bc0.png</url>
      <title>DEV Community: TMcSquared</title>
      <link>https://dev.to/tmcsquared</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tmcsquared"/>
    <language>en</language>
    <item>
      <title>Crazy Developer Stories/Bugs</title>
      <dc:creator>TMcSquared</dc:creator>
      <pubDate>Tue, 21 Aug 2018 03:23:28 +0000</pubDate>
      <link>https://dev.to/tmcsquared/crazy-developer-storiesbugs-3247</link>
      <guid>https://dev.to/tmcsquared/crazy-developer-storiesbugs-3247</guid>
      <description>&lt;p&gt;Hello all, I'd like to see some of the game developers of this community tell some of their craziest stories/bug fixes.&lt;/p&gt;

&lt;p&gt;I'll start the list off, I was creating a GameState management structure within my project and wanted to see if I could create nested GameState managers(not the best idea in the world). The application would launch into the &lt;code&gt;MainMenu&lt;/code&gt;, go to &lt;code&gt;SinglePlayer&lt;/code&gt;, which would then go into the &lt;code&gt;PlayingScreen&lt;/code&gt;. Now, &lt;code&gt;PlayingScreen&lt;/code&gt; had another GameState manager inside of it and worked exactly like the main application's manager. On entry it would show the &lt;code&gt;Loading&lt;/code&gt; screen which had an &lt;code&gt;ImGui&lt;/code&gt; progress bar that was updated like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;fraction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;ImGui&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ProgressBar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fraction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ImVec2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="n"&gt;fraction&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mf"&gt;0.001&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fraction&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// This sets Playing as the current state&lt;/span&gt;
    &lt;span class="n"&gt;g_Client&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;getPlayingScreen&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"playing"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some of you might already see the problem that I would have in changing the state of the &lt;code&gt;PlayingScreen&lt;/code&gt; in this fashion. &lt;code&gt;Playing&lt;/code&gt; had a button that told &lt;code&gt;g_Client&lt;/code&gt; to go exit &lt;code&gt;PlayingScreen&lt;/code&gt; and go directly back to &lt;code&gt;SinglePlayer&lt;/code&gt;. When I did this and went back into &lt;code&gt;PlayingScreen&lt;/code&gt; something was wrong...The &lt;code&gt;Loading&lt;/code&gt; didn't show!&lt;/p&gt;

&lt;p&gt;I thought that the &lt;code&gt;std::vector&lt;/code&gt; that held the states wasn't clearing and was messing with the re-entry of &lt;code&gt;PlayingScreen&lt;/code&gt;. That proved to be a long day of frustration and disappointment as I poured over &lt;code&gt;std::vector&lt;/code&gt; docs online trying to get it to clear properly.&lt;/p&gt;

&lt;p&gt;Finally, I was screen-sharing with one of my friends using Discord and he noticed a stutter going from &lt;code&gt;SinglePlayer&lt;/code&gt; to the &lt;code&gt;Playing&lt;/code&gt; state inside of &lt;code&gt;PlayingScreen&lt;/code&gt;. So I investigated a little further and realized to my relief and now apparent idiocy that &lt;strong&gt;I never reset&lt;/strong&gt; &lt;code&gt;fraction&lt;/code&gt; when switching to &lt;code&gt;Playing&lt;/code&gt;!!!&lt;/p&gt;

&lt;p&gt;Here was the final code that fixed the entire problem in less than 30 seconds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;fraction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;ImGui&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ProgressBar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fraction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ImVec2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="n"&gt;fraction&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mf"&gt;0.001&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fraction&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// This sets Playing as the current state&lt;/span&gt;
    &lt;span class="n"&gt;g_Client&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;getPlayingScreen&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"playing"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;fraction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;-- Note this part&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope you have a similar story, and if not, please comment on someone else's. Have a great day/night, everyone!&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Explain Entity-Component Systems like I'm five</title>
      <dc:creator>TMcSquared</dc:creator>
      <pubDate>Sun, 29 Jul 2018 20:51:02 +0000</pubDate>
      <link>https://dev.to/tmcsquared/explain-entity-component-systems-like-im-five-2396</link>
      <guid>https://dev.to/tmcsquared/explain-entity-component-systems-like-im-five-2396</guid>
      <description></description>
      <category>explainlikeimfive</category>
    </item>
    <item>
      <title>What do you do when you're frustrated?</title>
      <dc:creator>TMcSquared</dc:creator>
      <pubDate>Fri, 22 Jun 2018 13:31:13 +0000</pubDate>
      <link>https://dev.to/tmcsquared/what-do-you-do-when-youre-frustrated-2ni6</link>
      <guid>https://dev.to/tmcsquared/what-do-you-do-when-youre-frustrated-2ni6</guid>
      <description>&lt;p&gt;Usually, I just walk away and take a break from whatever it is that I'm working on, whether it be hobbies, programming, school, etc. Then I come back with a fresh mind to be able to deal with the problem.&lt;/p&gt;

&lt;p&gt;EDIT: I forgot to mention that I found out bashing my head against the problem doesn't work real well.&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>What do you think of voxel-based games?</title>
      <dc:creator>TMcSquared</dc:creator>
      <pubDate>Mon, 04 Jun 2018 18:16:32 +0000</pubDate>
      <link>https://dev.to/tmcsquared/what-do-you-think-of-voxel-based-games-1bkp</link>
      <guid>https://dev.to/tmcsquared/what-do-you-think-of-voxel-based-games-1bkp</guid>
      <description></description>
      <category>voxel</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
