4 ms·
Beginners tend to get way too consumed by granular resource allocation and freeing. Often writing lots of verbose nonsense because the language/standard librar
by pengaru 3y ago
Beginners tend to get way too consumed by granular resource allocation and freeing. Often writing lots of verbose nonsense because the language/standard library don't come with abundant abstractions out of the box to obviate the need for such things. Learn to build those abstractions when you find yourself repeatedly doing a bunch of tedious rigamarole-y resource management code, diy trivial allocators are very common in games for a reason. e.g. Allocate in a leaky manner by encapsulating those allocations in an allocator instance you can throw away at the end of a procedure, or at the end of every frame, or end of a level, etc.
Since the goal is a vintage console like PSOne I'd probably stick with C89 at most, unless you know the toolchains you'll be using are modernized.
Also when it comes to video games, unless you're writing something like an MMO server side component, robust error handling w/recovery is generally a tremendous waste of time and code. Use assert() and use it often. e.g. Don't try to handle and recover from a malloc() failure, just assert malloc() doesn't return NULL in your wrapper. It's a video game, not Apache.