This is a regularly-occurring status update. More generally-relevant posts can be found under Features (see Creating a Game and Engine from Scratch for context).
This is the beginning of week 6.
What I have done
- Initialized Direct3D 12 and cleared the window
- Calculate timing of display refresh so that vblanks can be predicted
- I am able to display horizontal color bars on the display without vsync enabled and with only clearing the entire window by properly timing and predicting when to swap the back buffer
- This is something that I’ve wanted to do for years after reading about it and so it was fun to finally make it happen. I will make a dedicated post about it once I have cleaned up some remaining problems.
- Added the ability to specify C++ compile optimizations and update the project configurations accordingly
Next Steps
- Improve display timing
- There are still problems that I don’t understand. Rendering without vsync isn’t important because the real engine won’t work that way and so it’s fine if the fun demo of color bars doesn’t work perfectly. What is important, however, is that the underlying timing information is correct for what I want to do with the real engine and I’m concerned with some of the behavior that I occasionally see that I don’t understand because it could lead to hard-to-diagnose problems later.
- Even though I did the color bars as a fun project they are actually a really good way to visualize whether the timing is correct and so I think it is good to keep working on it before I undo the fun temporary hacky code and make things work the way that they are supposed to.
- Create a separate thread for the display loop and the game logic
- I was going to delay doing this until later, but as I’ve been working on the swap chain code I think it would be good to get this more formalized early
- Draw a triangle
- I had thought about adding better input next but for now I can just detect key presses using
GetAsyncKeyState()
in a hacky way and that means I can quickly experiment without having to go through an application layer. So I think I have changed my mind and that it is a better idea to keep working on the graphics system for the moment.
- I had thought about adding better input next but for now I can just detect key presses using