Pages

Monday, July 6, 2020

Building a game - the curiosity part

I’m really excited to be back to writing, been a tough time during corona, but learned a few things that I want to share.
One of the most interesting fields of programming is game development, I don’t have that much experience (actually I don’t have game development experience at all) to give that bold statement but I think creativity is at its peak when there is an imaginary story, and when you build “a whole new world” with code.
I was viewing my Twitter feed randomly as usual, until I found a tweet by Filip Hráček, that has a link to a game he’s developed, I played it and loved it so much, loved its simplicity and the reality, and its application of physics laws.

As an online surfer, I loved it, and as a programmer, I wished I can create things that have so much life in its movements on screen. But the problem is that I didn’t know where should I start! Thankfully, someone in the replies in that tweet mentioned a playlist that seemed to cover this topic, I started watching it right away, day after day. A week after, I was a big fan of Shiffman’s work already and his channel, he is a very talented teacher, funny and professional in his material, take a second to think how lucky we are to have all these combinations together available on the internet for free, what a time we are living, no really, with all bad things happening in the world, people like Shiffman give it a reason for hope. 
I watched almost all the videos on the playlist.
That sort of finding is invaluable, which you find hidden somewhere by mere accident (I mean the reply in Filip’s tweet), a lot of things I’ve learned that way, no prior planning, just pure desire of knowing something and learning it IMMEDIATELY. The material discussed in the playlist is exactly what I needed to build a game like Filip’s. I was still loving his game (as an online surfer) and playing it from time to time along with watching Shiffman’s videos, it gave me the needed fuel to continue learning.
After a period of time, I made some work with p5js- the JavaScript library used in Shiffman’s videos to apply physics of particles, it’s sometimes confusing to see what the channel is exactly teaching: is it tutorials on p5js library? or it’s physics and math tutorials applied with the help of p5js library?- actually, it’s both, and p5js is a really very good library to use for that purpose. At the end of the playlist, I had already made some work (as I mentioned when I was following Shiffman’s tutorials); one of them was about a square that can be pushed up under an upward force until it's left to the gravitational force down until its rest on the “floor”, with a nice natural bouncing effect (Euler's effect).

and another one was about balls moving around the screen in random directions and get redirected when they hit the edges of the canvas. I combined both ideas and made a game, named it Mates (play it to know why I chose that name 😁):
https://mshwf.github.io/mates

I’m excited I'm finally making a game that I myself can play and even enjoy it, though, it’s not the same level of complexity as Filip’s, but I’m satisfied with the result, I understood the math and physics concepts that one need to make that sort of games, and I can improve easily now (my curiosity is fine).

In the next post, I will discuss the collision algorithm I developed, which I think is interesting to talk about. Hope you enjoy it.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

How to do code reviews correctly

Introduction Code review is a special event in the life cycle of software development, it's where ownership is transferred from the deve...