moofy.org
https://moofy.org/</link>
Wed, 06 Aug 2025 19:39:22 +0000Wed, 06 Aug 2025 19:39:22 +0000Jekyll v3.10.0Douglas Rushkoff's Cyberia: Objectivity and Reality in the Virtual Age<p>I recently finished <em>Cyberia</em> by Douglass Rushkoff, and in it, Rushkoff discusses the paradigm shift of the supposed grounded, objective reality essentially losing its footing as humanity begins its exploration into digital consciousness, as virtual space acts as an entirely unique dimension to the one in which we presently inhabit. As such, it operates on entirely different rules. It is as though laws of natural sciences like Physics are of little importance in a digital ecosystem and more abstract, philosopical or sociological ideologies such as metaphysics, abstract mathematics, and religious or spiritual ideas have a heightened applicability. We can most directly feel such a change from its parallel in the shift from an industrial society, marked by technological dominance in the forms of physical engineering, to an information age, marked by technological dominance in the form of largely ideological technology.</p>
<p>From this, Rushkoff’s <em>Cyberia</em>, then, poses some incredible questions, most importantly “Where is this new technology going to take us?” and “How objective is objectivity?” First and foremost, the former question is so pivotal to understanding just how important the virtual age is, and as it is such a complex question to tackle, I won’t go into it. (Rushkoff’s <em>Cyberia</em> spends its length chiefly concerned with finding its answer, so I recommend reading the book to examine that.) Rather, I’m much more interested in the latter question: “How objective is objectivity?,” or, in other words, “How do we define reality?”</p>
<p>So, I start by thinking of our definition of objective reality based on our senses, but similarly, we know that biologically, our senses have to work off of approximations of reality (such as reasonably having a discrete rate at which information is processed, so, for example, time is approximated as continuous in the brain from discrete measurements), so we know that our senses are not as good of a barometer for understanding the underlying nature of reality. Instead, our senses are not much more than exactly what they are: a system for perceiving the working reality necessary to live our lives effectively. What this means isn’t necessarily that what we perceive physically isn’t the “true reality,” but rather, that what we perceive is not guaranteed to be the “true reality,” and this “true reality” may be something beyond our physical or biological perception.</p>
<p>Furthermore, I think that this is just indicative of the failures of perceiving the world as a human being. Another interesting point that <em>Cyberia</em> brings up is on viewing the world under the context of ego (in particular, <em>Cyberia</em> was interested in how the use of psychedelics broke free from this context). Many things that we take as axioms for how the world works, like gender roles, physical perception (like hearing sounds and seeing colors), identity, etc. fall apart when the ego is removed, and the destruction of these axioms ripples out in a fractal-like manner (as the book describes it, where fractals in Chaos theory are uber-sensitive to initial conditions and recursive such that these changes persist and grow over each recursion) to affect all kinds of great conclusions about how we perceive the world.</p>
<p>I think, in an odd way, this is why I would like to see the world from the perspective of a dog.</p>
<p><em>Note: This post is currently unfinished for some reason. Check back in later to see if I ever ended up coming around to finishing it!</em></p>
Sun, 03 Aug 2025 22:55:55 +0000
https://moofy.org/posts/objectivity-and-reality/</link>
https://moofy.org/posts/objectivity-and-reality/philosophyessayOn Indecision and Feeling Lost<p>I’ve been asking myself recently, “How can you give the world to someone who doesn’t have a clue what they want?” I often get daydreams of becoming unfathomably wealthy and spoiling my friends, taking away all of their financial needs and then some, and leaving them all completely without want. Sure, you can do direct material things, like paying debts or settling all of their financial worries.</p>
<p>However, although I could seemingly purchase security, true happiness is the result of far more than just security. To be happy, I think people need security, fulfillment, and purpose, at the very least. Most people seem to manage to get only one of those things at best, let alone getting all three. For this reason, money doesn’t buy happiness. It only covers a third of the puzzle. Even with all of the money in the world, there could seemingly be nothing I could do to make someone with no idea of what it is that they want out of being alive happy. I think, in this way, a lot of people are unhappy. Not only is it bad enough to locate financial security in our highly financially inequitable society while simultaneously increasingly difficult to form healthy social connections necessary for fulfillment in this increasingly-online world, but also, even if both facets of your life are completed, lacking a strong purpose will always leave you empty.</p>
<p>However, I empathize with those that are lost or indecisive. For many, I don’t think its an issue of indecision per se, but moreso, an issue of perspective. For many people, the reason why they feel lost isn’t an abundance of possible paths to take, but rather, a feeling of being stuck with no paths. What horrifies me, though, is that this feeling of being “stuck” is by no means an objective reality for many people. In simpler terms, being “stuck” is more a state of mind than it is an actual state of being. Many people feel “stuck” from incredibly young ages, such as six or seven. Most start to really feel “stuck” upon graduating high school. This age, this terrible, terrible age, of eighteen to our mid-twenties is like feeling the cold-turkey withdrawals after being forcefully drugged-up throughout the schooling system, with every decision made for you and the development of skills of independence and self-determination intentionally avoided, and then subsequently told to leave immediately on graduation with no direction or purpose.</p>
<p>Naturally, most people, then, just do whatever their peers choose or whatever the authorities in their life tell them to do. It only makes sense: following along is the only thing they’ve known up until that point, and this gullibility and desperation for orders makes us so susceptible to being quickly exploited for all manner of things. Many people turn to higher education simply because it’s just the thing to do, but without any real understanding of why they’re there, and they often take out hefty loans for such degrees that they know they have no interest in using beyond getting a job. Alternatively, many people join the military, signing on to multi-year contracts of militarial slavery in a kind of indentured servitude to the military-industrial complex on the false promise that joining the armed forces will supply you with a purpose in life. I suppose this is a topic for a post on its own, but its entirely ludicrous to think that the military, especialy active combat, will supply you with anything other than lifelong injuries, both physical and mental.</p>
<p>So, then, where do you go? What are you supposed to do? At the age of eighteen, on the precipice of adulthood, how does anybody know where to go or what to do? How is it that everybody but you seems to know exactly what to do with their lives?</p>
<p>Well, for you, dear reader, I don’t have the answer to that question. I don’t have the answer to that question myself. What I do know, however, is that there is a fundamental problem with the assumption that everyone else seem to “have it together” or that other people even can tell you what you “should” be doing at your age, and this is because I don’t believe anyone, at any age, really consciously knows what it is they “should” be doing. I think it’s a big assumption to assume that anybody in the world really truly knows what they are doing, because it is entirely not necessary for anybody to know what they are doing to live happy, fulfilling lives as individuals or for society at large to function. Politicians and self-help coaches and religious leaders and such will parade around as though they have these answers, but just like with the <a href="https://moofy.org/posts/nightmare-of-interconnection">nightmare of interconnection</a>, perhaps nobody is “at the wheel of this bus.” On an individual scale, at least, someone at the wheel might not be necessary. As long as the bus is going somewhere without crashing, then unlike at a societal level, it’s okay. I think we’re all just figuring things out as we go along. Everyone is playing being alive by ear. I mean, unless you believe in reincarnation, this is everyone’s first times on this Earth. We’re all virgins to life and death.</p>
Sat, 02 Aug 2025 21:21:31 +0000
https://moofy.org/posts/giving-the-world-for-what/</link>
https://moofy.org/posts/giving-the-world-for-what/philosophyessayKafkaesque and Catch-22's: Bureaucracy, Drugs, Universities, Networking, and Corporations<p>Hell is on earth, and it’s a waiting room, a line, a series of multicolored files and lengthy emails, weekly zoom meetings, LinkedIn posts, shareholder conferences, university applications, keynote speeches, and god-knows how much other representations of institutional red tape. In such a hell, by the <a href="https://moofy.org/posts/nightmare-of-interconnection">“Nightmare of Interconnection”</a>, all beings within it can be said to be simultaneously its victims and its demons, and the devil at the head of it all isn’t any particular individual, but rather, the system itself.</p>
<p>Of Kafka’s three major works, <em>The Metamorphosis, The Trial,</em> and <em>The Castle</em>, I’ve only read the two former works. In particular, in <em>The Trial</em>, Franz Kafka displays the grotesque, demonic face of the needlessly bureaucratic system in such a way that every member of “civilized” society knows all too well. We’ve constructed a system of of over-organization, one that prioritizes a working order of rules and regulations so much that the the welfare of individuals is considered last, and ironically, such a system becomes so organized that its effectively something of a lawless, unempathetic mess in its final effect.</p>
<p>For example, we write laws with the intent of providing an orderly system of morality and punishment under society, and seemingly, the more rigid laws are written, the more the order is enforced. The more absolute and unchangeable a law is, the easier it is to enforce (and intrinsically, the more fair it becomes). The issue, however, is that just like physical rigidity or hardness of objects, the more rigid a law is, the cleaner it shall break. Loopholes in rigid laws are considerably more exploitable than laws which are flexible and open to interpretation, and although one could argue that flexible laws are easier to produce loopholes for (due to being open to interpretation), again, their flexible nature makes combatting these loopholes similarly simple through exploring other interpretations.</p>
<p>What a rigid society produces is an over-emphasis on rules and order with a lack of interest in the wellbeing of individuals and a fragility in the social order due to being largely unable to change with the course of humanity and thus much quicker to break. What comes immediately to mind is the legislation produced about recreational drugs. Legislation regarding drug use (that being, wide-sweeping bans with immense penalties for illegal distribution or usage) has historically had little to do with the supposed or fronted reasons of promoting social welfare. Rather, it’s far more been a tool for systematically oppressing groups that are the most susceptible to drug use. Controlled substances have been popular in human society from our initial civilizations, especially those like alcohol and medicinal herbs, and despite this, the rhetoric concerning drug use is largely conflicting. The state emphasizes an avoidance of drugs of all kind yet many fail to see the similarities between a drug like alcohol to drugs like Marijuana or psychedelics like psilocybin (magic mushrooms).</p>
<p>Regardless of the negative effects of such drugs, much of which has been studied relentlessly due to this long debate over the decriminalization or legalization of such drugs, we know from history (such as the effects of the prohibition) that wide-sweeping, rigid bans are not in the true interest of social welfare whatsoever. If we truly wanted to aid the population in avoiding addictance to these drugs and lowering deaths due to overdose or poison (from misuse), then the public must be educated about the full range of the effects of drugs alongside the proper, safe consumption of these drugs, and the entirety of the production and distribution system of such drugs must also be made into a legalized process such that the industry can be regulated. It is a fundamental fact of free-market capitalism that where there is a demand, there shall be someone that will look to meet it with a supply. The question thereby lies in the hands of the government: would they rather that someone be somebody above-board that they can control, or somebody unscrupulous whose success entirely depends on evading your control as much as possible?</p>
<p>Furthermore, we engage in the kafkaesque in all manners of society: especially the pipeline of education to the working, corporate world. Due to the capitalism underlying everything in education, much of the education system feels like a peacock show more than its actually about scholarship. For example, scientists are only really scholars as a part-time job. First and foremost, they are salesmen. The success of a researcher, especially in STEM, is largely based on their ability to sell their research to investors (grant funding organizations, such as corporations). Similarly, the success of a student is based on their ability to sell themselves to investors of other kinds, such as the universities, scholarships, or professors they apply to. Universities see the students they admit like investments, with the most likely candidates for admission being those who the university sees as the most likely to be a valuable relationship to have years after graduation. In turn, we see the effect of the children of the uber-wealthy or heads of state being disproportionately admitted to elite universities, but who can blame the colleges? Each admit is something of a gamble to the university, and an already wealthy or well-connected student is a far safer bet for how much the university can profit off of the student later down the line.</p>
<p>Furthermore, the entirety of the topic of networking is such an absurd system from the outside looking in. Many people justify the intense desire to enter elite universities by stating that top universities act as aggregators for the sharpest minds around, and as such, the appeal of a top university is the ability to network with the most powerful leaders-to-be. As James Bryant Conant once stated, <em>“A Harvard education consists of what you learn at Harvard while you are not studying.”</em></p>
<p>The issue I see with the mentality behind networking is that it views social interaction in such a performative and lain manner. The networking mentality reduces people down into tools for hierarchical advancement, and the irony of advancing in capitalism fundamentally boils down to the idea that you can have anything when you fundamentally don’t need it, and with regards to networking or college applications, any college will quickly accept you and any person will swiftly try to connect with you if they see that their connection with you will allow them to gain something. The irony, therefore, is that the peoplpe that can make the most use out of a university education or a professional connection are those who cannot access it. It’s something of a Catch-22. You need clout or appeal to attract the relationships and positions that will garner you clout. For example, consider job experience. The age-old lamentation is <em>“You need job experience to get a job, but the only way to get job experience is to get a job.”</em> Catch-22, QED.</p>
<p>Our world is red tape and contradictions, rules and operations that make sense at individual levels but come together to produce a whole system that is woefully out-of-order. And what is to remedy it? Burning it down? Is anarchism the answer? Perhaps a return to some idealistic traditional society? In my opinion, probably not, and also due to the nightmare of interconnection. Such problems are probably more intrinsic to humanity than simple the result of the systems we have at hand. However, in all, I don’t know. I just don’t know.</p>
Sat, 02 Aug 2025 15:45:02 +0000
https://moofy.org/posts/kafkaesque-bureaucracy/</link>
https://moofy.org/posts/kafkaesque-bureaucracy/societypoliticalessayThe Subconscious Nature of Art<p>If you study 10,000 different selected artworks over the span of your life, then you’re bound to end up learning an immense amount about art, but if you study only one artwork over that same time person, then you’ll learn an immeasurable amount about yourself. If you stare at anything long enough, regardless of the surface or composition, you’ll find that whatever you’re looking at will, in time, become a mirror. All you’ll see reflecting back is yourself.</p>
<p>The irony, of course, is that all art really is, at all times, just mirrors to ourselves. Works of art only seem to be the most subjective and general when they’re the freshest in the mind, but the longer you study the same thing, the more the cracks of interpretation begin to show, and the more freedom of interpretation can be placed on an artwork, the more the artwork begins to reflect the viewer.</p>
<p>I often wonder, then, about the discussion of separating art and artists. Where is a line to be drawn? How much of art is a reflection of its creator, and how much of art, in terms of its interpretation, are a reflection of the audience? I find it hard to reconcile, because I’m split: I understand both sides to the debate. I empathize with those that state that the art and the artist are inherently inseperable, as after all, good art is made as an expression of the self. It’s like Lord Henry states in Oscar Wilde’s <em>The Picture of Dorian Gray</em>:</p>
<p><span class="quote">“Good artists simply exist in what they make, and consequently are perfectly uninteresting in what they are. A great poet, a really great poet, is the most unpoetical of all creatures. But inferior poets are absolutely fascinating.”</span></p>
<p>The only way that I can somewhat manage to reconcile this is by reframing how I view the relationship between an artist and their creations. Rather than seeing it as though the artist affects the nature of their art, the art one creates affects the nature of the artist (at least, considerably more than the opposite). Take the nasty creation of <em>Mein Kampf</em> by Adolf Hitler. I feel as though Hitler’s status speaks less to the state of Mein Kampf as being a particularly evil book as compared to the Mein Kampf taken as-is, with an objective understanding of its hateful rhetoric, proving Hitler’s status as a demagogue. In other words, Mein Kampf speaks to the interpretation of Hitler’s character less than Hitler speaks to the interpretation of Mein Kampf’s character.</p>
<p>However, of course, the reality is that the two things, taken as something like seperate beings, affect each other. Hitler is present in Mein Kampf just as Mein Kampf is present in Hitler. They are connected, but this dynamic is not an equal relationship. Thus why this is the best I have been able to do to solve this problem, because its easy to simplify the relationship between an artist and their art, but the reality is that the power of art comes from the complexity in this relationship. The art you create can have as much power over you as you have over it.</p>
<p>Similarly, I often wonder about how much control artists have over the state and interpretation of their works. Personally, I’m a firm believer of “death of the author.” I see art is something like a living thing, where each artwork has a voice and personality and convictions of their own, things that are entirely seperate and perhaps unbeknownst to its creator. From the moment the work is published, the artist provides an interpretation of the work just as much as the audience does. Art is immutable: at all times, art cannot actually be changed. Every step of the creation of art, even in formulation before physical development, sees the production of an entirely unique piece of art to whatever step preceded it. As such, recalls, post-production changes, and the like cannot change or fix the art that exists, it simply introduces a new piece to replace the old one.</p>
<p>I think art is a fleeting, living thing. The best explanation I can give for this, metaphysically, is by challenging the notion we have of how we perceive things (like events and people) to be true or objective. One of the questions science still has yet to answer in any satisfactory sense is what information actually is. We know how to represent information, and we have an understanding that our senses perceive the truth, but we don’t quite know what the truth is. We know that our senses don’t actually perceive the truth, they perceive <em>our</em> truth, such as how our eyes view microscopic predictions of time to account for the lag in processing to the brain. We also perceive the world as continuous, both in time and space, but in terms of space, we know that the world is actually atomic (or discrete). If we have been able to prove our sense of the world as continuous wrong, how could time not be as well?</p>
<p>With all of this background, I think that art is like a living information (and something like an ethereal being), always in existence yet choosing when to reveal itself first an artist to be translated into a form we can understand. The author must be intellectually poised in such a way that they can find the art in its ethereal plane to translate it down to us, and in that transcription, the art and the artist get mixed together. However, the fundamental principles of the art always existed, and more importantly, the full extent of the artwork is something beyond the understanding of even the artist, let alone the audience. It’s something subconscious, not literal. Art isn’t one truth, it’s the conglomerate of all of the truths that are interpreted by all of the people that perceive the art.</p>
Sat, 02 Aug 2025 00:10:11 +0000
https://moofy.org/posts/nature-of-art/</link>
https://moofy.org/posts/nature-of-art/philosophyessayMy Trip to New England
<div class="carousel__holder">
<div id="carousel0" class="carousel">
<input class="carousel__activator" type="radio" name="carousel0" id="0a" checked="checked" />
<input class="carousel__activator" type="radio" name="carousel0" id="0b" />
<input class="carousel__activator" type="radio" name="carousel0" id="0c" />
<input class="carousel__activator" type="radio" name="carousel0" id="0d" />
<div class="carousel__controls">
<label class="carousel__control carousel__control--backward" for="0d"></label>
<label class="carousel__control carousel__control--forward" for="0b"></label>
</div>
<div class="carousel__controls">
<label class="carousel__control carousel__control--backward" for="0a"></label>
<label class="carousel__control carousel__control--forward" for="0c"></label>
</div>
<div class="carousel__controls">
<label class="carousel__control carousel__control--backward" for="0b"></label>
<label class="carousel__control carousel__control--forward" for="0d"></label>
</div>
<div class="carousel__controls">
<label class="carousel__control carousel__control--backward" for="0c"></label>
<label class="carousel__control carousel__control--forward" for="0a"></label>
</div>
<div class="carousel__track">
<ul>
<li class="carousel__slide" style="background-image: url('images/new-england-trip/boston/harvard-mit/harvard-1.JPG');"></li>
<li class="carousel__slide" style="background-image: url('images/new-england-trip/boston/harvard-mit/harvard-2.JPG');"></li>
<li class="carousel__slide" style="background-image: url('images/new-england-trip/boston/harvard-mit/harvard-3.JPG');"></li>
<li class="carousel__slide" style="background-image: url('images/new-england-trip/boston/harvard-mit/harvard-4.JPG');"></li>
</ul>
</div>
<div class="carousel__indicators">
<label class="carousel__indicator" for="0a"></label>
<label class="carousel__indicator" for="0b"></label>
<label class="carousel__indicator" for="0c"></label>
<label class="carousel__indicator" for="0d"></label>
</div>
</div>
</div>
<style>
.carousel__holder {
width: 100%;
position: relative;
padding-bottom: 50%;
margin: 1rem 0 1rem;
display: flex;
justify-content: center;
}
.carousel {
border: 1px dashed var(--separator);
border-radius: 3px;
height: 100%;
width: 80%;
overflow: hidden;
text-align: center;
position: absolute;
padding: 8px;
}
.carousel__controls,
.carousel__activator {
display: none;
}
.carousel__activator:nth-of-type(1):checked ~ .carousel__track {
-webkit-transform: translateX(-000%);
transform: translateX(-000%);
}
.carousel__activator:nth-of-type(1):checked ~ .carousel__slide:nth-of-type(1) {
transition: opacity 0.5s, -webkit-transform 0.5s;
transition: opacity 0.5s, transform 0.5s;
transition: opacity 0.5s, transform 0.5s, -webkit-transform 0.5s;
top: 0;
left: 0;
right: 0;
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
.carousel__activator:nth-of-type(1):checked ~ .carousel__controls:nth-of-type(1) {
display: block;
opacity: 1;
}
.carousel__activator:nth-of-type(1):checked ~ .carousel__indicators .carousel__indicator:nth-of-type(1) {
opacity: 1;
}
.carousel__activator:nth-of-type(2):checked ~ .carousel__track {
-webkit-transform: translateX(-100%);
transform: translateX(-100%);
}
.carousel__activator:nth-of-type(2):checked ~ .carousel__slide:nth-of-type(2) {
transition: opacity 0.5s, -webkit-transform 0.5s;
transition: opacity 0.5s, transform 0.5s;
transition: opacity 0.5s, transform 0.5s, -webkit-transform 0.5s;
top: 0;
left: 0;
right: 0;
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
.carousel__activator:nth-of-type(2):checked ~ .carousel__controls:nth-of-type(2) {
display: block;
opacity: 1;
}
.carousel__activator:nth-of-type(2):checked ~ .carousel__indicators .carousel__indicator:nth-of-type(2) {
opacity: 1;
}
.carousel__activator:nth-of-type(3):checked ~ .carousel__track {
-webkit-transform: translateX(-200%);
transform: translateX(-200%);
}
.carousel__activator:nth-of-type(3):checked ~ .carousel__slide:nth-of-type(3) {
transition: opacity 0.5s, -webkit-transform 0.5s;
transition: opacity 0.5s, transform 0.5s;
transition: opacity 0.5s, transform 0.5s, -webkit-transform 0.5s;
top: 0;
left: 0;
right: 0;
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
.carousel__activator:nth-of-type(3):checked ~ .carousel__controls:nth-of-type(3) {
display: block;
opacity: 1;
}
.carousel__activator:nth-of-type(3):checked ~ .carousel__indicators .carousel__indicator:nth-of-type(3) {
opacity: 1;
}
.carousel__activator:nth-of-type(4):checked ~ .carousel__track {
-webkit-transform: translateX(-300%);
transform: translateX(-300%);
}
.carousel__activator:nth-of-type(4):checked ~ .carousel__slide:nth-of-type(4) {
transition: opacity 0.5s, -webkit-transform 0.5s;
transition: opacity 0.5s, transform 0.5s;
transition: opacity 0.5s, transform 0.5s, -webkit-transform 0.5s;
top: 0;
left: 0;
right: 0;
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
.carousel__activator:nth-of-type(4):checked ~ .carousel__controls:nth-of-type(4) {
display: block;
opacity: 1;
}
.carousel__activator:nth-of-type(4):checked ~ .carousel__indicators .carousel__indicator:nth-of-type(4) {
opacity: 1;
}
.carousel__control {
height: 30px;
width: 30px;
margin-top: -15px;
top: 50%;
position: absolute;
display: block;
cursor: pointer;
border-width: 5px 5px 0 0;
border-style: solid;
border-color: #fafafa;
opacity: 0.35;
opacity: 1;
outline: 0;
z-index: 3;
}
.carousel__control:hover {
opacity: 1;
}
.carousel__control--backward {
left: 20px;
-webkit-transform: rotate(-135deg);
transform: rotate(-135deg);
}
.carousel__control--forward {
right: 20px;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.carousel__indicators {
position: absolute;
bottom: 20px;
width: 100%;
text-align: center;
}
.carousel__indicator {
height: 15px;
width: 15px;
border-radius: 100%;
display: inline-block;
z-index: 2;
cursor: pointer;
opacity: 0.35;
margin: 0 2.5px 0 2.5px;
}
.carousel__indicator:hover {
opacity: 0.75;
}
.carousel__track {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
padding: 0;
margin: 0;
transition: -webkit-transform 0.5s ease 0s;
transition: transform 0.5s ease 0s;
transition: transform 0.5s ease 0s, -webkit-transform 0.5s ease 0s;
}
.carousel__track .carousel__slide {
display: block;
top: 0;
left: 0;
right: 0;
opacity: 1;
}
.carousel__track .carousel__slide:nth-of-type(1) {
-webkit-transform: translateX(000%);
transform: translateX(000%);
}
.carousel__track .carousel__slide:nth-of-type(2) {
-webkit-transform: translateX(100%);
transform: translateX(100%);
}
.carousel__track .carousel__slide:nth-of-type(3) {
-webkit-transform: translateX(200%);
transform: translateX(200%);
}
.carousel__track .carousel__slide:nth-of-type(4) {
-webkit-transform: translateX(300%);
transform: translateX(300%);
}
.carousel--scale .carousel__slide {
-webkit-transform: scale(0);
transform: scale(0);
}
.carousel__slide {
height: 100%;
position: absolute;
opacity: 0;
overflow: hidden;
}
.carousel__slide .overlay {height: 100%;}
.carousel--thumb .carousel__indicator {
height: 30px;
width: 30px;
}
.carousel__indicator {
background-color: #fafafa;
}
.carousel__slide:nth-of-type(1),
.carousel--thumb .carousel__indicators .carousel__indicator:nth-of-type(1) {
background-size: cover;
background-position: center;
}
.carousel__slide:nth-of-type(2),
.carousel--thumb .carousel__indicators .carousel__indicator:nth-of-type(2) {
background-size: cover;
background-position: center;
}
.carousel__slide:nth-of-type(3),
.carousel--thumb .carousel__indicators .carousel__indicator:nth-of-type(3) {
background-size: cover;
background-position: center;
}
.carousel__slide:nth-of-type(4),
.carousel--thumb .carousel__indicators .carousel__indicator:nth-of-type(4) {
background-size: cover;
background-position: center;
}
</style>
<script>
function isVisible(el) {
while (el) {
if (el === document) {
return true;
}
var $style = window.getComputedStyle(el, null);
if (!el) {
return false;
} else if (!$style) {
return false;
} else if ($style.display === 'none') {
return false;
} else if ($style.visibility === 'hidden') {
return false;
} else if (+$style.opacity === 0) {
return false;
} else if (($style.display === 'block' || $style.display === 'inline-block') &&
$style.height === '0px' && $style.overflow === 'hidden') {
return false;
} else {
return $style.position === 'fixed' || isVisible(el.parentNode);
}
}
}
setInterval(function(){
var j=0;
var elements = document.querySelectorAll('#carousel0 .carousel__control--forward');
for(i=(elements.length - 1);i>-1;i--) {
if(isVisible(elements[i])) j=i;
}
elements[j].click();
},7000);
</script>
Fri, 01 Aug 2025 13:22:17 +0000
https://moofy.org/posts/new-england-trip/</link>
https://moofy.org/posts/new-england-trip/photographyin-progresspersonalThe Nightmare of Interconnection<p>The nightmare of interconnection is simple: it’s the extension of the perils of individual connections extended to scale of entire networks of conjoined masses. It’s the ripple effect of the transfer of information and ideas from one person to another, the basket of negative effects that continuously seems to arise time and time again both to and from the torment of the masses involved. The nightmare of interconnection, as I choose to refer to it, is something like the underlying beast in systems of people: mob mentality, herd culture, gossip, tyranny of the majority, and so on.</p>
<p>It certainly feels like much of the anti-central establishment ideology and conspiracy theories around shadowy organizations designed to control the masses ever-so-slightly miss the mark of the truth, as the true horror of this nightmare is that individuals are never truly in control or free. Rather, it’s the hidden, invisible beast of interconnection that dominates absolutely everything, and those who hold any power simply find tricky ways to influence the beast’s actions.</p>
<p>I understand that this may come across as an overcomplicated definition or overly-dramatic description of the problems that can arise from people in mass-networks acting as herds, as countless people have studied its patterns and effects throughout history (look no further than the rise of the Nazis, it’s puzzled sociologists for decades just how good-natured Germans could be driven to believe in such racist and vile ideas), but I have chosen to represent it as something like a hidden beast intentionally. It’s the rawest form of humanity: our collective subconscious ideas and desires, and our formation of organized, hierarchical, worker-bee society has sharpened the fangs of the beast as it grew in power alongside the growth of organized civilization itself.</p>
<p>And now, we find ourselves at firmly settled into a new era, one with rapid interconnection of fiber-optic speed. At all times, all peoples connected to the internet are connected to each other, and with this, we connect with far more than merely just our thoughts, jokes, purchases, and the like. We connect our identities, our desires, and <a href="https://moofy.org/posts/cosmetics-and-appearances/">our insecurities</a>.</p>
<p>The more we interconnect, the more we lose our sense of self. We become another face in the mob, another like or comment in a sea. And who, just who, is truly in charge? Many point to those who profiteer, the businessmen and polticians that hold the power to influence the actions of the mob, to push advertisements to affect the desires and convictions of the masses to get them to purchase their products or serve in their militaries or otherwise subscribe to their ideals.</p>
<p>However, these people are no more capable of controlling of the collective subconscious than a sailor can control the sea. The nightmare of interconnection, the terrors from the collective subconscious, can be studied, affected, manipulated, and finally exploited in much the way the ocean has for thousands of years, but despite the immense impact humanity has had on the ocean, we still hardly have anything even remotely close to a sense of control over it. The irony of attempts to control the societal subconscious in any form is that any affectation given to it is simultaneously an affectation given to the self. All people within it, meaning all humans, are affected by it through history (as all events, too, are connected). It’s like Milo Minderbinder’s syndicate in Joseph Heller’s <em>Catch-22</em>: “Everybody gets a share.”</p>
<p>To provide some examples, look at autocratic states run by ideologies of distrust or hate. Those spewing the hate, stoking the passionate fire of a desire for purge or blood within the subconscious of the nation’s constituents, can often have that same hate turned right back towards them. Look how quickly Soviet Russia post-revolution could turn against its founders. Lenin was hailed more as an idea than a man, and Trotsky was driven right out of the country only to be later brutally murdered. Look at stories like the assassination of Malcolm X by his own muslims, a betrayal not too unlike the historic assassination of Julius Caesar.</p>
<p>The ideologies or systems these men fight to create become their own worst enemy. Stalin himself was notoriously paranoid of assassination from his closest comrades, fearing that what he had done unto his comrades would be done unto him, leading to the great purge of Soviet Russia where many innocent people were sent to gulags and brutally murdered. Really, it cannot be that Stalin was truly in charge, for he had a master of his own he had to do all in his power to appease throughout his rule. The true kingpin of the USSR was not Joseph Stalin, but rather, it was the all-consuming Bolshevik-turned-Stalinist ideology that was primed to exact its terror on Stalin himself in its quest for constant blood and exact ideological purity, and the only way Stalin could keep its hunger sated to prolong his downfall was to keep maintaining a masquerade of control for as long as he could.</p>
<p>And just think, this behavior of a great fear of the system one has built (a system comprised of fear-based rule) is not the exception for these autocrats (or any leader whatsoever), rather, it’s generally the rule. Presidents fear that their constituents will believe that they have betrayed the ideologies that sworn them in, and all representatives are constantly acting such that they can safely secure re-election.</p>
<p>So, then, I ask again: are these people really in charge? Are individuals, even top executive chairmen of international corporations or political heads-of-state, really to be considered as “running things” as there are? <em>Is anyone, anybody at all, actually at the wheel of this bus?</em> It seems so easy to come up with such daydreams of hidden syndicates of unscrupulous, expensive-suited men deciding the world order between coffee-breaks, but I believe the true entity in charge of the state of the world’s affairs is much, much more of an uncontrollable, unpredictable nightmare.</p>
Thu, 31 Jul 2025 17:12:20 +0000
https://moofy.org/posts/nightmare-of-interconnection/</link>
https://moofy.org/posts/nightmare-of-interconnection/societyphilosophyessayOn Cosmetics and Appearances: Analyzing the Hierarchy of Looks<p><img src="/images/posts/creation-of-adam.jpeg" alt="The Creation of Adam by Michelangelo" /></p>
<p><em>The desire of humanity to reach godliness has always been prevalent. (“The Creation of Adam” by Michelangelo)</em></p>
<p>We live in an age of the Brazillian Butt Lift (BBL), rhinoplasties, BOTOX, leg lifts, breast implants, limb lengthening, cortisol face, looksmaxxing, negative canthal tilt, prey eyes, mewing, lip filler, steroids, facial symmetry, “mewtwo builds”, and much, much more supposed failures of the body present to keep us from the angelic, perfect beauty we so gracefully deserve alongside the many treatments, ointments, procedures and otherwise body modifications we buy, buy, buy in vast excess to supposedly fix them.</p>
<p>This desire to be perfect is not new, by any means. Humanity has held an insatiable desire for overwhelming beauty for as long as we have been around, as after all, we humans are inherently attracted to all things beautiful. As such, why would beauty of our own not be the greatest beauty of all, the strongest of which for us to seek. It’s natural to assume the overarching goal of every individuals life as the pursuit of their happiness, and subsequently, it’s natural to see the pursuit of beauty as a facet of the pursuit of this happiness.</p>
<p><img src="/images/posts/american-psycho-looksmaxx.jpg" alt="American Psycho Looksmaxxing" /></p>
<p><em>Paterick Bateman from American Psycho’s Daily Routine to “Fit In.”</em></p>
<p>And it’s no secret as to why it’s so prevalent today as opposed to even as little as a decade ago. Momma was right, it’s that damn phone, <em>sort of</em>. Social media and instantaneous digital connection has produced a new and world-changing system wherein everyone has the ability to observe the cherrypicked highlights and greatest features of the lives of others, especially celebrities and major personalities, and in the rise of this system of easy and instantaneous observation of only the best qualities of others, we’ve naturally seen a rise in a culture of constant comparison leading to rampant feelings of inadequacy.</p>
<p><img src="/images/posts/social-network.jpg" alt="Social Interconnection Graph" /></p>
<p><em>Source: “Structure–Attribute Social Network Graph Data Publishing Satisfying Differential Privacy” by Zhou et. al</em></p>
<p>We are constantly watching each other, and in particular, we’re watching how we measure up. The online world is something of a massively-multiplayer dick-measuring contest, the kind of which everybody loses, and the main source of fuel being thrown onto this fire is the usual suspect: the immense amount of profit generated off of these issues. The female beauty industry is the greatest example of this, as a multi-billion dollar industry [1] that is notorious for its ability to invent profit off of the insecurities of women by both advertising the look of the ideal woman while simultaneously selling the solution.</p>
<p><img src="/images/posts/nice-jeans.jpg" alt=""Sydney Sweeney Has Great Jeans" American Eagle Ad" /></p>
<p><em>A recent, highly controversial advertisement of Sydney Sweeney with American Eagle, stating that she has “great jeans” as an advertisement for some jeans.</em></p>
<p>If you want to look to even the most recent day, look no further than this recent, uber-controversial advertisement of Sydney Sweeney, a famous actor and sex symbol hailed as an incredibly attractive woman, wherein it states that she has “great jeans” (a nod to “great genes” as in biological/genetic composition).</p>
<div class="video-container">
<iframe src="https://www.youtube.com/embed/YzVYyDehMUY" frameborder="0" allowfullscreen=""></iframe>
</div>
<p>Hell, even further, certain video versions of the advertisement have a major focus on Sweeney’s blue eyes (supposedly to match with the blue denim), and this undoubtedly seems like an even further nod to her white skin and blonde hair, all beauty standards pushed by Nazi ideology for the ideal, highest-class Aryan peoples. Now just think, this advertisement clearly promoting the historically fucked-up mindset of Nazi eugenics, which contains in itself a notoriously exclusive (and largely unrealistic and unscientific) beauty standard, is being promoted to millions of people worldwide, particularly young, impresisonable audiences, disseminated through all kinds of new-age digital means: television, instagram reels, spotify advertisements, public megascreens, and so on. I even managed to get a picture of it being displayed right out in the middle of Times Square about two days ago:</p>
<p><img src="/images/posts/sydney-sweeney-nyc.JPG" alt="Sydney Sweeney in NYC" /></p>
<p>People everywhere, including any person with so much as a minor connection to the wider world in the form of the internet, are being fed messages of their inadequacy constantly, from music to advertisements to television to social media posts, and so on, and it’s all because of the immense amount of money to be made in selling solutions to these manufactured problems.</p>
<p>Repeat after me, everyone, <strong>you cannot “fix” your body!</strong> (Barring clear illness or clear physical problems.) You cannot “fix” the size of your penis, your canthal tilt, your wrist size, your baldness, your nose, your cup size, your body type, the shape of your ass, the pattern of your eyebrows, and so on. And it’s all because your body isn’t broken. You aren’t ugly because you have an ethnic, non-beauty-standard-shaped nose (so you certainly don’t need a rhinoplasty), or if you’re under six foot tall (so you certainly don’t need leg-lengthening surgery), or if you think your breasts or ass aren’t sexually appealing enough (so you certainly don’t need an implant or BBL), and so on. Feel free to do whatever you please with your body, modify it as much as you would like, but only if you are certain that this is what you actually want for yourself.</p>
<p><img src="/images/posts/dorian-gray.jpg" alt="The Portrait of Dorian Gray" /></p>
<p><em>Behold, the beauty standard! The beautiful, the magestic, Lord Dorian Gray! (by Ivan Albright, 1943/44, Art Institute of Chicago)</em></p>
<p>Human bodies aren’t fucking inherently broken. Nobody is. We’re all equally insecure and scared in this odd world of everyone searching for perfection. People, at a societal level, are so deeply attracted by hierarchy as the solution to situations of uncertainty (as, of course, social hierarchy is how we brought ourselves out of the chaos of early humanity), but this chaos of insecurity has led us to view the personal journey toward beauty as a race for perfection, where although we all seem to know, to some degree, that our beauty standards for perfection are impossible due to their constantly changing and highly conflicting nature, we still all opt in to this greater rat race for perfection (one that only leads to assimilation and a loss of individuality, as Patrick Bateman certainly found out in <em>American Psycho</em>). In particular, because we are all kept unhappy in this race, we derive what little solace we can in comparing ourselves to those we believe are beneath us (such as uglier than) in the areas we see as our greatest insecurities, and this mindset only works to reinforce our hierarchy of beauty.</p>
<p>It’s a system of negativity, I’ll tell you. Beauty standards are for chumps. I think we all ought to just pick a person we each want to be, one that isn’t influenced by the profiteering mindsets of executives and influencers and celebrities, and move on from there. I keep asking myself, almost every single day, what the hell are we doing? It’s like we’ve devised a system of intentional unhappiness on an international scale, the kind we all vote for with our dollars, our purchases, and our bodies, and to end on a sour note, I’m starting to get a bit worried that this is going to be a theme.</p>
<p>[1] “The Beauty Industry’s Boom” by Paris Carter <a href="https://globaledge.msu.edu/blog/post/57407/the-beauty-industry%27s-boom">link</a></p>
Thu, 31 Jul 2025 08:42:59 +0000
https://moofy.org/posts/cosmetics-and-appearances/</link>
https://moofy.org/posts/cosmetics-and-appearances/societyessay"Why Me?": An Opinion on Self-Victimization<p><em>WARNING/CONTEXT: This post is another stream of consciousness essay. It’s the result of another impromptu thought I had on a walk a few days ago in Salem, Massachusetts, during a walking tour of the Salem Witch Trials. I wondered how the accused witches must have felt, and that is when an internal discussion on the question of “Why Me” and self-victimization in the face of adversity started (of course, it had to develop quite a bit, as the witch trials were an incredibly different and nuanced topic nearly entirely unrelated to this post). Anyway, read with caution, and don’t take anything too serious as always. Thanks. –Moofy</em></p>
<p><strong>WHY ME</strong>–A statement that we’ve all exclaimed to ourselves at least once before. It’s a natural question to ask: in any moment of significant reflection, both in positive and negative moments, the desire to understand why you find yourself in yourself in is seemingly undoubted important. By no means is it a bad question: in many situations, the exploration of the question can open up a path to understanding through past or pattern recognition.</p>
<p>Take, for example, cases of gratitude. Many who find themselves in positions of extreme success will often find themselves asking “Why Me?,” and if they can come up with a satisfactory answer of clear steps they took to produce their present success (or, if luck was a significant factor, clear steps that they took that maximized the odds of success that they have). Conversely, in poor situations with negative outcomes, the exploration of that question can lead similarly to an understanding of the past to avoid repeating prior mistakes in the future (or similarly, in cases with poor luck as a major contributing factor, minimize their chances of negative outcomes).</p>
<p>However, most who discuss this question (and many who will read this) are not concerned with these two situations. In fact, many will recognize the critial assumptions that I made in both situations that causes it to be inapplicable as a useful question in many situations, that being the presence of a clear, distinct answer and a healthy, self-recognizing mindset. This question continuously finds itself in a hotbed of infamy to people due to its strong relation with two alternative negative implications that can be result from its answering if the two previous assumptions are not met: unwarranted or warranted but entirely useless self-victimization for negative situations and impostor syndrome, survivor’s guilt, or similar success-related guilt in positive situations.</p>
<p>Therefore, in this opinion, I wanted to break down the question to understand its nuance, because I think that there’s a lot more than commonly-claimed traps of self-victimization and success-guilt, and I think that this speaks a lot to the state of self-help advice/ideologies that are common today and even further into the eco-political landscape of the world, on a common thread of potentially toxic self-help and anti-self-victimization between capitalism and the manosphere.</p>
<p>I must preface by extending the scope of this discussion. I’ve somewhat decieved all of you, and for that I apologize. I’m not particularly interested in the individual question of “Why Me?” or similar specific internal conversations, rather, I’m using it as a backdrop for the entirety of the conversation on self help ideologies as a whole.</p>
<p>Now, If we look generally unto the greater discussion of self-help advice, one of the leading mindsets dominating the personal development sphere is, in its absolute simplest, a mindset of emphasizing <em>personal accountability</em> as the most critical skill to success and development. Without a shadow of a doubt, I certainly agree, personal accountability is critical to personal development, but as with any system of logic or ideology, the problems arising here are in the conclusions reached from taking this principle either too far or too literally (or both). The application of this mindset, both in a personal development sense and also historically in a socioeconomic sense (as I will get into shortly) has led to the mindset being taken even further into very strict, potentially unhealthy ideals of completely rejecting any and all perceived “excuses” for failure or weakness, shifting the original intent of purely promoting healthy personal accountability into an avoidance of any level of acknowledgement of oneself as a victim in any way whatsoever like a weakness in and of itself.</p>
<p>In the socioeconomic sense, as I mentioned with capitalism, think of phrases like “picking yourself up by the bootstraps,” mindsets of hard work as a pure function for personal gain, wherein your success is purely a function of your own actions/effort, and any level of acknowledgement of how you may be unfairly set back is self-victimization and therefore easily painted as excuses for simply not working harder. It’s a very attractive ideal under capitalist mindsets because it’s very to believe its underlying assumption, that hard work will yield success, and therefore, from that assumption, one could easily believe that their success is determined solely by their hard work. Most importantly, the biggest reason to follow this mindset is one of pure application: regardless of if you recognize your victimization/setbacks or not, if steps cannot be taken to fix them easily or individually, then it does nothing to help you reach your individual goals simply to just recognize that they are there (thus why many people quickly write off those who point out social inequities as complaining, citing that “life is just unfair for everyone”).</p>
<p>The issue is that the assumption of success purely being determined by hard work or even majority hard work is not one that is easily believable for all cases of all people. Society is not fair, that’s for certain: there are all kinds of inequities present, and this, obviously, isn’t something that anti-self-victimization mindsets deny. In fact, they rightly accept it with phrases such as “playing the hand you’re dealt in life,” however, first and foremost, I believe that an acknowledgement of your circumstances and aiding in coming to terms with your circumstances not only on an individual level (which anti-self-victimization mindsets do support) but also on a societal level is exactly the kind of method for “playing the hand” one is given.</p>
<p>Now, I look to the manosphere for an example. This mindset of “iron-to-steel accountability,” as I choose to refer to it, is wildly popular among alpha male communities and the like, and I think that this is for the largely for the same reason of being the outwardly strongest-appearing mindset for tackling life, because as previously mentioned, the potentially immediately-useless nature of simply recognizing places that you have been wronged or treated unfairly becomes a weakness out of its outward futility, but for that exact reason, its been a particularly dangerous mindset when taken too far.</p>
<p>Think from the perspective of an impressionable teenage boy, staked to enter the world with its complications and treacheries while told to recognize each of his shortcomings as, at best, not being his fault yet certainly his problem. In my honest opinion, I feel like all it does is raise the problem of leading us men to inherently accept a weird hierarchy structure among each other based on insecurity. I imagine the scenario for most men looks like accepting shortcomings beyond personal control as essentially just being issues that are his problem (when, ideally, perhaps they shouldn’t be viewed as problems at all, something I will get into later) and then to cope with such insecurities of his shortcomings in certain areas, building a kind of superiority complex for his positive traits to counteract the inferiority for his negative traits (or perhaps thoughts of superiority over his negative traits when compared to other men that are perceived as even worse in those areas).</p>
<p>Finally, I’d like to present my alternative, how I think things should work instead. What I hope is that we see that understanding your shortcomings is important, but not to actually view them as problems attributed to you. I think that, in a sense, the question of “Why me?” can be rephrased for each person to “Why US?,” a greater question about what we consider as shortcomings and why, and how we as a society can work together to be more equitable and egalitarian. Simply put, many problems we view as being that of the individual are rather problems of the society at large with symptoms at the individual level, and it seems that this iron-to-steel mentality is ironically just as unhelpful as its supposed antithetical mindset of constant self-victimization.</p>
<p>As with anything, all things should be taken in moderation, and the same goes for the mindset of self-accountability. Be accountable for things in your control and be mindful for things that are not. People should not blame themselves for things out of their control, and we should readily work together to produce an equitable society.</p>
Wed, 30 Jul 2025 16:20:15 +0000
https://moofy.org/posts/on-self-victimization/</link>
https://moofy.org/posts/on-self-victimization/philosophyessayN00M: My Attempt at Raycasting and 3-D Video Game Design in C<p>A few months ago, I asked myself what it would take to make a raycaster in C. I’ve seen other programmers before make successful raycasters, namely <a href="https://www.youtube.com/@jdh/videos">jdh</a> in one of my favorite videos of his: <em>Programming a first person shooter from scratch like it’s 1995</em></p>
<div class="video-container">
<iframe src="https://www.youtube.com/embed/fSjc8vLMg8c" frameborder="0" allowfullscreen=""></iframe>
</div>
<p>In particular, I’m incredibly inexperienced in basically all facets of game development, but especially with 3-D games. I’ve only ever made a singular useful graphical program before, <a href="https://github.com/mufaro3/sorting-visualization">mufaro3/sorting-visualization</a>, and it was in C++ using SFML rather than C, and the most I had attempted graphical program design in C was using some basic SDL to draw a few shapes onto the screen about a year or so prior. The bottom line is that in starting this project, I might as well be jumping off into the void.</p>
<p>However, I was really certain that I wanted to understand the basics of 3-D software rendering, as it seemed so incredibly complicated. Therefore, what I set out to do in <a href="https://github.com/mufaro3/n00m">mufaro3/n00m</a> was to follow <a href="https://lodev.org/cgtutor/raycasting.html">Lode’s Computer Graphics Tutorial</a> on raycasting engine development as much as possible to successfully build my own DOOM clone (thus, why I called it N00M, as it’s my own “nickelulzian doomstyle renderer”).</p>
<p>I opted to make N00M in C using SDL for graphics, <a href="https://github.com/recp/cglm">recp/cglm</a> to simplify the linear algebra calculations, and <a href="https://github.com/rxi/log.c">rxi/log.c</a> for logging. Therefore, to begin with, I set up my C directory as follows (my usual structure):</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>n00m/
├── src/
│ ├── main.c
│ └── common.h
├── lib/
│ ├── cglm
│ └── log.c
├── res
├── CMakeLists.txt
├── Makefile
├── .gitignore
├── LICENSE
├── AUTHORS
└── README
</code></pre></div></div>
<p>I first just made sure to set up my build system with a basic headerfile to test if everything could link and build successfully:</p>
<figure class="highlight"><pre><code class="language-c" data-lang="c"><span class="cp">#include</span> <span class="cpf">"common.h"</span><span class="cp">
</span>
<span class="kt">int</span>
<span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">printf</span><span class="p">(</span> <span class="s">"Hello, World!</span><span class="se">\n</span><span class="s">"</span> <span class="p">);</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span></code></pre></figure>
<p>Once this worked, I got started on the actual program structure. Good graphical programs, even in C, are highly modularized, so I started breaking down the system into modules (essentially a variable/struct storing the state of that module for the program at a given time and a header and associated source file for that module with related functions):</p>
<ol>
<li><code class="language-plaintext highlighter-rouge">graphics</code> for managing everything rendering/graphics related</li>
<li><code class="language-plaintext highlighter-rouge">state</code> for the actual logical game state</li>
<li><code class="language-plaintext highlighter-rouge">config</code> for configuration values managed under <code class="language-plaintext highlighter-rouge">config.h</code> and <code class="language-plaintext highlighter-rouge">config.c</code></li>
</ol>
<p>Then, I started writing out the graphics module directly. I started with some functions to initialize SDL and close the graphics module as</p>
<figure class="highlight"><pre><code class="language-c" data-lang="c"><span class="kt">void</span>
<span class="nf">graphics_init</span> <span class="p">(</span><span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">,</span> <span class="n">config_t</span> <span class="o">*</span><span class="n">config</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="n">SDL_Init</span><span class="p">(</span><span class="n">SDL_INIT_VIDEO</span><span class="p">)</span> <span class="o"><</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">log_fatal</span><span class="p">(</span><span class="s">"SDL could not be initialized!</span><span class="se">\n</span><span class="s">"</span>
<span class="s">"SDL Error: %s"</span><span class="p">,</span> <span class="n">SDL_GetError</span><span class="p">());</span>
<span class="n">exit</span><span class="p">(</span><span class="n">EXIT_FAILURE</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">SDL_SetHint</span><span class="p">(</span><span class="n">SDL_HINT_RENDER_SCALE_QUALITY</span><span class="p">,</span> <span class="s">"1"</span><span class="p">);</span>
<span class="kt">int</span> <span class="n">image_flags</span> <span class="o">=</span> <span class="n">IMG_INIT_PNG</span> <span class="o">|</span> <span class="n">IMG_INIT_JPG</span> <span class="o">|</span> <span class="n">IMG_INIT_TIF</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">image_init</span> <span class="o">=</span> <span class="n">IMG_Init</span><span class="p">(</span><span class="n">image_flags</span><span class="p">);</span>
<span class="k">if</span> <span class="p">((</span><span class="n">image_init</span> <span class="o">&</span> <span class="n">image_flags</span><span class="p">)</span> <span class="o">!=</span> <span class="n">image_flags</span><span class="p">)</span> <span class="p">{</span>
<span class="n">log_fatal</span><span class="p">(</span><span class="s">"SDL_image could not be initialized!</span><span class="se">\n</span><span class="s">"</span>
<span class="s">"SDL_image Error: %s"</span><span class="p">,</span> <span class="n">IMG_GetError</span><span class="p">());</span>
<span class="n">exit</span><span class="p">(</span><span class="n">EXIT_FAILURE</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="n">TTF_Init</span><span class="p">()</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
<span class="n">log_error</span><span class="p">(</span><span class="s">"SDL_TTF could not be initialized!</span><span class="se">\n</span><span class="s">"</span>
<span class="s">"SDL_TTF Error: %s"</span><span class="p">,</span> <span class="n">TTF_GetError</span><span class="p">());</span>
<span class="p">}</span>
<span class="cp">#if defined linux && SDL_VERSION_ATLEAST(2, 0, 8)
</span> <span class="cm">/* Disable compositor bypass */</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">SDL_SetHint</span><span class="p">(</span><span class="n">SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR</span><span class="p">,</span> <span class="s">"0"</span><span class="p">))</span> <span class="p">{</span>
<span class="n">log_fatal</span><span class="p">(</span><span class="s">"SDL cannot disable compositor bypass!"</span><span class="p">);</span>
<span class="n">exit</span><span class="p">(</span><span class="n">EXIT_FAILURE</span><span class="p">);</span>
<span class="p">}</span>
<span class="cp">#endif
</span>
<span class="n">gfx</span><span class="o">-></span><span class="n">window</span> <span class="o">=</span> <span class="n">SDL_CreateWindow</span><span class="p">(</span><span class="n">config</span><span class="o">-></span><span class="n">window_title</span><span class="p">,</span>
<span class="n">SDL_WINDOWPOS_CENTERED</span><span class="p">,</span>
<span class="n">SDL_WINDOWPOS_CENTERED</span><span class="p">,</span>
<span class="n">config</span><span class="o">-></span><span class="n">window_width</span><span class="p">,</span>
<span class="n">config</span><span class="o">-></span><span class="n">window_height</span><span class="p">,</span>
<span class="n">SDL_WINDOW_SHOWN</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">gfx</span><span class="o">-></span><span class="n">window</span><span class="p">)</span> <span class="p">{</span>
<span class="n">log_fatal</span><span class="p">(</span><span class="s">"Window could not be created!</span><span class="se">\n</span><span class="s">"</span>
<span class="s">"SDL Error: %s"</span><span class="p">,</span> <span class="n">SDL_GetError</span><span class="p">());</span>
<span class="n">SDL_Quit</span><span class="p">();</span>
<span class="n">exit</span><span class="p">(</span><span class="n">EXIT_FAILURE</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span> <span class="o">=</span> <span class="n">SDL_CreateRenderer</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">window</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
<span class="n">SDL_RENDERER_PRESENTVSYNC</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">)</span> <span class="p">{</span>
<span class="n">log_fatal</span><span class="p">(</span><span class="s">"Renderer could not be created!</span><span class="se">\n</span><span class="s">"</span>
<span class="s">"SDL Error: %s"</span><span class="p">,</span> <span class="n">SDL_GetError</span><span class="p">());</span>
<span class="n">SDL_DestroyWindow</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">window</span><span class="p">);</span>
<span class="n">SDL_Quit</span><span class="p">();</span>
<span class="n">exit</span><span class="p">(</span><span class="n">EXIT_FAILURE</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">gfx</span><span class="o">-></span><span class="n">screen_texture</span> <span class="o">=</span> <span class="n">SDL_CreateTexture</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">,</span>
<span class="n">SDL_PIXELFORMAT_RGBA8888</span><span class="p">,</span>
<span class="n">SDL_TEXTUREACCESS_STREAMING</span><span class="p">,</span>
<span class="n">config</span><span class="o">-></span><span class="n">window_width</span><span class="p">,</span>
<span class="n">config</span><span class="o">-></span><span class="n">window_height</span><span class="p">);</span>
<span class="p">}</span>
<span class="kt">void</span>
<span class="nf">graphics_close</span> <span class="p">(</span><span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">SDL_DestroyTexture</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">screen_texture</span><span class="p">);</span>
<span class="n">SDL_DestroyRenderer</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">);</span>
<span class="n">SDL_DestroyWindow</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">window</span><span class="p">);</span>
<span class="n">TTF_Quit</span><span class="p">();</span>
<span class="n">IMG_Quit</span><span class="p">();</span>
<span class="n">SDL_Quit</span><span class="p">();</span>
<span class="p">}</span></code></pre></figure>
<p>The idea behind this is that every module will have this same kind of structure, an initialization function and a deinitialization (or close) function. Why this is useful is that it simplifies the general structure of my program. To see this, we can look directly at the main function:</p>
<figure class="highlight"><pre><code class="language-c" data-lang="c"><span class="kt">int</span>
<span class="nf">main</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">log_info</span><span class="p">(</span><span class="s">"Initializing"</span><span class="p">);</span>
<span class="cm">/* setup the random number generator */</span>
<span class="n">srand</span><span class="p">(</span><span class="n">time</span><span class="p">(</span><span class="mi">0</span><span class="p">));</span>
<span class="n">config_t</span> <span class="n">config</span><span class="p">;</span>
<span class="n">config_load</span><span class="p">(</span><span class="o">&</span><span class="n">config</span><span class="p">);</span>
<span class="n">graphics_t</span> <span class="n">gfx</span><span class="p">;</span>
<span class="n">graphics_init</span><span class="p">(</span><span class="o">&</span><span class="n">gfx</span><span class="p">,</span> <span class="o">&</span><span class="n">config</span><span class="p">);</span>
<span class="n">state_t</span> <span class="n">state</span><span class="p">;</span>
<span class="n">state_init</span><span class="p">(</span><span class="o">&</span><span class="n">state</span><span class="p">,</span> <span class="o">&</span><span class="n">config</span><span class="p">);</span>
<span class="n">log_info</span><span class="p">(</span><span class="s">"Looping"</span><span class="p">);</span>
<span class="k">while</span> <span class="p">(</span><span class="n">state</span><span class="p">.</span><span class="n">running</span><span class="p">)</span>
<span class="n">loop</span><span class="p">(</span><span class="o">&</span><span class="n">state</span><span class="p">,</span> <span class="o">&</span><span class="n">gfx</span><span class="p">);</span>
<span class="n">log_info</span><span class="p">(</span><span class="s">"Closing"</span><span class="p">);</span>
<span class="n">graphics_close</span><span class="p">(</span><span class="o">&</span><span class="n">gfx</span><span class="p">);</span>
<span class="n">config_close</span><span class="p">(</span><span class="o">&</span><span class="n">config</span><span class="p">);</span>
<span class="p">}</span></code></pre></figure>
<p>The layout of each module’s data structure was pretty simple. In <code class="language-plaintext highlighter-rouge">graphics_t</code>, I included some simple SDL pointers necessary for basic rendering. The idea behind <code class="language-plaintext highlighter-rouge">graphics_t</code>, after all, is as a singular struct that simplifies passing-in the graphical state of the program into various functions (so any function with a graphical component that may need to access just the <code class="language-plaintext highlighter-rouge">SDL_Window</code> context or the <code class="language-plaintext highlighter-rouge">SDL_Renderer</code> or etc. can just simply have the entire graphical state passed in at once for simplicity).</p>
<figure class="highlight"><pre><code class="language-c" data-lang="c"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">_graphics</span> <span class="p">{</span>
<span class="n">SDL_Window</span> <span class="o">*</span><span class="n">window</span><span class="p">;</span>
<span class="n">SDL_Renderer</span> <span class="o">*</span><span class="n">renderer</span><span class="p">;</span>
<span class="n">SDL_Texture</span> <span class="o">*</span><span class="n">screen_texture</span><span class="p">;</span>
<span class="p">}</span> <span class="n">graphics_t</span><span class="p">;</span></code></pre></figure>
<p>Similarly, the other modules were much the same. The entire game state in <code class="language-plaintext highlighter-rouge">state_t</code> was:</p>
<figure class="highlight"><pre><code class="language-c" data-lang="c"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">_fpstimer</span> <span class="p">{</span>
<span class="kt">uint64_t</span> <span class="n">ticks</span><span class="p">,</span> <span class="n">frames</span><span class="p">,</span> <span class="n">last_update_time</span><span class="p">;</span>
<span class="kt">float</span> <span class="n">tps</span><span class="p">,</span> <span class="n">fps</span><span class="p">;</span>
<span class="n">bool</span> <span class="n">infinite_fps</span><span class="p">;</span>
<span class="p">}</span> <span class="n">fpstimer_t</span><span class="p">;</span>
<span class="cm">/* fonts */</span>
<span class="k">enum</span> <span class="p">{</span> <span class="n">DEJAVU_SANS_MONO</span><span class="p">,</span> <span class="n">TOTAL_FONTS</span> <span class="p">};</span>
<span class="cp">#define TEXTURE_WIDTH 64
#define TEXTURE_HEIGHT 64
#define NUM_TEXTURES 8
</span>
<span class="k">typedef</span> <span class="k">struct</span> <span class="n">_state</span> <span class="p">{</span>
<span class="n">bool</span> <span class="n">running</span><span class="p">;</span>
<span class="n">vec2s</span> <span class="n">camera_plane</span><span class="p">;</span>
<span class="n">ivec2s</span> <span class="n">map_size</span><span class="p">;</span>
<span class="n">ivec2s</span> <span class="n">resolution</span><span class="p">;</span>
<span class="cm">/* textures */</span>
<span class="kt">uint32_t</span> <span class="o">*</span><span class="n">textures</span><span class="p">[</span><span class="n">NUM_TEXTURES</span><span class="p">];</span>
<span class="cm">/* loaded fonts */</span>
<span class="n">TTF_Font</span> <span class="o">*</span><span class="n">fonts</span><span class="p">[</span><span class="n">TOTAL_FONTS</span><span class="p">];</span>
<span class="n">TTF_Font</span> <span class="o">*</span><span class="n">debug_font</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">debug_line_y</span><span class="p">;</span>
<span class="cm">/* map information */</span>
<span class="n">map_t</span> <span class="n">map</span><span class="p">;</span>
<span class="cm">/* controls and whatnot */</span>
<span class="n">bool</span> <span class="n">keys</span><span class="p">[</span><span class="n">SDL_NUM_SCANCODES</span><span class="p">];</span>
<span class="n">ivec2s</span> <span class="n">mouse_pos_delta</span><span class="p">;</span>
<span class="kt">float</span> <span class="n">mouse_sensitivity</span><span class="p">;</span>
<span class="n">player_t</span> <span class="n">player</span><span class="p">;</span>
<span class="n">fpstimer_t</span> <span class="n">timer</span><span class="p">;</span>
<span class="p">}</span> <span class="n">state_t</span><span class="p">;</span></code></pre></figure>
<p>with some code for player information, the presently loaded fonts, debugging info, and some controls and timing variables. Lastly, <code class="language-plaintext highlighter-rouge">config_t</code> was much the same:</p>
<figure class="highlight"><pre><code class="language-c" data-lang="c"><span class="k">typedef</span> <span class="k">struct</span> <span class="n">_config</span> <span class="p">{</span>
<span class="kt">uint32_t</span> <span class="n">window_height</span><span class="p">,</span> <span class="n">window_width</span><span class="p">;</span>
<span class="kt">uint8_t</span> <span class="n">debug_font_size</span><span class="p">;</span>
<span class="kt">char</span> <span class="n">window_title</span><span class="p">[</span><span class="mi">512</span><span class="p">];</span>
<span class="cm">/* system specification */</span>
<span class="n">bool</span> <span class="n">is_big_endian</span><span class="p">;</span>
<span class="p">}</span> <span class="n">config_t</span><span class="p">;</span></code></pre></figure>
<p>Altogether, it’s a fairly simple system, and from there, I sought to actually being on rendering. I started by writing in some simple graphics functions (which I won’t show the implementations of, only the declarations):</p>
<figure class="highlight"><pre><code class="language-c" data-lang="c"><span class="kt">void</span> <span class="nf">graphics_init</span> <span class="p">(</span><span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">,</span> <span class="n">config_t</span> <span class="o">*</span><span class="n">config</span><span class="p">);</span>
<span class="kt">void</span> <span class="nf">graphics_close</span> <span class="p">(</span><span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">);</span>
<span class="kt">void</span> <span class="nf">graphics_draw_pixel_buffer</span><span class="p">(</span><span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">,</span> <span class="n">ivec2s</span> <span class="n">resolution</span><span class="p">,</span> <span class="kt">uint32_t</span> <span class="o">*</span><span class="n">pixels</span><span class="p">);</span>
<span class="kt">void</span> <span class="nf">graphics_draw_text</span> <span class="p">(</span><span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">,</span> <span class="n">TTF_Font</span> <span class="o">*</span><span class="n">font</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">text</span><span class="p">,</span>
<span class="n">SDL_Color</span> <span class="n">text_color</span><span class="p">,</span> <span class="n">SDL_Color</span> <span class="n">background_color</span><span class="p">,</span>
<span class="kt">int</span> <span class="n">x</span><span class="p">,</span> <span class="kt">int</span> <span class="n">y</span><span class="p">,</span> <span class="kt">int</span> <span class="n">padding</span><span class="p">);</span></code></pre></figure>
<p>and a map management system as well:</p>
<figure class="highlight"><pre><code class="language-c" data-lang="c"><span class="cm">/* common defines */</span>
<span class="cp">#define MAP_OPEN 0
#define NOT_FOUND -1
</span>
<span class="k">typedef</span> <span class="k">struct</span> <span class="n">_map</span> <span class="p">{</span>
<span class="kt">int</span> <span class="o">*</span><span class="n">cells</span><span class="p">;</span>
<span class="n">ivec2s</span> <span class="n">size</span><span class="p">;</span>
<span class="p">}</span> <span class="n">map_t</span><span class="p">;</span>
<span class="n">SDL_Color</span> <span class="nf">map_get_color</span> <span class="p">(</span><span class="kt">int</span> <span class="n">map_value</span><span class="p">);</span>
<span class="kt">void</span> <span class="nf">map_init</span> <span class="p">(</span><span class="n">map_t</span> <span class="o">*</span><span class="n">map</span><span class="p">);</span>
<span class="kt">void</span> <span class="nf">map_close</span> <span class="p">(</span><span class="n">map_t</span> <span class="o">*</span><span class="n">map</span><span class="p">);</span>
<span class="kt">int</span> <span class="nf">map_at_vec</span> <span class="p">(</span><span class="n">map_t</span> <span class="o">*</span><span class="n">map</span><span class="p">,</span> <span class="n">ivec2s</span> <span class="n">pos</span><span class="p">);</span>
<span class="kt">int</span> <span class="nf">map_at_fvec</span> <span class="p">(</span><span class="n">map_t</span> <span class="o">*</span><span class="n">map</span><span class="p">,</span> <span class="n">vec2s</span> <span class="n">pos</span><span class="p">);</span>
<span class="kt">int</span> <span class="nf">map_at</span> <span class="p">(</span><span class="n">map_t</span> <span class="o">*</span><span class="n">map</span><span class="p">,</span> <span class="kt">int</span> <span class="n">x</span><span class="p">,</span> <span class="kt">int</span> <span class="n">y</span><span class="p">);</span></code></pre></figure>
<p>Finally, with this background, I could get started on the following static <code class="language-plaintext highlighter-rouge">main</code> file functions:</p>
<figure class="highlight"><pre><code class="language-c" data-lang="c"><span class="k">static</span> <span class="kt">void</span> <span class="nf">draw_current_frame</span> <span class="p">(</span><span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">,</span> <span class="n">state_t</span> <span class="o">*</span><span class="n">state</span><span class="p">);</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">draw_mini_map</span> <span class="p">(</span><span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">,</span> <span class="n">state_t</span> <span class="o">*</span><span class="n">state</span><span class="p">);</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">poll_events</span> <span class="p">(</span><span class="n">state_t</span> <span class="o">*</span><span class="n">state</span><span class="p">);</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">handle_keys</span> <span class="p">(</span><span class="n">state_t</span> <span class="o">*</span><span class="n">state</span><span class="p">);</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">draw_debug</span> <span class="p">(</span><span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">,</span> <span class="n">state_t</span> <span class="o">*</span><span class="n">state</span><span class="p">,</span> <span class="n">config_t</span> <span class="o">*</span><span class="n">config</span><span class="p">);</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">loop</span> <span class="p">(</span><span class="n">state_t</span> <span class="o">*</span><span class="n">state</span><span class="p">,</span> <span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">,</span> <span class="n">config_t</span> <span class="o">*</span><span class="n">config</span><span class="p">);</span></code></pre></figure>
<p>The idea behind these is that each handles a specific function. The main loop of the program is performed by <code class="language-plaintext highlighter-rouge">loop</code>, events and input are handled by <code class="language-plaintext highlighter-rouge">poll_events</code> and <code class="language-plaintext highlighter-rouge">handle_keys</code>, and then we have the three main drawing functions: <code class="language-plaintext highlighter-rouge">draw_current_frame</code> for the actual game scene, <code class="language-plaintext highlighter-rouge">draw_mini_map</code> for the minimap, and <code class="language-plaintext highlighter-rouge">draw_debug</code> for the debug screen. In this post, I won’t go into <code class="language-plaintext highlighter-rouge">draw_debug</code>, and I’ll mostly focus on the other two.</p>
<p>To begin, drawing the minimap was quite simple. Essentially, what I’m doing is just first performing some calculations to determine how big the minimap should be and where it should be, then I draw the background of the minimap, and then I go in and loop through each of the squares of the minimap to draw in each square unit area by its associated color (as given by its mapvalue).</p>
<figure class="highlight"><pre><code class="language-c" data-lang="c"><span class="k">static</span> <span class="kt">void</span>
<span class="nf">draw_mini_map</span> <span class="p">(</span><span class="n">graphics_t</span> <span class="o">*</span><span class="n">gfx</span><span class="p">,</span> <span class="n">state_t</span> <span class="o">*</span><span class="n">state</span><span class="p">)</span>
<span class="p">{</span>
<span class="cm">/* minimap background constants */</span>
<span class="k">static</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="n">BOX_SIZE</span> <span class="o">=</span> <span class="mi">5</span><span class="p">;</span> <span class="cm">/* width of each box */</span>
<span class="k">static</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="n">PADDING</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="cm">/* padding for the background */</span>
<span class="k">static</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="n">MARGIN</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span> <span class="cm">/* the outer margin */</span>
<span class="k">static</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="n">PLAYER_SIZE</span> <span class="o">=</span> <span class="mi">4</span><span class="p">;</span> <span class="cm">/* width/height of the player icon */</span>
<span class="cm">/* set up the box sizing for the outer box */</span>
<span class="n">ivec2s</span> <span class="n">full_minimap_size</span> <span class="o">=</span> <span class="p">...</span>
<span class="cm">/* determine placement based on the sizing */</span>
<span class="n">ivec2s</span> <span class="n">full_minimap_position</span> <span class="o">=</span> <span class="p">...</span>
<span class="cm">/* draw the background */</span>
<span class="n">SDL_Rect</span> <span class="n">bg_rect</span> <span class="o">=</span> <span class="p">...</span>
<span class="n">SDL_SetRenderDrawColor</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">,</span> <span class="n">EXPAND_COLOR</span><span class="p">(</span><span class="n">COLOR_WHITE</span><span class="p">));</span>
<span class="n">SDL_RenderFillRect</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">,</span> <span class="o">&</span><span class="n">bg_rect</span><span class="p">);</span>
<span class="n">ivec2s</span> <span class="n">box_top_left</span> <span class="o">=</span> <span class="n">glms_ivec2_adds</span><span class="p">(</span><span class="n">full_minimap_position</span><span class="p">,</span> <span class="n">PADDING</span><span class="p">);</span>
<span class="p">...</span>
<span class="cm">/* draw all of the boxes */</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">x</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">x</span> <span class="o"><</span> <span class="n">state</span><span class="o">-></span><span class="n">map</span><span class="p">.</span><span class="n">size</span><span class="p">.</span><span class="n">x</span><span class="p">;</span> <span class="o">++</span><span class="n">x</span><span class="p">)</span> <span class="p">{</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">y</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">y</span> <span class="o"><</span> <span class="n">state</span><span class="o">-></span><span class="n">map</span><span class="p">.</span><span class="n">size</span><span class="p">.</span><span class="n">y</span><span class="p">;</span> <span class="o">++</span><span class="n">y</span><span class="p">)</span> <span class="p">{</span>
<span class="cm">/* get the fill color from the position */</span>
<span class="kt">int</span> <span class="n">map_value</span> <span class="o">=</span> <span class="n">map_at</span><span class="p">(</span><span class="o">&</span><span class="n">state</span><span class="o">-></span><span class="n">map</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span>
<span class="n">SDL_Color</span> <span class="n">fill_color</span> <span class="o">=</span> <span class="n">map_value</span> <span class="o">==</span> <span class="n">MAP_OPEN</span> <span class="o">?</span> <span class="n">COLOR_BLACK</span> <span class="o">:</span> <span class="n">map_get_color</span><span class="p">(</span><span class="n">map_value</span><span class="p">);</span>
<span class="cm">/* calculate the fill position from the r,c value */</span>
<span class="n">SDL_Rect</span> <span class="n">box</span> <span class="o">=</span> <span class="p">...</span>
<span class="cm">/* now draw it to the screen */</span>
<span class="n">SDL_SetRenderDrawColor</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">,</span> <span class="n">EXPAND_COLOR</span><span class="p">(</span><span class="n">fill_color</span><span class="p">));</span>
<span class="n">SDL_RenderFillRect</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">,</span> <span class="o">&</span><span class="n">box</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="cm">/* draw a tiny square to represent the player */</span>
<span class="n">ivec2s</span> <span class="n">player_indicator_center</span> <span class="o">=</span> <span class="p">...</span>
<span class="n">SDL_Rect</span> <span class="n">player_indicator_bounds</span> <span class="o">=</span> <span class="p">...</span>
<span class="p">...</span>
<span class="n">SDL_SetRenderDrawColor</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">,</span> <span class="n">EXPAND_COLOR</span><span class="p">(</span><span class="n">COLOR_LIGHT_GRAY</span><span class="p">));</span>
<span class="n">SDL_RenderFillRect</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">,</span> <span class="o">&</span><span class="n">player_indicator_bounds</span><span class="p">);</span>
<span class="cm">/* draw a line to represent the view direction */</span>
<span class="k">static</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">view_line_distance</span> <span class="o">=</span> <span class="mi">20</span><span class="p">;</span>
<span class="cm">/* normalize the direction vector then scale by the distance */</span>
<span class="n">vec2s</span> <span class="n">direction_vector</span><span class="p">;</span>
<span class="n">glm_vec2_normalize_to</span><span class="p">((</span><span class="kt">float</span><span class="o">*</span><span class="p">)</span> <span class="n">state</span><span class="o">-></span><span class="n">player</span><span class="p">.</span><span class="n">dir</span><span class="p">.</span><span class="n">raw</span><span class="p">,</span> <span class="n">direction_vector</span><span class="p">.</span><span class="n">raw</span><span class="p">);</span>
<span class="n">direction_vector</span> <span class="o">=</span> <span class="n">glms_vec2_scale</span><span class="p">(</span><span class="n">direction_vector</span><span class="p">,</span> <span class="n">view_line_distance</span><span class="p">);</span>
<span class="n">ivec2s</span> <span class="n">direction_vector_end</span> <span class="o">=</span> <span class="n">glms_ivec2_add</span><span class="p">(</span><span class="n">VEC2_INT</span><span class="p">(</span><span class="n">direction_vector</span><span class="p">),</span>
<span class="n">player_indicator_center</span><span class="p">);</span>
<span class="cm">/* draw the vector to the screen */</span>
<span class="n">SDL_SetRenderDrawColor</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">,</span> <span class="n">EXPAND_COLOR</span><span class="p">(</span><span class="n">COLOR_LIGHT_GRAY</span><span class="p">));</span>
<span class="n">SDL_RenderDrawLine</span><span class="p">(</span><span class="n">gfx</span><span class="o">-></span><span class="n">renderer</span><span class="p">,</span> <span class="p">...</span>
<span class="p">}</span></code></pre></figure>
<p>From there, I started working on the actual raycasting (the bread and butter of this program).</p>
<p><em>Note: This post is currently unfinished for some reason. Check back in later to see if I ever ended up coming around to finishing it!</em></p>
Wed, 30 Jul 2025 08:44:42 +0000
https://moofy.org/posts/raycasting-videogame-in-c/</link>
https://moofy.org/posts/raycasting-videogame-in-c/cin-progressprogrammingLooking into "Excursions in Number Theory"<p>In New York, I picked up a new fun textbook, <em>Excursions in Number Theory</em> by C. Stanley Ogilvy and John T. Anderson. It’s a fun little pocketread about all sorts of wacky things in number theory, a field of principle mathematics that seems pointless on the surface but tends to have big implications. The book is fairly short, only 144 pages of direct content, but the information is puzzling to say the least. I found the book next to mathematical books about various games like Poker and Chess, and as this book tackles concepts like probability and combinatorics heavily (as that is where the majority of the implications of number theory seems to lie), it seemed like it fit in well.</p>
<p>In this post, I’m going to dive into the book chapter-by-chapter with some light thoughts, some proofs, and what I think about what was written. Additionally, in order to understand what was going on in each chapter, I sought to try and write some example code alongside each lesson in Common Lisp, so perhaps this could be something of an educational journey for both you, the reader, and me. As usual, it’s best to read this post as though it were a Jupyter notebook (or something of the sort).</p>
<h3 id="chapter-1-the-beginnings">Chapter 1: The Beginnings</h3>
<p>The book opens by explaining the necessity of number theory. One thing it shows is how number theory serves as the basis by which efficient algorithms for all kinds of calculations is usually produced.</p>
<p>One example the authors provide is the how non-decimal number systems had no mainstream application or use for many years (a topic largely only explored under number theory) until the invention of binary computers, which operate fundamentally on the binary number system (zeroes and ones) and then at higher levels on octal and hexadecimal.</p>
<p>For those unaware, the basic understanding of what a number system is essentially the basis number through which numbers are represented by the multiplication of numbers less than that number by powers of that number. Put more mathematically, we can represent any number that exists using a number system based on the natural number \(n\) by multiplying powers of \(n\) by the whole numbers within \([0,n-1]\). For example, if we wanted to make the number \(N\), we would use the form</p>
\[N = a_1 \times n^0 + a_2 \times n^1 + a_3 \times n^2 + \dots\]
<p>where \(a_i \in [0, n-1]\) for all \(i\). For an even simpler, direct example, the decimal system works where \(n=10\). Imagine we wanted to represent a number like 203463 in decimal (which is just as we normally write it). Therefore, we could represent it as</p>
\[203463 = 2 \times 10^5 + 0 \times 10^4 + 3 \times 10^3 + 4 \times 10^2 + 6 \times 10^1 + 3 \times 10^0.\]
<p>Now, continuing onward, we know that the decimal system makes the most sense for computers because its the easiest to represent (as it only requires two values, 1 and 0. For example, we can represent the number 13 using the following powers, essentially just adding up specific values of powers of 2:</p>
\[13 = 1 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 8 + 4 + 0 + 1,\]
<p>and then, we can represent it as just being the coefficients from that expression, leading us to represent 13 in binary as 1101.</p>
<p>Now, specifically, one of the applications of number theory that the book references is the fast algorithm for converting decimal numbers into binary (as its very quick to convert numbers from non-decimal number systems into demical but seemingly tedious to convert from decimal to non-decimal systems due to having to find and calculate the powers of the system).</p>
<p>This quick algorithm boils down to taking an ordered stock of the pattern in which the division of a number by 2 repeatedly results in odd or even numbers (discarding the \(1/2\) each time the result is odd). For example, for the number 13, we can divide it by 2 until we reach 0, discarding \(\frac{1}{2}\) each time, to get the sequence 13, 6, 3, 1. Then, we can write 1 for each odd number and 0 for each even number and reverse the order, giving 1, 0, 1, 1, which is the digits of 13 in binary (as we showed before).</p>
<p>I thought that this algorithm was ingenious, so I wrote some common lisp code to test it out.</p>
<figure class="highlight"><pre><code class="language-lisp" data-lang="lisp"><span class="p">(</span><span class="nb">defun</span> <span class="nv">binary</span> <span class="p">(</span><span class="nv">n</span><span class="p">)</span>
<span class="p">(</span><span class="k">labels</span> <span class="p">((</span><span class="nv">binary-recursive</span> <span class="p">(</span><span class="nv">cur</span> <span class="nv">seen</span><span class="p">)</span>
<span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nb">=</span> <span class="mi">0</span> <span class="nv">cur</span><span class="p">)</span>
<span class="nv">seen</span>
<span class="p">(</span><span class="k">let</span> <span class="p">((</span><span class="nv">next-value-int</span> <span class="p">(</span><span class="nb">truncate</span> <span class="p">(</span><span class="nb">/</span> <span class="nv">cur</span> <span class="mi">2</span><span class="p">))))</span>
<span class="p">(</span><span class="nv">binary-recursive</span> <span class="nv">next-value-int</span>
<span class="p">(</span><span class="nb">cons</span> <span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nb">evenp</span> <span class="nv">cur</span><span class="p">)</span> <span class="mi">0</span> <span class="mi">1</span><span class="p">)</span> <span class="nv">seen</span><span class="p">))))))</span>
<span class="p">(</span><span class="nv">binary-recursive</span> <span class="nv">n</span> <span class="no">nil</span><span class="p">)))</span></code></pre></figure>
<p>and a few tests of the function result in exactly the behavior we expect!</p>
<figure class="highlight"><pre><code class="language-lisp" data-lang="lisp"><span class="p">(</span><span class="nb">print</span> <span class="p">(</span><span class="nv">binary</span> <span class="mi">13</span><span class="p">))</span> <span class="nv">-></span> <span class="p">(</span><span class="mi">1</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span><span class="p">)</span>
<span class="p">(</span><span class="nb">print</span> <span class="p">(</span><span class="nv">binary</span> <span class="mi">10</span><span class="p">))</span> <span class="nv">-></span> <span class="p">(</span><span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">0</span><span class="p">)</span>
<span class="p">(</span><span class="nb">print</span> <span class="p">(</span><span class="nv">binary</span> <span class="mi">27</span><span class="p">))</span> <span class="nv">-></span> <span class="p">(</span><span class="mi">1</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">1</span><span class="p">)</span></code></pre></figure>
<h3 id="chapter-2-number-patterns">Chapter 2: Number Patterns</h3>
<p>The next chapter deals with patterns in numbers, such as efficient algorithms for adding numbers. One example they provide is the somewhat legendary story of Gauss adding all of the numbers between 1 and 100 incredibly quickly as a child (I’ll save you all the story: he just knew to pair up numbers on either side of 50 including 0 such that it turned into a product of 11 50s, or \(11 \times 50 = 5050\)).</p>
<p>I thought this chapter was interesting and good foundational mathematics. It deals with series such as the triangular and square numbers and how formulae for adding numbers, squares, and cubes were proven (but not developed) by introducing the method of proof by induction.</p>
<h3 id="chapter-3-prime-numbers-as-building-blocks">Chapter 3: Prime Numbers as Building Blocks</h3>
<p>This chapter, obviously, is all about prime numbers: finding primes, calculatings made easy with primes, and relatively prime numbers. One thing it touches on, for example, is Euclid’s algorithm for calculating greatest common denominators as a way to check if two numbers are relatively prime (meaning their only shared factor is 1) or not. The algorithm consists of taking two numbers you want to test, a and b, and then repeatedly changing whichever value is greater to the absolute value of the difference between the two numbers until the two numbers become factorable, at which case the greatest common denominator is the smaller of the two values.</p>
<p>To test this, I wrote the following code</p>
<figure class="highlight"><pre><code class="language-lisp" data-lang="lisp"><span class="p">(</span><span class="nb">defun</span> <span class="nv">euclid-gcd</span> <span class="p">(</span><span class="nv">a</span> <span class="nv">b</span><span class="p">)</span>
<span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nb">=</span> <span class="mi">0</span> <span class="p">(</span><span class="nb">mod</span> <span class="nv">a</span> <span class="nv">b</span><span class="p">))</span>
<span class="p">(</span><span class="nb">min</span> <span class="nv">a</span> <span class="nv">b</span><span class="p">)</span>
<span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nb">></span> <span class="nv">a</span> <span class="nv">b</span><span class="p">)</span>
<span class="p">(</span><span class="nv">euclid-gcd</span> <span class="p">(</span><span class="nb">-</span> <span class="nv">a</span> <span class="nv">b</span><span class="p">)</span> <span class="nv">b</span><span class="p">)</span>
<span class="p">(</span><span class="nv">euclid-gcd</span> <span class="nv">a</span> <span class="p">(</span><span class="nb">-</span> <span class="nv">b</span> <span class="nv">a</span><span class="p">)))))</span></code></pre></figure>
<p>Now, Common Lisp does provide Euclid’s greatest common denominator algorithm as a standard library function in the form <code class="language-plaintext highlighter-rouge">gcd</code> but I chose to make my own, <code class="language-plaintext highlighter-rouge">euclid-gcd</code> regardless. What I found is that this function seemed to work (of course, I can’t test it for all numbers, but we know that by proof given in the book, it works.</p>
<p>Furthermore, this is where things get insane. The book poses the question of “<em>If we picked any two numbers at random, what is the probability that they are relatively prime?</em>,” and it provides a lengthy proof involving the Riemann Zeta function that proves that the probability is \(6/\pi^2,\) or roughly 0.61 (or about 61%). I wanted to test this empirically, so I wrote the following function:</p>
<figure class="highlight"><pre><code class="language-lisp" data-lang="lisp"><span class="p">(</span><span class="nb">defun</span> <span class="nv">test-probability</span> <span class="p">(</span><span class="nv">to-see</span> <span class="nv">max-value</span><span class="p">)</span>
<span class="p">(</span><span class="k">labels</span> <span class="p">((</span><span class="nv">test-probability-recursive</span> <span class="p">(</span><span class="nv">total-seen</span> <span class="nv">prime-pairs</span><span class="p">)</span>
<span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nb">>=</span> <span class="nv">total-seen</span> <span class="nv">to-see</span><span class="p">)</span>
<span class="p">(</span><span class="nb">/</span> <span class="nv">prime-pairs</span> <span class="nv">total-seen</span><span class="p">)</span>
<span class="p">(</span><span class="k">progn</span> <span class="p">(</span><span class="k">if</span> <span class="p">(</span><span class="nb">=</span> <span class="mi">1</span> <span class="p">(</span><span class="nv">euclid-gcd</span> <span class="p">(</span><span class="nb">random</span> <span class="nv">max-value</span><span class="p">)</span>
<span class="p">(</span><span class="nb">random</span> <span class="nv">max-value</span><span class="p">)))</span>
<span class="p">(</span><span class="nb">incf</span> <span class="nv">prime-pairs</span><span class="p">)</span>
<span class="no">nil</span><span class="p">)</span>
<span class="p">(</span><span class="nv">test-probability-recursive</span> <span class="p">(</span><span class="nb">1+</span> <span class="nv">total-seen</span><span class="p">)</span>
<span class="nv">prime-pairs</span><span class="p">)))))</span>
<span class="p">(</span><span class="nv">test-probability-recursive</span> <span class="mi">0</span> <span class="mi">0</span><span class="p">)))</span></code></pre></figure>
<p>and with the following test, running the function 10 times, generating 10,000 pairs each time and selecting values within \([0, 10000]\):</p>
<figure class="highlight"><pre><code class="language-lisp" data-lang="lisp"><span class="p">(</span><span class="nb">loop</span> <span class="nv">for</span> <span class="nv">x</span> <span class="nv">from</span> <span class="mi">0</span> <span class="nv">to</span> <span class="mi">10</span> <span class="nb">do</span>
<span class="p">(</span><span class="nb">format</span> <span class="nv">T</span> <span class="s">"~f~%"</span> <span class="p">(</span><span class="nv">test-probability</span> <span class="mi">10000</span> <span class="mi">10000</span><span class="p">)))</span></code></pre></figure>
<p>I empirically observed the result</p>
<figure class="highlight"><pre><code class="language-text" data-lang="text">0.6068
0.6089
0.6052
0.6054
0.6129
0.6033
0.5967
0.6007
0.6056
0.6029</code></pre></figure>
<p>So, wow! It was true! I honestly couldn’t believe my eyes when I saw this. That’s just the power of number theory, we could calculate a limit to a problem like that that seemed so random and neigh-unanswerable.</p>
<p><em>Note: This post is currently unfinished for some reason. Check back in later to see if I ever ended up coming around to finishing it!</em></p>
Mon, 28 Jul 2025 11:30:18 +0000
https://moofy.org/posts/excursions-in-number-theory/</link>
https://moofy.org/posts/excursions-in-number-theory/mathematicscommon-lispin-progressprogramming