Raven's biggest feature is its speed, which we accomplish by (a) refraining from doing flagrantly slow things, and (b) eliminating complicated abstractions that make it difficult to keep an eye on which parts of the code are growing slow:
Limited Subset of C++. Raven's basically all C. We use C++ to overcome the inconvenient low-level nature of C — we use member functions,
lambda, and a gross
defermacro — but we don’t structure our app in C++: no private fields, constructors,
new, inheritance, polymorphism, RTTI, or STL. Instead of RAII we just zero our memory.
This has the delightful consequence that when we want to know how something in our code is done, we just go and read the code that does it. There's no more jumping back and forth between ten classes, trying like a detective to mentally piece together a history of events. This lets us see immediately if we're doing anything slow.
Treat Errors As Another Code Path. We don’t use exceptions for ordinary error handling, because errors aren't exceptional. They should just be another code path with well-defined behavior. Our program doesn't suddenly do something mysterious (and maybe slow, who knows) when an error happens.
Custom Memory Management. Calling
mallocis a great way to drop a frame. We allocate a huge chunk of memory at the beginning, then manage it ourselves using fixed-size buffers, stacks, arenas, and pools (see Game Engine Architecture). This (a) is much faster, and (b) forces us to actually think hard about our memory usage, instead of pretending we have infinite memory and being shocked when it turns out we don't.
This model of memory is actually more consistent with reality. We only get a fixed chunk of memory that we have to manage ourselves, you say? You mean kind of like an actual computer?
No External Libraries. When you’re building something hard, external libraries cost more than they're worth. Anything written by someone else is code you don't own. You end up having to (a) beat your program into the right shape to integrate with the library and (b) reason about your program in terms of the constructs the library gives you. God help you if the library has a bug, or does something stupidly slow.
Far better to own all of your code, so your program lies entirely within your field of vision and control. We only use two libraries in our whole app, ImGui and stb.
One Process, One Thread. Our whole application is one big update-render loop. No IPC, synchronizing multiple threads, or client-server architecture with JSON over HTTP. Poof goes a whole source of bottlenecks, complexity, and bugs.
We make some exceptions; our parser uses threads to parse multiple files at a time. But we don’t use processes or threads to partition our application into modules.