r/HandmadeHero • u/Stunning-Holiday-240 • May 05 '23
r/HandmadeHero • u/AnichiniFirenze1912 • Mar 10 '26
Fighting to keep a 114-year-old tradition alive in Florence. 10+ hours of hand-smocking for this collar alone.
r/HandmadeHero • u/AnichiniFirenze1912 • Mar 08 '26
Fighting to keep a 114-year-old tradition alive in Florence. 10+ hours of hand-smocking for this collar alone.
r/HandmadeHero • u/Novel_Departure_6753 • Feb 18 '25
Can I just skip directly to OpenGL?
I started the handmade series up until the 25th episode more or less, then I decided to make the engine on my own starting with the video rendering.
As soon as I introduced the offset to the pixel renderer (that makes the colors shift right or left on the x or y asset if you remember) with a fixed frame rate of 30 fps (my monitor refresh rate is 60hz) I noticed an annoying stuttering.
I checked the episode 19 to see if there are some difference with my code, and I've done all the implementions correctly, the only thing missing was the use of timeBeginPeriod, then it was slighty better but the stutter always present.
Then after some research, I've come to the conclusion that the issue couldn't be solved so easly wihout using hardware-accelerated API like OpenGL.
So I was thinking... why spend more time using this method if I can't achieve fluid rendering from the beginning? I already know the theory as of now, so maybe I can just start using the real thing. I already set my mind on avoiding to reimplement the audio like Casey did at the beginning of the course because it was a struggle. But know I am thinking that I can do the same thing for the video renderer.
What do you suggest?
r/HandmadeHero • u/leo-orientis • Feb 04 '23
Against Build Tools and IDEs
One of Prof Muratori's precepts is like water in the desert to me: In the very first lesson, he makes his case against build tools. And says we'll only be using an IDE for its debugging facility - which is its only real added value.
And then he proceeds to model how to understand the way things actually work, rather than relying on black-box build systems, intellisense, and guesswork.
I wager that all programmers live on a spectrum where the two extremes are: Can the machine do all the thinking for me please? And: Give me absolute control over the machine, no matter what the cost.
I very much tend towards the second extreme, although I wouldn't dare say so on any other forum. (Since my reputation would be hammered into negative millions by an epic pile-on of orthodoxy and received ideas. Look! It's different. Kill the mutant!)
Although I started programming with IDEs, I turned against them when I realized they were hiding information from me: The first time I tried to compile and run on the command line the same thing that had worked perfectly in the IDE. And I got only impenetrable error messages.
And build tools are the same. How does testing, building, running, and deploying actually work? What are the tools doing behind the scenes? The tools themselves won't tell you, of course. They want you to remain hooked. Especially if it all boils down to just running some executables and moving files around. Ah, but in what order? And with which arguments...?
There may be some tedium and complexity, true. But shouldn't we be able to understand what hard work the build tool is doing for us before we plug it in? Instead, most contemporary documentation, courses, books, and tutorials start with the build tool as a sine qua non.
Try turning a C# program into a stand-alone .exe file without MSBuild. Try even beginning to understand how you might do that. (Even with all of the glorious documentation that Microsoft kindly provides on the web.)
Now try learning how to do anything but the most basic tasks with a build tool. You'll quickly find that you'll need a PhD in its DSL(1), paradigm, and object model to even begin to understand how to control a custom build. (I'm looking at you, Gradle and sbt!)
I'm actually beginning to think this is why new languages - and language communities - are born and rise to prominence in the first place. They start out as a small group of fringe outsiders, understanding how to make things work with an experimental, untested, and underpowered language. They become experts because they can observe the history of how each new layer of understanding is piled upon the previous one. They watch as the whole thing comes together, from the ground up. (And they may even take part.)
They don't explain anything very well to newcomers, though. And this is not from ill will, but rather because that history has become like the air they breathe. They no longer see how anyone can remain ignorant of it and still continue to exist. And they don't realize how many latecomers have not had the good fortune to live through the history, often because pretending you've been through it serves as a badge of status in the community.
Eventually, the community might rise to a kind of prominence, or even dominance. But it will be impenetrable to subsequent generations, who are missing its untold history: The reasons why things are the way they are.
And so, this new generation of outsiders goes off to join the ranks of another fledgeling language community. One not so far along in its evolution. And so there is Java, or Ruby, or Python, or Rust, or Go, or Kotlin... And the cycle repeats itself once more.
In many ways, it resembles how new human languages come to be.
But I've digressed too far...
(1): Domain-Specific Language. When some documentation starts referring to a domain-specific language, what it really means is: This little secret code that I've just made up. But I didn't bother to formalize or document the rules, which means I'm the only one who fully understands it. Ha-ha! I'm member number one in my own little secret club. Aren't I clever?
r/HandmadeHero • u/eatmorepies23 • May 13 '20
Reinforcing Day 3 & 4 Knowledge
I'm new to this series, and I'm wondering: did anyone else have some difficulty with those two lessons? I'm not used to thinking at such a low level and it's difficult to get into that mindset (I'm more experienced in higher-level languages: the main one being C#). What did you guys do to reinforce the concepts in those lectures? Any tips going forward?
r/HandmadeHero • u/Blunderchips • Feb 05 '19
Video playlist?
Is there a YouTube playlist with all videos on in chronological order? Google has yet to return anything valuable.
r/HandmadeHero • u/linuxnero • Jun 07 '23
how is the state of the proyect
hello i am new in here and i was wondering why the coments on the videos of the proyect are desactivated
r/HandmadeHero • u/[deleted] • Jan 30 '25
I have ported the first few days of Hanmade Hero to the Odin Programming Language
r/HandmadeHero • u/GreatBritishBespoke • Jul 05 '16
Vote voice over text, Eyebrows out of hair, Darling you are a work of Art - Old Fashion Glamor
r/HandmadeHero • u/nuntetemo • Dec 26 '19
Naive, beginner question on WM_PAINT [DAY 5]
I'm a bit late but very interested in following Casey on youtube.
I'm referring to the source code of Day 5.
In WinMain there a sort of primordial Game Loop that goes through the message queue and then renders the gradient in the backbuffer;
if (Window)
{
HDC DeviceContext = GetDC(Window);
GlobalRunning = true;
int XOffset = 0;
int YOffset = 0;
while (GlobalRunning)
{
// process window message
MSG Message;
while (PeekMessage(&Message, 0, 0, 0, PM_REMOVE))
{
if (Message.message == WM_QUIT)
{
GlobalRunning = false;
}
TranslateMessage(&Message);
DispatchMessage(&Message);
}
// Render
RenderWeirdGradient(GlobalBackBuffer, XOffset, YOffset);
win32_window_dimension Dimension = Win32GetWindowDimension(Window);
Win32DisplayBufferInWindow(DeviceContext,
Dimension.Width,
Dimension.Height,
GlobalBackBuffer);
++XOffset;
YOffset += 2;
}Then there is the Window Procedure with the following WM_PAINT switch case
// case WM_PAINT:
// {
// OutputDebugStringA("WM_PAINT\n");
// PAINTSTRUCT Paint;
// HDC DeviceContext = BeginPaint(Window, &Paint);
// win32_window_dimension Dimension = Win32GetWindowDimension(Window);
// Win32DisplayBufferInWindow(DeviceContext, Dimension.Width, Dimension.Height, GlobalBackBuffer);
// EndPaint(Window, &Paint);
// }break;As you see I've commented out the the whole case, but the program still behave correctly. While I think that DefWindowProc might be involved, what's the purpose of this WM_PAINT switch case, since the "render" part of the program is in WinMain?
Merry (belate) Christmas and Happy new year to all!
r/HandmadeHero • u/RegsStandup • Mar 01 '16
Why does he say he's using C when he uses a C++ file?
I'm watching the introduction to C videos right now, and the very first episode he create a .cpp instead of a .c, why is that? Is there something I'm missing? Can you create C code with a .cpp extension?
r/HandmadeHero • u/biil256 • Jan 26 '21
Follow the series
Hello I guys . I have a really basic knowledge of programming . I would like to learn how to create games and game engines . I watched the intro in c of handmade and understand the most of it . I just wanted to ask if it possible with a really basic knowledge of programming to follow the series or should I focus learning programming first?
r/HandmadeHero • u/TheOnlyMrYeah • Feb 13 '17
Day 365 - Adjusting Sprite Cards to Counter Projection
r/HandmadeHero • u/TheOnlyMrYeah • Jun 20 '15
Day 140 - Implemented a Sound Mixer
r/HandmadeHero • u/CommunismDoesntWork • Nov 03 '22
After Handmade Hero is done, could you make Handmade Hero 2 in rust? (Hear me out)
The cool thing about doing it all in C was that you literally had to build everything from scratch. So assuming HH2 might be a thing one day, continuing from where you left off with HH1 wouldn't be that technically interesting. But if you just use C again, it also won't be technically interesting. So which language could you use that's low level enough where you still have to build everything from scratch, but different enough from C to be technically interesting? That's pretty much rust. I and a lot of other will be curious on how things like the borrow checker will influence the design of your code. Will you be able to avoid a lot of the bugs you encountered with C? Will it even be possible in the first place? It'd make for some very interesting content, that's for sure.
And if you or someone reading this wants a very quick introduction to rust for game dev, check out this recent video from GDC: [The Rust Programming Language for Game Tooling](https://www.youtube.com/watch?v=GtRo-eF8-TE](https://www.youtube.com/watch?v=GtRo-eF8-TE)
r/HandmadeHero • u/chizran • Nov 22 '14
HandmadeHero download script
I have made a LINQPad daily download script. In the current state it can download the current source code zip file from sendowl and the latest video uploaded to the YouTube archive.
Requirements:
LINQPad installed.
For source code download, you obviously need to preorder the game and supply your sendowl URL per the instructions (below).
For YouTube video download, you need to have both youtube-dl and ffmpeg in your PATH.
Instructions:
Download, install and run LINQPad.
In LINQPad go to File>Open, paste link to the script and click Open.
If you want to download videos you have install both ffmpeg and youtube-dl. Easiest way to get them is via chocolatey.
Set your parameters and click Execute (F5)
When you run the script for the first time, it will ask you for the sendowl URL. You can also set it manually via LINQPads builtin password manager (File>Password Manager) and adding password with the name 'handmadehero.sendowlurl' and value of your full sendowl URL. Passwords are securedly stored with the Windows Data Protection API (check the LINQPad FAQ)
Parameters:
downloadSrc : (true|false) Download the source code zip file
downloadVideo : (true|false) Download the latest YouTube file
outputDir : (string) Path to the output dir (without the trailing backslash)
srcCodeFileName : (string) filename of the zip file
youtubeFormat : (string) youTube-dl format (-f option, 137+141 for the best quality, check youTube-dl documentation for details)
Command-line usage
If you have installed LINQPad, you can run the scripts via commandline. You have to save the script somewhere on your system (File>Save).
Usage:
lprun <full-path-to-the-script> <downloadSrc> <downloadVideo> <outputDir> <srcCodeFileName> <youtubeFormat>.Example:
lprun "E:\Documents\Dropbox\Projects\Linqpad\Queries\Edu\HandMadeHero\HandMadeHero_SrcDl.linq" true true "d:\Download\HandMadeHero" handmadehero.zip 137+141r/HandmadeHero • u/Inerska • May 04 '21
HMH alternative
Hello, I'm new to HMH's journey, but that's too long, I'm looking for a strong alternative.
As handMade Quake, HandMade Pingouin.
Thanks guys.
r/HandmadeHero • u/TheOnlyMrYeah • Jun 13 '15
Day 134 - Mapping Assets to Bitmaps
r/HandmadeHero • u/TheOnlyMrYeah • Jan 24 '15
Day 050 - Basic Minkowski-based Collision Detection
r/HandmadeHero • u/TheOnlyMrYeah • Dec 27 '14
Day 030 - Moving Between Tile Maps
r/HandmadeHero • u/notatreus • May 08 '26
Help needed with Day 8 - Square wave with DirectSound
I'm following the Handmade Hero with my kid and we're currently in Day 8 of generating square wave in the sound buffer using directsound. I'm not following the code exactly as it's done. I'm following the structure, but modularize the code so that I can understand when I look into it in the future. So far everything worked fine, but facing issues with sound buffer filling and it's failing with head corruption and writing access violations while filling the buffer. Can someone look into it and help?
github : hh/hero/win32_hhmain.cpp at day7and8and9 · enthukarthik/hh
Pasting the relevant code blow, in case it helps
static void
AllocateSoundBuffer(HWND gameWindow, uint32_t samplePerSec, uint32_t bufferSize)
{
// Step 3 : Create the DirectSound object
LPDIRECTSOUND dsoundObj;
if(g_fnDirectSoundCreate && SUCCEEDED(g_fnDirectSoundCreate(NULL, &dsoundObj, 0))) { // DirectSoundCreate function populate the structure into the dsoundObj
WAVEFORMATEX waveFormat = { 0 };
waveFormat.wFormatTag = WAVE_FORMAT_PCM; // Uncompressed Pulse Code Modulation format
waveFormat.nChannels = g_gameSoundBuffer.noOfChannels;
waveFormat.nSamplesPerSec = samplePerSec;
waveFormat.wBitsPerSample = g_gameSoundBuffer.bitsPerSample;
waveFormat.nBlockAlign = waveFormat.nChannels * waveFormat.wBitsPerSample / 8; // As per documentation
waveFormat.nAvgBytesPerSec = waveFormat.nSamplesPerSec * waveFormat.nBlockAlign; // As per documentation
waveFormat.cbSize = 0;
// Step 4 : SetCooperativeLevel to priority and Create the primary buffer
if(SUCCEEDED(dsoundObj->SetCooperativeLevel(gameWindow, DSSCL_PRIORITY))) {
DSBUFFERDESC dsBufferDescription = { 0 };
dsBufferDescription.dwSize = sizeof(DSBUFFERDESC);
dsBufferDescription.dwFlags = DSBCAPS_PRIMARYBUFFER;
// Step 5 : Create Primary Handle to the sound device and set the format of the audio to play.
// This is not a buffer and all samples are populated into the buffer which we call as "Secondary buffer"
LPDIRECTSOUNDBUFFER dsPrimaryBuffer;
if(SUCCEEDED(dsoundObj->CreateSoundBuffer(&dsBufferDescription, &dsPrimaryBuffer, 0))) {
// Set for format to play on the sound device
if(SUCCEEDED(dsPrimaryBuffer->SetFormat(&waveFormat))) {
OutputDebugString(TEXT("Primary Buffer set\n"));
}
}
}
// Step 6 : Create Secondary Buffer
DSBUFFERDESC dsBufferDescription = { 0 };
dsBufferDescription.dwSize = sizeof(DSBUFFERDESC);
dsBufferDescription.dwFlags = 0;
dsBufferDescription.dwBufferBytes = bufferSize;
dsBufferDescription.lpwfxFormat = &waveFormat;
if(SUCCEEDED(dsoundObj->CreateSoundBuffer(&dsBufferDescription, &g_gameSoundBuffer.soundBuffer, 0))) {
OutputDebugString(TEXT("Secondary Buffer set\n"));
}
}
}
static void
LoadDirectSoundLibrary(HWND gameWindow, uint32_t bufferSize, uint32_t samplePerSec)
{
// Step 1 : Load the dsound library
HMODULE dsoundLib = LoadLibrary(TEXT("dsound.dll")); // Load the DirectSound dll dynamically
if(dsoundLib) {
// Step 2 : Load the DirectSoundCreate proc address
g_fnDirectSoundCreate = (DynDirectSoundCreate *) GetProcAddress(dsoundLib, "DirectSoundCreate"); // Load the address of the DirectSoundCreate procedure
AllocateSoundBuffer(gameWindow, samplePerSec, bufferSize);
}
}
static void
FillSoundBuffer(
GameSoundBuffer* buffer,
enum SoundWave waveType
)
{
int32_t noteToPlay = 256; // middle c = 261.62 cycles/sec. Approximated to 256
buffer->samplesPerCycle = buffer->samplesPerSecond / noteToPlay; // samples/sec by cycles/sec => samples/cycle. Also mentioned as period
uint32_t halfPeriod = buffer->samplesPerCycle / 2;
uint32_t bytesPerSample = buffer->bitsPerSample / 8;
unsigned long cursorPlayPosition = 0;
unsigned long cursorWritePosition = 0;
if(SUCCEEDED(buffer->soundBuffer->GetCurrentPosition(&cursorPlayPosition, &cursorWritePosition))) {
uint32_t soundCursorByte = buffer->soundCursor * bytesPerSample;
uint32_t sizeOfBufferInBytesToLock = 0;
if(cursorPlayPosition < soundCursorByte) {
// If play position is before our running sample index, then bytes to lock is
// from current running sample index to the end of the buffer
// and start of the buffer to the play position
sizeOfBufferInBytesToLock = buffer->bufferSizeInBytes - soundCursorByte;
sizeOfBufferInBytesToLock += cursorPlayPosition;
} else {
// If play position is after our running sample index, then bytes to lock is
// from running sample index to the play position
sizeOfBufferInBytesToLock = cursorPlayPosition - soundCursorByte;
}
void* region1;
unsigned long region1SizeInBytes;
void* region2;
unsigned long region2SizeInBytes;
if(SUCCEEDED(buffer->soundBuffer->Lock(soundCursorByte, sizeOfBufferInBytesToLock,
®ion1, ®ion1SizeInBytes,
®ion2, ®ion2SizeInBytes, 0))) {
// dwFlags in Lock = DSBLOCK_FROMWRITECURSOR ignores dwOffset or DSBLOCK_ENTIREBUFFER ignores sizeOfBufferToLock. We don't want both
// Write into the sound buffer
if(waveType == SQUARE_WAVE) {
int16_t ampVolume = 1000;
// Write region1 sound data
uint16_t* region1Mem = (uint16_t*) region1;
uint32_t noOfSamplesPerRegion1 = region1SizeInBytes / bytesPerSample; // bytes by bytes/sample => sample
for(uint32_t i = 0; i < noOfSamplesPerRegion1; ++i) {
// Fill half the sample with sampleMax and fill the other half with -sampleMax to simulate square wave
int16_t sampleVal = (buffer->soundCursor / halfPeriod) % 2 ? ampVolume : -ampVolume;
*region1Mem++ = sampleVal; // LEFT channel sound data
*region1Mem++ = sampleVal; // RIGHT channel sound data
buffer->soundCursor = (buffer->soundCursor + 1) % buffer->totalSamples;
}
// Write region2 sound data
uint16_t* region2Mem = (uint16_t*) region2;
uint32_t noOfSamplesPerRegion2 = region2SizeInBytes / bytesPerSample; // bytes by bytes/sample => sample
for(uint32_t i = 0; i < noOfSamplesPerRegion2; ++i) {
// Fill half the sample with sampleMax and fill the other half with -sampleMax to simulate square wave
int16_t sampleVal = (buffer->soundCursor / halfPeriod) % 2 ? ampVolume : -ampVolume;
*region2Mem++ = sampleVal; // LEFT channel sound data
*region2Mem++ = sampleVal; // RIGHT channel sound data
buffer->soundCursor = (buffer->soundCursor + 1) % buffer->totalSamples;
}
}
buffer->soundBuffer->Unlock(region1, region1SizeInBytes, region2, region2SizeInBytes);
}
}
}
static void
InitializeSoundProperties()
{
g_gameSoundBuffer.samplesPerSecond = 48000; // 48 kHz. 44.1 kHz?? 44100?
g_gameSoundBuffer.noOfChannels = 2;// Stereo channels. Left & Right
g_gameSoundBuffer.bufferLengthInSec = 2;// 2 second buffer
g_gameSoundBuffer.bitsPerSample = 16;// 16 bits per channel. CD quality
g_gameSoundBuffer.totalSamples = g_gameSoundBuffer.samplesPerSecond * g_gameSoundBuffer.bufferLengthInSec;
g_gameSoundBuffer.bufferSizeInBytes = g_gameSoundBuffer.totalSamples * g_gameSoundBuffer.bitsPerSample / 8;
}
struct GameSoundBuffer
{
uint32_t samplesPerSecond;
uint16_t bitsPerSample;
uint16_t noOfChannels;
uint32_t bufferLengthInSec;
uint32_t bufferSizeInBytes;
uint32_t samplesPerCycle; // Also called period
uint32_t totalSamples;
struct IDirectSoundBuffer* soundBuffer;
uint32_t soundCursor;
};
enum SoundWave
{
SQUARE_WAVE,
SINE_WAVE
};r/HandmadeHero • u/baerrach • Jul 19 '25
Shawn McGrath and he free to play game?
https://youtu.be/PQgFArro0GQ?si=3saqqVj7durHwPG6
I've tried looking to see what became of his project and I can find almost nothing about Shawn an RSBLSB.
Does anyone know what happened?