Jump to content
  • Advertisement
  • entries
    29
  • comments
    99
  • views
    52204

To rewrite, or not to rewrite?

Sign in to follow this  
Migi0027

1513 views

When I first started doing "semi serious" graphics programming, I called it Cuboid Engine, because it sounded cool and my first accomplishment was, well, a cube! So througout the development I was basically just putting lots of things together, and my only concern was:

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. smile.png

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! dry.png
    • Move things around and clean up
      +Less time and efford!
      -The result wont be as good as rewriting sad.png

      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! happy.png
Sign in to follow this  


2 Comments


Recommended Comments

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.

 

Thats also a good point, and its most likely true, however normally when I rewrite anything the structure turns out much better. At least this happened with the previous rewrite.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!