Satisfying 2D Movement

I’m in the middle of working on my first mainline c++ project at school. We’re tasked with making a simple vertical spaceship shooter using c++ with SDL and some pre-made assets to form the game. At the moment, I’ve set up most of the classes I will need and have a simple ship that renders onto the screen. Naive Movement My first iteration of ship movement does have some forward thinking but allowing ship movement to continue by holding down keys....

October 13, 2023

Portrait Action Mobile Games

As I was looking for games to play during my bus rides, I realized the convenience of being able to play phone games one-handed, or just simply in portrait mode. It’s a lot more comfortable to hold, especially in tighter environments like a bus. There’s lot’s of options for this but they mostly amount to puzzle games and such. Instead, I wanted something more actiony and rpg-like I could play in that format....

October 11, 2023

C++ A Personal Guide

A compilation of various features and gotchas I’ve encountered while studying C++. Instantiating Object Member Variables When to Use Initializer Lists Intializer lists offer a secondary method of initializer member variables for a class. A question comes up of why would we use this method as opposed to initializing the variables on declaration of just in the constructor. Below are a few core purposes. Initialize Const Members You could initialize these on declaration but what if you we want to pass in their values as arguments to the constructor....

October 4, 2023

Pianotypes Devlog 5

Not many code changes as of late but I’ve been more active on one of the packages I’m using to play sound, smplr. It’s such an amazing package for playing instrument sounds with an incredibly simple and powerful api. Kudos to danigb. A bunch of new changes were made recently that have added some awesome features as well as some bugs I found while using them. Note Scheduling Throughput The first change was a tweak to note scheduling that fixes an issue of the web audio getting overloaded and introducing lot’s of static....

October 1, 2023

Habits and Goals and Gratitude

Having Goals I have goals and I like the fact that I do. It makes me feel like I have purpose, that I have some direction I need to follow. However, it often feels suffocating, demotivating, it makes me feel envious of others, it makes me feel that I’m unaccomplished or that I’m falling behind because of I haven’t done enough. These are the feelings of having goals. But how do you achieve goals....

September 28, 2023

Stack and Heap

Declaring Data Structures on the Heap https://stackoverflow.com/questions/8036474/when-vectors-are-allocated-do-they-use-memory-on-the-heap-or-the-stack vector<Type> vect; will allocate the vector, i.e. the header info, on the stack, but the elements on the free store (“heap”). vector<Type> *vect = new vector<Type>; allocates everything on the free store (except vect pointer, which is on the stack). vector<Type*> vect; will allocate the vector on the stack and a bunch of pointers on the free store, but where these point is determined by how you use them (you could point element 0 to the free store and element 1 to the stack, say)....

September 27, 2023

Useful Linear Algebra

Dot Product Find the interior angle between two vectors $$ A\cdot B = |A||B|cos\theta $$ $$ \theta = \arccos(\dfrac{A\cdot B}{|A||B|}) $$ $$ where\ A\cdot B = A_x \times A_y + B_x \times B_y $$ Cross Product Get perpendicular vector from two vectors Find area created by two vectors (for 2D, parallelogram area, for 3D, parallelepiped area) This is the magnitude of perpendicular vector Matrix Multiplication There is a formula for calculating the resultant matrix from a matrix multiplication....

September 25, 2023

Dot Product and How it Relates to Light

What Matters The dot product has a bunch of properties when you use it’s raw scalar output but honestly most of the times you will use the dot product is to find the angle between two vectors by rearranging to equation as follows $$ A\cdot B = |A||B|cos\theta $$ $$ \theta = \arccos(\dfrac{A\cdot B}{|A||B|}) $$ $$ where\ A\cdot B = A_x \times A_y + B_x \times B_y $$ In games, this equation is used exhaustively to calculate light projections and field of view....

September 14, 2023

Signed Ints and Two's Complement

Two’s Complement Representation Why We Use It In c++, signed integers are represented in two’s complement notation. Before I get to how that notation works, I want to explain why we use it. Comparing both representations, -1 would look like this // Decimal 4294967295 // Binary Signed Int 10000000000000000000000000000001 // Two's Complement Signed Int 11111111111111111111111111111111 The normal signed binary representation is pretty easily understood if you know what a sign bit is....

September 12, 2023

PGDAP Log 2

I’m on my second week and to my surprise, all my anxieties and insecurities subsided really quickly. It had been while since I’ve had a proper schedule or talk to people in person on a frequent basis but I’m glad at how smoothly I’ve been able to reacclimate and I’ve been feeling a lot happier as a result. Anyways so far, it’s just been a lot of intro talk and fundamentals of concepts I’ve already learned before....

September 12, 2023