<?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: moonwalker</title>
    <description>The latest articles on DEV Community by moonwalker (@petrova_line).</description>
    <link>https://dev.to/petrova_line</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%2F2823565%2Fc9e1c029-58f7-44b9-b672-c0ddb28fd1a2.jpg</url>
      <title>DEV Community: moonwalker</title>
      <link>https://dev.to/petrova_line</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/petrova_line"/>
    <language>en</language>
    <item>
      <title>How Games Maintain Consistent Speed Across Different Devices</title>
      <dc:creator>moonwalker</dc:creator>
      <pubDate>Sun, 09 Feb 2025 18:05:10 +0000</pubDate>
      <link>https://dev.to/petrova_line/how-games-maintain-consistent-speed-across-different-devices-9in</link>
      <guid>https://dev.to/petrova_line/how-games-maintain-consistent-speed-across-different-devices-9in</guid>
      <description>&lt;p&gt;Our game wants to rotate something at 3 radians/second on every device. Let's see how this works at different framerates.&lt;/p&gt;

&lt;h3&gt;
  
  
  For a device running at 60 FPS:
&lt;/h3&gt;

&lt;p&gt;Delta time (time for 1 frame) = 0.0167 seconds&lt;br&gt;
Rotation covered in 1 frame = 0.0167 * 3 (radians/second) = 0.05 radians&lt;br&gt;
Total rotation in 60 frames = 0.05 * 60 = 3 radians&lt;/p&gt;

&lt;h3&gt;
  
  
  For a device running at 30 FPS:
&lt;/h3&gt;

&lt;p&gt;Delta time (time for 1 frame) = 0.033 seconds&lt;br&gt;
Rotation covered in 1 frame = 0.033 * 3 (radians/second) = 0.1 radians&lt;br&gt;
Total rotation in 30 frames = 0.1 * 30 = 3 radians&lt;/p&gt;

&lt;p&gt;The key insight here is that based on FPS, the amount of rotation that happens in a single frame changes. For higher FPS it's lower (smaller steps), and for lower FPS it's higher (bigger steps).&lt;/p&gt;

&lt;p&gt;But the total rotation over one second remains the same: 3 radians.&lt;/p&gt;

&lt;p&gt;This is why we use delta time - it ensures consistent motion regardless of the device's frame rate.  Instead of applying rotation (3 radians/second) directly per frame, we calculate the appropriate rotation for each frame by multiplying our desired rate by delta time (seconds/frame).&lt;/p&gt;

&lt;p&gt;So time dependency becomes frame dependency that resolves itself on each device. &lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>godot</category>
    </item>
    <item>
      <title>Counting in Probability: A Dev's 2x2 Cheat Sheet</title>
      <dc:creator>moonwalker</dc:creator>
      <pubDate>Fri, 07 Feb 2025 05:20:42 +0000</pubDate>
      <link>https://dev.to/petrova_line/counting-in-probability-a-devs-2x2-cheat-sheet-1o8n</link>
      <guid>https://dev.to/petrova_line/counting-in-probability-a-devs-2x2-cheat-sheet-1o8n</guid>
      <description>&lt;p&gt;I enjoy probability and statistics, but counting problems often confuse me - especially with questions of replacement and order in experiments.&lt;/p&gt;

&lt;p&gt;Here's a 2X2 matrix that handles these 4 possibilities:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Selection Type \ Order&lt;/th&gt;
&lt;th&gt;Order Matters&lt;/th&gt;
&lt;th&gt;Order Doesn't Matter&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;With Replacement&lt;/td&gt;
&lt;td&gt;n^r&lt;/td&gt;
&lt;td&gt;C(n+r-1,r)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Without Replacement&lt;/td&gt;
&lt;td&gt;P(n,r) = n!/(n-r)!&lt;/td&gt;
&lt;td&gt;C(n,r) = n!/(r!(n-r)!)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;n = total items to choose from&lt;/li&gt;
&lt;li&gt;r = items being chosen&lt;/li&gt;
&lt;li&gt;P(n,r) denotes Permutation&lt;/li&gt;
&lt;li&gt;C(n,r) denotes Combination&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;To classify any counting problem, ask two questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can I use the same item again?&lt;/li&gt;
&lt;li&gt;Does sequence matter?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Candy jar&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Allows replacement - can pick a candy, return it, and pick it again&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Deck of cards&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;No replacement - once drawn, a card stays out of the deck&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Password&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Allows replacement - can reuse letters, and order matters&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Committee&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;No replacement - each person picked once, order doesn't matter&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>maths</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
