2 ms·
Yes, here's an example of a case where eliminating a branch will save you as a game developer: while (money > 0) { if (iOS) { // ios revenue
by doctorpangloss 3y ago
Yes, here's an example of a case where eliminating a branch will save you as a game developer:
while (money > 0) {
if (iOS) {
// ios revenue
money += 5;
// ios costs
money -= 2;
} else if (android) {
// android revenue
money += 1;
// android costs
money -= 5;
}
}
Anyway, to your real question, an entity component system-based middleware, hopefully in a language that isn't C++, forces you to author your code in a way where branches can be "moved" to remove the problematic memory access and execution pattern. So maybe it's not about specific C++ method branches, which may be beneficial to your employer but never beneficial to you or your career, but it's about the architecture of the thing that still has innovation opportunities that could really matter.
You probably aren't interested in the even bigger picture conversation, which is that some games are so ill specified that it is impracticable to use an ECS middleware. Games that are really well specified (i.e. clones & sequels) might thrive on ECS, but the ones we end up playing are authored by companies with real budgets and take years to develop, so the compute platform will get faster than your micro-optimization.