<?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>Forem: Sifar J</title>
    <description>The latest articles on Forem by Sifar J (@sifar).</description>
    <link>https://forem.com/sifar</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%2F873530%2Feb3c90f6-99ce-4cbb-ba42-6dff09d55251.png</url>
      <title>Forem: Sifar J</title>
      <link>https://forem.com/sifar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sifar"/>
    <language>en</language>
    <item>
      <title>Quadratics game progress</title>
      <dc:creator>Sifar J</dc:creator>
      <pubDate>Tue, 21 Jun 2022 04:22:34 +0000</pubDate>
      <link>https://forem.com/sifar/quadratics-game-progress-1jg6</link>
      <guid>https://forem.com/sifar/quadratics-game-progress-1jg6</guid>
      <description>&lt;p&gt;First off, if you're new here, check out the first blog in this series here: &lt;a href="https://dev.to/sifar/building-a-math-based-game-my-journey-so-far-3gdf"&gt;https://dev.to/sifar/building-a-math-based-game-my-journey-so-far-3gdf&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;These two weeks have been really great! I learned a lot of lessons in programming and made some considerable progress.&lt;/p&gt;

&lt;p&gt;Programming lesson 1: minimise hardcoded values/magic numbers&lt;/p&gt;

&lt;p&gt;In my previous code, I had a lot of hardcoded values. Hardcoded values are values that have close to no explanation. They are values the developer derives, most of which change when the code has to do something a little different. This is dangerous, as the code is not replicable and is a bad example of how coding should be done. Hardcoded values are also called magic numbers.&lt;/p&gt;

&lt;p&gt;In the case of my game, the code could only simulate one curve without me changing all the magic numbers. These are examples of magic numbers in my previous code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KOmxL2lE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jasvhm12w6tb6omoijaf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KOmxL2lE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jasvhm12w6tb6omoijaf.png" alt="Image description" width="558" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8chDaQrJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k2t3ktbtemvi4sd24ixk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8chDaQrJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k2t3ktbtemvi4sd24ixk.png" alt="Image description" width="880" height="1096"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my new code, the computer derives all the values. Only two magic numbers ensure the quadratic curve covers the screen's total height in the code. Though these won't change with the screen size, I had to make up some values and choose the ones I currently have!&lt;/p&gt;

&lt;p&gt;Because of these modularisations, the code works for any quadratic curve (except when a constant is added at the end). &lt;/p&gt;

&lt;p&gt;Harshad gave me this feedback, and I realised how important a coding principle this is. Having the minimum amount of magic numbers makes the developers', reviewers', and contributors' jobs more manageable.&lt;/p&gt;

&lt;p&gt;Programming lesson 2: reduce the computations&lt;/p&gt;

&lt;p&gt;Harshad also told me to make the computations more optimal. As I said in my previous blog, the tank movement was determined by a series of if-else conditions. Well, that code is too lengthy and unnecessary. I found a more straightforward way, which is actually better.&lt;/p&gt;

&lt;p&gt;I made a variable called x_value, which will be used for iteration. The program will stop working when the x_value has reached the number of points I have simulated the curve to be. I decided the number of points simulated to be 1/10 of the screen width. So, for a default screen width of 1280, the tank will have 128 reference points. This is a significant improvement from the previous 8! In fact, this is 16 times better!&lt;/p&gt;

&lt;p&gt;The update function essentially is a never-ending for loop. So, I added x_value for every 60 frames (the update function renders graphics at 60 fps). x_value would start at 0. This will allow me to use x_value to determine the corresponding y value from the points list (created in init()) and set a finish point.&lt;/p&gt;

&lt;p&gt;Instead of having 8 if-else conditions, now I have a 5-liner update() code!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PNwu_KYe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ej3ga4o3qgjzjdbouwpi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PNwu_KYe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ej3ga4o3qgjzjdbouwpi.png" alt="Image description" width="880" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Programming lesson 3: comment, comment, comment&lt;/p&gt;

&lt;p&gt;If you look at some code you wrote 2 weeks down the line, you often don't remember what it does. If you look at it 2 years later, you won't remember anything!&lt;/p&gt;

&lt;p&gt;I started this happening to me. Thus, I heavily commented the code.&lt;/p&gt;

&lt;p&gt;And it is essential to comment your code. It helps reviewers and contributors, sure. But most importantly, it helps you, the developer.&lt;/p&gt;

&lt;p&gt;The code runs like this now!&lt;/p&gt;

