Does it look pretty, and realistic!?
And if it didnt, it wasnt worth it. So I eventually came to a point where I actually had a graphics engine which wasnt really a game engine, however it was a decent graphics engine, with some performance issues. After a while the code base was pretty messy and there were some naughty hacks that I werent proud of. I didnt really have the patience to move things around and clean up, because it would simply be too much work. So, what can I do?
Rewrite it!
I'm pretty scared of that word, because it reminds me of a lot of work. Rewriting is a lot of work and when I created a new project called "Cuboid Engine 2." I was pretty happy, because of the 2. But the blank screen with the god damn int main()... Personally its a weird feeling, however my codebase is nowhere near the size of some of your guys work, but its all I can do.
So I began thinking back of the previous troubles I had, always writing the same direct3d code every single time! So, I needed a wrapper, thats what people call it, right? So I made my very own cute "CEDX11" class that took care of all the naughty work! Whats the advantage of this?
- No need to always cuddle with Directx ( Even though its a nice SDK )
- No need to repeat code
- Easy to modify
- Easy to upgrade! (DX12, if I ever get my hands on it!)
But Im just a random internet guy whos rabbling about my "easy" problems, because this is candy compared to some stuff!
After a while I had written another graphical engine with some game elements, however a much better engine! It can ( today! ) do some things that Im, well, a bit proud of. Physical Based Rendering ( BRDF ), Light Propagation Volumes, Voxel Cone Tracing ( almost done ) and other things with loads of post processing effects ( Luminance Adaptation, Bloom, SSAO, bla bla bla ). But is it a game engine? Heck no!
Its far from a game engine! Sure you can script in it, run the script and get movable things and skeletal animations or not use a script and communicate directly to the engine. But when I say a game engine, I'm talking about an engine that allows the user to create a game, not a benchmark. Sure in my small engine its easy to create a benchmark! And its pretty flexible in my opinion, Fx. I worked hard on custom coded materials that behaved the way the user wanted them to behave without breaking out of deferred rendering ( That allows the user to work with all the shader stages available ). But a game? No.
The architecture of my engine is not designed to be a game engine, at all. So, actually this does seem like the first case? However the code base isnt messy, its just not designed for this "new" purpose. So what do I do? Well, what can I do:
- Rewrite
+Cleaner and better result
+Can just use the same wrapper again CEDX11 ( Its actually a pretty solid thing, does its job well )
-The effort! + Time! - Move things around and clean up
+Less time and efford!
-The result wont be as good as rewriting
So well, this was it, these are my current thoughts, and sometimes its just nice to write them down even though its actually a pretty small thing.
Until next time!
Evolution, not revolution.
Refactoring doesn't mean it "won't be as good as rewriting." In fact, it might end up being better, since you already have the use cases in front of you and how to improve them.