So I've decided to create a simple game engine for learning purposes & I've decided to use minimum possible third-party libraries(but of course I'll use some of them for topics where I know nothing or very little). I've also decided not to use STL at all and minimum possible help from CRT(e.g. no malloc or free, no default new/delete etc).
But after this said, now I have 2 main questions at this point of time:
- How to link(in terms of C++ building process) engine, editor & game itself. Many engines have games as an instance of some class(e.g. Application) that has several methods to control game flow(OnStartup, OnWorldLoaded, OnGameTick, OnShutdown, etc). Game also can create & register methods for custom events(keyboard, mouse, window, network, etc). But afterward I have no idea where I have to put an editor in this system(because the editor should not be a part of the engine, because the engine has to be able to work without an editor in release builds). Also another question is should I make a game as dll and engine as exe or they have to be linked statically(this may be a good solution for public builds, but what about Debug mode & problem with editor linking).
- The second big question now is memory management. I want to do it myself instead of using default malloc/free or new/delete. There are few reasons for this: low & high-level profiling, different allocators for different tasks and so on. But I haven't found any good materials on this topic. Most of them use strategy "allocate a big block of memory during startup & use it as it is", but I don't think this is a good idea, especially when we talk about modding possibility because then we don't know how much memory the game will use. I don't want to support consoles at all, so the main platform, for now, is Windows with its virtual memory and maybe later I'll try to add support of Linux & OSX. Now I have 2 main strategies of memory management in mind: create a GlobalHeap class(which will be a singleton) & do all allocations from it(and probably create different allocators for containers or resource system or rendering system) and another way of doing things is to create some kind of allocator hierarchy, where there is a PlatformHeapAllocator, which manages allocations from platform layer, and BlockAllocator, which works just like PlatformHealpAllocator, but it gets memory from another allocator instead of platform layer, and StackAllocator for per-frame allocations or PoolAllocator for fixed-size allocations. I've tried to find how modern AAA game-engines do this, but due to my lack of experience in this topic I haven't found anything suitable. In fact, memory management is the reason why my previous try to make a game engine failed before it event started.
So after all this being said, I hope you will share your thoughts on this topic and help me to do right choice, I'll be thankful.