<?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: Ioannis Apostolopoulos</title>
    <description>The latest articles on Forem by Ioannis Apostolopoulos (@shadycrisp).</description>
    <link>https://forem.com/shadycrisp</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%2F1190339%2F6b5241a0-af1c-4560-8946-544c32e98f9b.png</url>
      <title>Forem: Ioannis Apostolopoulos</title>
      <link>https://forem.com/shadycrisp</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shadycrisp"/>
    <language>en</language>
    <item>
      <title>Creating A Planetary System Simulation in Unity 2D</title>
      <dc:creator>Ioannis Apostolopoulos</dc:creator>
      <pubDate>Sat, 24 May 2025 18:37:09 +0000</pubDate>
      <link>https://forem.com/shadycrisp/creating-a-planetary-system-simulation-in-unity-2d-4hhe</link>
      <guid>https://forem.com/shadycrisp/creating-a-planetary-system-simulation-in-unity-2d-4hhe</guid>
      <description>&lt;p&gt;I have always been interested in physics, initially physics concerning planets and how outer space travel works. This stemmed from an interest in  a video game called Kerbal Space Program, and has since led me to discover many more fields of science, as I take physics as a course and am heavily interested in it. Another thing I am very passionate about is creating videogames, and I have managed to unluck that side of me through Unity and C#. I have created 3 released games, some with help, one on my own, and I plan on developing many more, it is a passion of mine. Recently I thought, what if I combined the concepts of gravitation in physics, as I had recently studied for it, and my passion for creating games. Hence, I decided to start a small project creating a basic simulation of a solar system in Unity 2D, utilizing my own functions that use Newtonian physics to simulate gravitation.&lt;/p&gt;

&lt;p&gt;The initial objective or goal of this little simulation is to have two spheres that can attract each other by following Newton's law of gravitation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8alz9d2i2qlnxs3kalbd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8alz9d2i2qlnxs3kalbd.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;M and m are the masses of the two planets or objects&lt;/li&gt;
&lt;li&gt;G is the gravitational constant (6.67*10^-11)&lt;/li&gt;
&lt;li&gt;r is the distance between the two planets/objects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First I set up a scene containing two spheres, with a RigidBody2D and a mass of 10 and 100kg.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F5uc9fkf73p9zs20yjra5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5uc9fkf73p9zs20yjra5.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I then created a script called Handle Gravity. I set out to make a function that followed Newton's law of gravitation. I created a method called AddGravity(), that took in the RigidBody2D of the attracted object, and the RigidBody2D of the attracting object. I first declared the gravitational constant (6.67*10^-11), and found the product of the masses times the gravitational constant G:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F5btr1plp6dxwwyc7cjda.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5btr1plp6dxwwyc7cjda.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I then divided this by the distance between the two objects squared, which can be found by subtracting the two vectors (&lt;code&gt;float vectorDistance = attracted.position - attractor.position;&lt;/code&gt;), and proceeded to use Unity's built in &lt;code&gt;Vector3.magnitude&lt;/code&gt; to find the distance between the two objects. Now that I have the product of the masses, and the distance between the two planets, I can apply Newton's law of gravitation. I can also find the distance by using Unity's &lt;code&gt;Vector3.normalized&lt;/code&gt;. This returns a vector with magnitude of 1, in the direction of the vector, which in this case is the &lt;code&gt;vectorDistance&lt;/code&gt; vector. The normalized vector and magnitude of force are then multiplied together to get the vector for total force.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Flgrd1pn1c40k50528t26.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Flgrd1pn1c40k50528t26.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This total force is then applied onto the attracted object: &lt;br&gt;
&lt;code&gt;attracted.AddForce(totalForce);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To actually continuously apply this force onto affected objects, I created a list of RigidBody2Ds of the attracted and attractors, and looped through them, applying the correct force for each object. Since this is physics based, I continuously called the function in the &lt;code&gt;FixedUpdate&lt;/code&gt; Unity method:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fjpvvuqzvirpyh5bh5wa0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fjpvvuqzvirpyh5bh5wa0.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This code is then attached to a GameManager object, and the two RigidBodys are referenced in the Lists I created before. From this, these are the results:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ff2kffhour06ccxwt7k5r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ff2kffhour06ccxwt7k5r.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You are not missing out by this only being an image, there is no movement. When I logged the totalforce, it was equal to zero.&lt;/p&gt;

&lt;p&gt;I realized the issue moments later: since the gravitational constant is used for celestial objects of large mass, it effectively acts as a 0 in the multiplication at such low masses. To compensate for this, I thought of using the real masses of the earth and moon to see if that would fix the issue. The mass of Earth would be 5.972*10^24 kg, and the mass of the earth would be 7.342*10^22 kg. After inputting these masses, this is the total force recorded:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqszcrtacm8tksad6opj4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqszcrtacm8tksad6opj4.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This of course is an improvement, but I realized that Unity puts a limit to the mass of its objects, at 1000000kg. To compensate for this, I thought to adjust the gravitational constant. I tried to calculate the in game G using the ratios of in game mass to real life mass, but for Unity2D, this is hardly tangible, as the gravitational constant G becomes even more insignificant, this is why I decided to play around with the values of G, ranging from 0.1 to 1. &lt;/p&gt;