&lt;p&gt;Curve x^2 + 9x:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uze3IVJh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o27lwiz888h7xkg3tyr9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uze3IVJh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o27lwiz888h7xkg3tyr9.gif" alt="Image description" width="600" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Curve 2x^2 + 4x:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N3_heEwZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f3a7p5gttzjjg504uf7s.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N3_heEwZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f3a7p5gttzjjg504uf7s.gif" alt="Image description" width="600" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Again, I'm using the Defold game engine. The people at Defold are hardworking and are consistently releasing important updates almost every week. Hats off to them for creating such a great game engine! Check them out at &lt;a href="https://defold.com/"&gt;https://defold.com/&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;This is my progress so far! If you want to see my coding journey, follow this project at: &lt;a href="https://github.com/sifar21353/DesktopGame"&gt;https://github.com/sifar21353/DesktopGame&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Pledu Interactive: &lt;a href="https://pledu.co"&gt;https://pledu.co&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Socials: &lt;a href="https://twitter.com/SifarJirgale"&gt;https://twitter.com/SifarJirgale&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.reddit.com/user/JuliusCheesy"&gt;https://www.reddit.com/user/JuliusCheesy&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/sifarjirgale/"&gt;https://www.linkedin.com/in/sifarjirgale/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Email (for inquiries): &lt;a href="mailto:sifar@jirgale.com"&gt;sifar@jirgale.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>math</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Effect of educational games on kids and teenagers</title>
      <dc:creator>Sifar J</dc:creator>
      <pubDate>Tue, 14 Jun 2022 06:27:28 +0000</pubDate>
      <link>https://forem.com/sifar/effect-of-educational-games-on-kids-and-teenagers-2ad</link>
      <guid>https://forem.com/sifar/effect-of-educational-games-on-kids-and-teenagers-2ad</guid>
      <description>&lt;p&gt;Adults always tell us to not play games for prolonged periods. But, they encourage playing educational games. Are educational games really better compared to traditional learning?&lt;/p&gt;

&lt;p&gt;Short answer: yes. They most probably do.&lt;/p&gt;

&lt;p&gt;While there is no definite answer and studies are still ongoing, many studies favour video games being better than traditional learning. &lt;/p&gt;

&lt;p&gt;In a study from 2006, the experimenter developed a game for students with dyscalculia. The students were given 5 weeks to complete the game. It was found that all students could solve numerical tasks better and had a boost in their confidence!&lt;/p&gt;

&lt;p&gt;Various other studies conducted from 2000 to 2010 support this claim. All of them say educational video games are why their perception of mathematics improved; they got motivation and were able to perform better.&lt;/p&gt;

&lt;p&gt;A study covered on CNN in 2016 shows that students who spent more time gaming than browsing social media performed 4% higher.&lt;/p&gt;

&lt;p&gt;A Stanford study states that games today focus more on teaching skills rather than the ability to think. They focus on retention rather than understanding. &lt;/p&gt;

&lt;p&gt;And I agree with that study. Games can bring about a revolution in the education industry. Education approaches might be entirely different for the next generation. We need to reduce today's rote-learning strategies with more practical-based learning. If we can somehow make engaging games which will also help the player develop an ability to think, education all across the globe could be revolutionised and made a lot better.&lt;/p&gt;

&lt;p&gt;I truly admire all the companies making educational games and trying to make students' lives easier. I am a student, and using games to learn helps me understand and solidify concepts quicker. In this 'information era', game-based learning can significantly improve education.&lt;/p&gt;

