Funny. I removed all modules from my C++ codebase (roughly 10% of it) and I got about 10-16% shorter compilation times. Not to mention Intellisense no longer crashing all over the place.
I wonder if it ever be a worthwhile feature to use.
I really like C++, but this is the satanic ritual required to get a file modification date:
auto ftime = std::filesystem::last_write_time("file.txt");
auto stime = std::chrono::clock_cast<std::chrono::system_clock>(ftime);
auto time = std::chrono::system_clock::to_time_t(stime);
auto ltime = std::localtime(&time);
auto year = 1900 + ltime->tm_year;
auto month = ltime->tm_mon;
auto day = ltime->tm_mday;
Engine programmers literally only want one thing and it's fucking disgusting:
> The game has PASSED the Hardware/Software Compatibility and Performance Check with a great majority of systems obtaining excellent performance results.
What's your favorite way of doing type safe flags in C++? I typically just use some enum/int combo, but it's not really type safe and you can combine flags from different sets.
Let's say I write a function like this, in C++17 or later:
inline int Calculate(int a, int b) {
return a+b;
}
I put it in a file called calculate.h and include (and use) it at multiple other places in the code.
Let's assume the function is not inlined at call sites. Due to the inline keyword, the compiler will ensure that Calculate() exists only once. (See https://en.cppreference.com/w/cpp/language/inline)
Question: Will the compiler generate the instructions multiple times, or does it avoid compiling a function body that's already going to be compiled in a different translation unit?
In other words: Do lots of inline functions in header files slow down compilation?
So, like many #GameDev#programming folks, I'm doing a bit of saturday work from home to support the project as it is getting closer to release.
Since my home desktop is primarily a #Linux system, I decided to try and see if I could compile a #Windows game without Windows.
Short answer: No. I could not.
There is actually an #AUR package that gives you a working #MSVC compiler in #Wine, but there is no way to get #MSBuild to work to build .sln and .vcxproj files.
I wonder how much worse the build time would be in a VM 🤔
I was experimenting with colour distances at work today. I need to find out how similar two colours are, so I wrote a little test program and it was surprisingly pretty.
The algorithm is simple:
Fill the canvas with random colours.
Set the first pixel (top left) to red.
For all pixels, find the most similar pixel and move it next to the current pixel.
To determine the similarity, I calculated the 3D distance in the RGB, HSV and YUV color spaces, which brought very different results. Now, it's quite possible that my HSV and YUV conversion functions were just broken, but that's okay.
I also tried turning the comparison function around, such that it looks for the furthest colour instead of the closest one, which also resulted in some interesting patterns.