&lt;p&gt;Upon running the code, I found that the smaller planet quickly accelerated &lt;strong&gt;away&lt;/strong&gt; from the other planet, mimicking two equal charges instead of masses. I could tell that this was a matter of the direction I was calculating.&lt;/p&gt;

&lt;p&gt;I managed to fix this by changing the line:&lt;br&gt;
&lt;code&gt;Vector3 vectorDistance = attracted.position - attractor.position;&lt;/code&gt;&lt;br&gt;
to:&lt;br&gt;
&lt;code&gt;Vector3 vectorDistance = attractor.position - attracted.position;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I realized this was wrong, cause since the force is acted on the 'attracted' body, the distance would be position of attracted - the position of the attractor, which would always be negative (position of attracted &amp;lt; position of attractor).&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/WH8jUffGIKw"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The next step would be to add an initial force to the smaller mass to allow it to orbit the larger one. I did this by applying a force in the start method:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F13c2i6rkwd343fg7xfcu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F13c2i6rkwd343fg7xfcu.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Turns out that a force of magnitude 5 is not nearly enough, and thus I changed it to a force of -150 magnitude on the y axis. I also stopped the larger mass from feeling the gravitational force to keep the system on screen:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/8kFhlD-jYG4"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This short project has been a successful one, and  due to my busy schedule, a quite enjoyable one. This was quite simple, so I do see myself moving into either tougher physics simulations in the future, or crafting a game out of this simulation or concept. But that is for another post. I will not post this simulation anywhere most likely, until I work on it further. Thank you to anyone who actually read through this!&lt;/p&gt;

&lt;p&gt;The next steps for such a project would be mechanics such as collisions, visualizing orbits, and being able to manually add forces to objects.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>unity3d</category>
      <category>gamedev</category>
      <category>simulation</category>
    </item>
    <item>
      <title>From Console Application to Story</title>
      <dc:creator>Ioannis Apostolopoulos</dc:creator>
      <pubDate>Sat, 21 Oct 2023 17:49:16 +0000</pubDate>
      <link>https://forem.com/shadycrisp/from-console-application-to-story-28op</link>
      <guid>https://forem.com/shadycrisp/from-console-application-to-story-28op</guid>
      <description>&lt;h2&gt;
  
  
  What Console Application?
&lt;/h2&gt;

&lt;p&gt;Hello Againn!😁👋 Two years ago, when I first dipped my toes into the world of C#, I tried to challenge myself with the creation of a basic console application using the .NET SDK. This led to the birth of a game I called  "Wizard Game." In the game, players could type in the name of a spell, and with a somewhat minimalistic effect, it would decrease the health of the enemy. Of course, the enemy had its turn to strike back. Join me as we revisit this humble project, one that marked the early stages of my C# programming journey, and look at the story behind a game that was meant to be storyless.&lt;br&gt;
&lt;a href="https://media2.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%2Fwb5fvzpky9zsylymb7oi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fwb5fvzpky9zsylymb7oi.png" alt="Wizard Game in action lol" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Storyless? Or a Deeper Meaning?
&lt;/h2&gt;

&lt;p&gt;For the longest time, I forgot about "Wizard Game." It was an  simple console application that I had created way back when I was just getting into the world of game development.&lt;/p&gt;

&lt;p&gt;Right after finishing my first game, I had to think of ideas for a new game. I could not for the life of me come up with an original idea. I was determined to push my creativity and develop something that would stand out. At first, I played around with the idea of making a digital card game, inspired by my many hours spent playing them. I thought it could be a great project, given my love for the strategic and competitive spirit card games often brought to the table.&lt;/p&gt;

&lt;p&gt;However, as I delved deeper into the concept, I realized that I was following a path already followed by many other game developers. While I admired card games, I wanted something more original or unique, something that would set my work apart. It was during this moment of thinking that my mind drifted back to "Wizard Game."&lt;/p&gt;

&lt;p&gt;As I reflected on my old creation, I realized that the seemingly simple console application had sparked a world of possibilities in my mind. Beyond the basic mechanics there was something enchanting about the game—a story, a compelling story that I had previously overlooked. To be more precise, there was no story(😞), but in my mind, it was as if the game had planted a seed of creativity in me, and I started thinking, coming up with a complex story(the good ending😊).&lt;/p&gt;

&lt;h2&gt;
  
  
  What Will Happen With This?
&lt;/h2&gt;

&lt;p&gt;This whole concept is still very rough, and although it could lead to a very cool game idea in the near future, there is always a chance this idea gets scrapped. I am very optimistic that this idea will be the root of a great game, especially since my experience with game engines and coding in general have increased over the past year. This was a shorter read, but I am still so gratefully for anyone who is willing to spend even 2-3 minutes of their valuable time reading about my story.&lt;/p&gt;