&lt;p&gt;This is precisely what engineer Harshad Saykhedkar (&lt;a href="https://www.linkedin.com/in/harshadss/"&gt;https://www.linkedin.com/in/harshadss/&lt;/a&gt;) and I are trying to do at Pledu Interactive. We're creating science-based courses with many games to help students learn concepts. Check Pledu Interactive out at: &lt;a href="https://pledu.co"&gt;https://pledu.co&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Socials: &lt;a href="https://twitter.com/SifarJirgale"&gt;https://twitter.com/SifarJirgale&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.reddit.com/user/JuliusCheesy"&gt;https://www.reddit.com/user/JuliusCheesy&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/sifarjirgale/"&gt;https://www.linkedin.com/in/sifarjirgale/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Email (for inquiries): &lt;a href="mailto:sifar@jirgale.com"&gt;sifar@jirgale.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>beginners</category>
      <category>math</category>
      <category>programming</category>
    </item>
    <item>
      <title>Building a math-based game: my journey so far</title>
      <dc:creator>Sifar J</dc:creator>
      <pubDate>Tue, 07 Jun 2022 05:09:05 +0000</pubDate>
      <link>https://forem.com/sifar/building-a-math-based-game-my-journey-so-far-3gdf</link>
      <guid>https://forem.com/sifar/building-a-math-based-game-my-journey-so-far-3gdf</guid>
      <description>&lt;p&gt;I got introduced to an exciting startup "Terminus School". It is being built by Harshad Saykhedkar (&lt;a href="https://www.linkedin.com/in/harshadss" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/harshadss&lt;/a&gt;, one of my father's friends), and I met him in February of this year. Before I tell you about my journey, I'll give you a brief idea of what Terminus School is trying to do.&lt;/p&gt;

&lt;p&gt;Terminus School (&lt;a href="https://beta.terminus.school" rel="noopener noreferrer"&gt;https://beta.terminus.school&lt;/a&gt;) is an ed-tech startup. At Terminus, we create courses catering to physics, chemistry and math topics typically taught in an Indian high school. The current courses that are out are trigonometry, coordinate geometry and logarithms. Terminus focuses on game-based learning and practical learning. All courses have a lot of games, which will help build an intuitive and, thus, a better understanding of the concept. All quizzes and exercises also use empirical data or have a connection to something that happens in real life.&lt;br&gt;
The courses focus more on First Principle learning. I personally find the process of making these courses and the courses themselves very enriching! &lt;/p&gt;

&lt;p&gt;My father connected me to Harshad. I initially began with game ideation and testing. I found this startup idea to be promising. I decided to continue working, ideating and testing more games. Eventually, I started developing a game to explain quadratics.&lt;/p&gt;

&lt;p&gt;My game's goal is to show a quadratic graph's structure. The game would go like this:&lt;/p&gt;

&lt;p&gt;There would be tanks that generate and fire bullets at the player's base. These tanks would follow the graphs of different graphs. As time progresses, these tanks get faster. The player has to fire bullets at the tanks and destroy them before the tanks destroy the player's base.&lt;/p&gt;

&lt;p&gt;I started working with the Defold game engine. I completed the tutorials the Defold team had provided and got accustomed to the functions.&lt;/p&gt;

&lt;p&gt;I learned how to make the player shoot bullets and make different game elements disappear when a bullet hits it. I was quick to implement this feature. I started with the tanks following a linear motion. &lt;/p&gt;

&lt;p&gt;Then came one of the most complex parts: simulating a quadratic movement. I went to Desmos and plotted the equation: x^2 + 4x. I plotted 9 points and decided to make the tanks follow a linear path from point to point.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmaurfmkzcj8bw6iuh0l0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmaurfmkzcj8bw6iuh0l0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To simulate diagonal movement, I made the tanks go a particular distance right (positive value on the x-axis) and a particular distance down/up (positive/negative values on the y-axis) in the same frame. Defold renders graphics at 60 frames per second.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvcbo44fmvu6s10xgztah.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvcbo44fmvu6s10xgztah.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great! Now there was a way to move the tank from point to point. To track where the tank is, I set up two variables called logic_x_bool and logic_y_bool. These would increase in value as the tank progressed. They would start off as 0, and after going to a point, they would get incremented by 1. To actually set the x and y movements, I set up two more variables: x_logic and y_logic. All of this would be controlled by a series of if-else conditions.&lt;/p&gt;

&lt;p&gt;The quadratic curve was complete! The tank could be shot down as well!&lt;/p&gt;

&lt;p&gt;Now, there was a problem. The movement code had a lot of hard-coded values. Harshad sat with me and explained to me the proper coding guidelines, how I can use loops, functions, recursion etc., to optimize this and remove these magic numbers. I am also adding more documentation to the code to be more readable and understandable. These are some precious lessons in my coding journey.&lt;/p&gt;

&lt;p&gt;The code runs like this now!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/YDDBCfhIzQg" rel="noopener noreferrer"&gt;https://youtu.be/YDDBCfhIzQg&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/V0PmUOJ4_v0" rel="noopener noreferrer"&gt;https://youtu.be/V0PmUOJ4_v0&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also learned to use Github for version control and how game engines work! More about that in a future blog :)&lt;/p&gt;

&lt;p&gt;I am thankful to Harshad and Terminus school for this opportunity.&lt;/p&gt;

&lt;p&gt;This is my progress so far! If you want to see my coding journey, follow this project at: &lt;a href="https://github.com/sifar21353/DesktopGame" rel="noopener noreferrer"&gt;https://github.com/sifar21353/DesktopGame&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Socials: &lt;a href="https://twitter.com/SifarJirgale" rel="noopener noreferrer"&gt;https://twitter.com/SifarJirgale&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.reddit.com/user/JuliusCheesy" rel="noopener noreferrer"&gt;https://www.reddit.com/user/JuliusCheesy&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/sifarjirgale/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/sifarjirgale/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Email (for inquiries): &lt;a href="mailto:sifar@jirgale.com"&gt;sifar@jirgale.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading! &lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>beginners</category>
      <category>math</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
