tech

Always Open Parathesis On Newline!

This post is my argument of preferring to open parathesis on a new line as opposed to putting in on the same line as a for or if statement.


Considering Hash Tables

For a while, I’ve been meaning to write some kind of a hash table from scratch for my own projects. Surprisingly for my game projects so far, I had totally avoided use of hashes and managed to optimise my problems to use simple dense arrays. The closest I came to using hash tables was when I wrote my profiler which identifies entries by hardcoded strings (which I could cheat by using their addresses instead but that’s another story).


JS API Design Thoughts

This is probably one of the wierdest things I had to wrap my head around Javascript recently. It’s a combination of how closures work, functions being first class objects and that you can add properties into objects.


Overlay Pixel Shader Transforms

This post is just to document for my own reference the math that went behind the transformations (scale, rotate, translate) of the overlay pixel shader I wrote for Reshade here. It turns out that it was a little more tricky than I initially expected.


Reflections on using Javascript in 2023

Recently, I have been writing quite a bit of Javascript for a couple of side-projects. I was a little inspired to attempt to write simple webapps without the use of any frameworks. One of them is avaliable here: FvF. This post is just some personal reflections going back to use vanilla Javascript/CSS in 2023.


Point on triangle algorithms

A game I’m working on requires me to check if a point is overlapped by a triangle. Being a dumb engineer who can’t come up wiith his own algorithm, google gave me 3 algorithms. Here I’m just going to share the algorithms and their performances.


C++ Flatten integer to 0/1

This is a quick trick to ‘flatten’ an integer into a 1 or 0. This is probably a trick that only works in C/C++ because of how the not (!) operator works with integers. While it’s usefulness is dubious in C++, it might be useful in C.


Going from Markdown to Asciidoc

Here I’ll pin down my thought process of changing my work’s documentations from Markdown to Asciidoc. I have been switching endlessly back and forth between them and it’s getting really annoying because I just want to do my work at some point. Hopefully after writing this, I will never look back until maybe 5 years later.


Excel INDEX/MATCH tl;dr

I was playing with Excel recently and for the hundredth time got stumped by how to use the INDEX/MATCH combo. For the hundredth time in the past years, I open the same damn website and the same damn explanation which took awhile because my brain actually needed to work to understand what’s going on.


Byte Alignment Notes

When dealing with raw memory directly, there might come the need to align your memory to the nearest of some power of 2.


Dirty C/C++

Here is a collection of cool snippets of C/C++ code. Updated regularly. Used to show superiority and implode the minds of my students. Also to use in my own code, of course, whenever viable.


Perspective Projection Matrix

I was searching around internet for a full derivation for the 3D Perspective Projection Matrix to apply to my handmade software renderer and I was surprised by how little information I could find about it. That prompted me to write this post, to document the derivation of the matrix, at least in my own eyes.


Circle to Finite Line Collision

Recently, I had to derive this particular collision detection algorithm for my bullet hell genre game. It’s an interesting algorithm that can be expanded to deal with the ‘moving circle vs static circle’ and ‘moving circle vs moving circle’ problems.


[C/C++] The 'Glue' Preprocessor Trick

Macro tricks are rare to find nowadays. Sometimes, I would code and know of a trick but had forgotten how to go about implementing it because they can look as arcane as Template Metaprogramming. Hopefully, I can document some of my knowledge of these tricks in this blog. Here, I will introduce what I call the ‘Glue’ macro trick.


A small shortcoming of return-by-value

Recently, while coding on my personal C/C++ game engine project, I ran into a surprising shortcoming of functions that returns an object by value. This was when I was still trying to keep things consistant in my project and went for a functional-programming style.