&lt;p&gt;I thank you all!&lt;br&gt;
Ioannis, The Semi-Intermediate game developer(and yes, i'm going to keep saying it😁)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>My GameDev Story!</title>
      <dc:creator>Ioannis Apostolopoulos</dc:creator>
      <pubDate>Sat, 21 Oct 2023 10:09:29 +0000</pubDate>
      <link>https://forem.com/shadycrisp/my-gamedev-story-5f3k</link>
      <guid>https://forem.com/shadycrisp/my-gamedev-story-5f3k</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Hello there!👋😊 In this blog I will write about how I've embarked on an exhilarating adventure in the world of game development. While it's a field known for its excitement and challenges, my journey has been particularly unique. You see, I'm a self taught semi-beginner game developer who's been working diligently with Unity. I've already achieved some significant milestones, including the creation of a simple game and even participating in a thrilling game jam.&lt;/p&gt;

&lt;p&gt;In this blog post, I want to take you on a personal voyage, sharing my experiences and the invaluable lessons I've gained on my path. It's a journey that's been both exhilarating and challenging, and I believe that my story might resonate with others who share a similar passion for programming and game development. So, come along with me as I open up my world and share the highs and lows, the joys and hurdles, and the endless potential that awaits on this remarkable journey.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who am I?
&lt;/h2&gt;

&lt;p&gt;Hey!👋 My name is Ioannis, and I'm an enthusiastic programmer with an unwavering passion for crafting video games. About two years ago, I embarked on this thrilling journey all on my own, dedicating my free time to the art of coding, as well as other hobbies related to gamedev, such as art! It all began with C#, a language I was determined to master to transform my game development dreams into reality.&lt;/p&gt;

&lt;p&gt;Around one and a half years ago, I took the next step and ventured into the realm of Unity. This versatile platform had the potential to breathe life into my game ideas. As a self-taught developer with no formal education or mentorship, I found my way through experimentation and unwavering determination. Along this journey, I drew inspiration from a particular devlog YouTuber, Dani, whose infectious enthusiasm for game development made the process undeniably fun. In fact, it was Dani's videos that sparked my passion and showed me how enjoyable game development could truly be. In this blog, I aspire to share the knowledge and experiences I've accumulated as a self-taught game developer, replete with both challenges and victories. &lt;/p&gt;

&lt;h2&gt;
  
  
  Further Interests
&lt;/h2&gt;

&lt;p&gt;Besides my love for game development, I hold a fascination for AI, even though I haven't delved deeply into it as of yet. The possibilities that artificial intelligence presents in various fields intrigue me, and I hope to explore it further in the future. Additionally, my interests extend to creating helpful applications and web development. I see these areas as interconnected, and I believe that these skills can complement and enhance my software development endeavors.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Future Ambitions
&lt;/h2&gt;

&lt;p&gt;As I continue my journey in the realm of game development, I've set my sights on several ambitious future goals. These goals not only drive my passion but also provide a roadmap for my ongoing growth in this exciting field.&lt;/p&gt;

&lt;p&gt;First and foremost, I strive to create an original video game that not only reflects my creative vision but also manages to captivate players and build a dedicated player base. The true measure of success, for me, would be to see players engage with and enjoy the world I've crafted. Even if this community has the size of 10 players. It's a challenge I eagerly embrace and a goal that propels me forward with determination.&lt;/p&gt;

&lt;p&gt;Another aspiration close to my heart is the art of storytelling through my games. I believe that video games have the unique power to immerse players in narratives and experiences in a unique way. I'm eager to weave compelling stories into the games I create. Whether it's an epic adventure, a thought-provoking exploration, or an emotional journey, I aim to leave a lasting impact on those who play my games.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beyond GameDev
&lt;/h2&gt;

&lt;p&gt;Beyond game development, I'm committed to mastering Unity as a game engine, pushing my technical skills to their limits. Additionally, I plan to branch out into other aspects of software development, such as web development. These complementary skills will not only expand my horizons but also provide opportunities to apply the knowledge and expertise I've gained in game development to new and exciting projects.&lt;/p&gt;

&lt;p&gt;In this ever-evolving journey, my future goals serve as beacons, guiding me toward new challenges and opportunities in the world of software and game development. With perseverance and a dash of creativity, I look forward to turning these aspirations into tangible achievements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Welcome! And Thank You!
&lt;/h2&gt;

&lt;p&gt;In closing, I'd like to extend a warm welcome and heartfelt gratitude to each and every one of you who have made it this far into the blog post(lol). As a passionate game developer, I'm constantly seeking ways to improve and evolve, and it's your presence and support that make this journey all the more fulfilling.  I genuinely hope you will enjoy delving into my journey with me.&lt;/p&gt;

&lt;p&gt;Thank you! And good luck to all,&lt;br&gt;
Ioannis, The Semi-intermediate game developer(:D)&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>unity2d</category>
      <category>programming</category>
      <category>csharp</category>
    </item>
  </channel>
</rss>
