White Shining Rock Logo
White Shining Rock Logo

Code Rot

April 17, 2022 | Dukus | 70 Comments

Code rot is really a thing. If you've got some source code and you leave it along for too long, it stops working properly. It doesn't matter that the source hasn't actually changed. Really!

Maybe you've made major changes to some parts of your code, not realizing that other parts were dependent on it. Maybe you're calling that code in a new way or with new parameters. Maybe you changed a compiler option that causes problems. It could be almost anything. Either way when you start using that code again, it takes some work to get it running properly again.

It happened to me this week. I'm on the cusp of changing how some things are rendered in game, and so I need to add a few features to the graphics part of my engine. At the moment I've got two ways to output graphics. I like coding with DirectX, but I also support OpenGL for multi-platform purposes. So when I make changes to the really low level rendering code, I have to write it for each API.

I haven't actually used the OpenGL output in a while. And why would I? The graphics code has been stable for a long time, what I expect to get rendered is what I see, and there's so many other things to work on that how pixels end up on the screen is far and away. There's pretty much no reason for me to go into settings and change it. But I switched to the OpenGL output to start work on my new features and... ugh, the output is ugly.

So I start fixing things. And fixing one thing shows another problem, and so on, and so on... This is how the latter part of my week went.

  • First, I see the entire terrain is black. Array textures aren't being setup properly.
  • Once fixed, the surface normals on the terrain are wrong. Using multiple render targets doesn't work.
  • Fixed that, the terrain renders correctly again, but no shadows! Cascaded shadow maps don't work.
  • Okay, now shadows render but depth-bias isn't set correctly so there's shadow acne.
  • Things look better! Oh wait.
  • Ugh, terrain decals are rendering black in some cases! Not all shaders are outputting normals. DirectX is strangely okay with this?
  • Distant object LOD shaders are failing to compile. There's a bug in my shader compiler.
  • Two sided stencil isn't working. It was never tested or used since initial implementation.
  • I can't turn off multi-sample anti-aliasing! How did I never write that code?
  • Ansiotropic filtering is always off. My query for the maximum filter value is failing.
  • Okay, totally got it. Um, no. Save games don't load graphics resources when using OpenGL?! That's... odd and seemingly unrelated.
  • Sigh, there's a new background loader that didn't have an active OpenGL shared render context to load meshes, shaders, and textures.
  • Ugh, an assert when I draw to draw debug helpers? What, the assert is just wrong? At least it's an easy fix.

Why? Why!? Other than array textures, I haven't added any major features dealing with graphics since I initially wrote it!

The problem is that I've been merrily adding things over the last few years, and the OpenGL renderer hasn't been used. All the rendering features I wanted were in the code. But the ways they were getting used was different from when I wrote it initially. I also never shipped a game with the GL code, so a lot of the code paths that weren't followed or tested heavily had issues. Blah.

I know, I know, you think I should have some sort of unit testing for my graphics output.

Anyway, spent the last three days fixing things. Graphics coding is notoriously hard to debug. Difficult to find issues, but pretty much each one of the problems above was a one or two line code fix. But now things look nice, and in fact I can't tell which rendering path is being used now without checking settings.

I'm sure I have more of this code rot in the code. I haven't been using certain systems like achievements or audio with this new project yet, so I'm willing to bet as soon as I start, there will be more junk to cut out and clean.

What was it I was going to add again before I started fixing things?

Leave a Reply

Your email address will not be published.

70 comments on “Code Rot”

  1. What’s the benefit of having DirectX support if you are going to support OpenGL anyway?

  2. Isn't OpenGL a dinosaur by now, superseded by Vulkan?
    I also remember how horrible performance under OpenGL is from a few different games.
    I also believe the two major graphic card companies don't release OpenGL drivers (that were always buggy mess to begin with) anymore.

  3. I only support OpenGL in my own game engine, but even just that can be difficult, as different drivers support the API differently. I've had players report bugs that I couldn't reproduce on my hardware, because the GPU was of a different brand.

  4. Just a casual abserver here, and lover of Banished. I really enjoy reading about your progress, good, bad and otherwise. EXTREMELY curious and excited to witness this game and eventually play it. I'll buying it as soon as I can.

  5. Hello sir. I am a C++ programmer living in South Korea. I enjoyed playing your game 'banished' when I was an undergraduate and studying development.
    And I've been reading your posts about engine development all the time. ( i'm used Google Translate, because i'm not good at English)

    Reading your post made me want to start developing a game engine like you. Although it is not enough to be called a game engine right now, I would like to make a fun game like you someday.
    Thanks for reading.

  6. Hi Dukus! Just like many of your readers, I used to play Banished that I liked very much. As a former 8 bit Asm and C developer (now fiddling with Unity) I really appreciate your posts that remind me the pleasure of native code.
    Game engines like Unreal or Unity are just incredible regarding cross platform distribution and deployment but will never bring the pleasure to code everything by yourself (which of course is just impossible for complex games like AA ones).
    But you prove, year after year, that games of extreme quality and depth can be achieved by one person.
    I'm also eager to discover your new project.
    Bon courage!

  7. to be honest I came here for why there is nothing new but when i read this as a non developer I m just admire of your hard work. Keep doing it an update us. I can't wait to play your next game.

  8. Luke, time for another update how its going? Please? (we are all so looking forward to the next one!)

  9. Just a quick few words to say am a massive fan of banished man, its one off my all time favorites and still play on a regular basis both modded and original. love reading these updates for your new game.. i actually feel like am part of its production just without giving you any input lol. By sounds of it u been having quite a few issues.. bet you glad you managed to deal with them.. for now anyway. Keep up the exellent work your doing dude cant wait for alpha to be released ill be one of the first to purchase. Cant wait to see/read more as you progress.

  10. Hope you find the time to sue the ever-loving crap out of Gleamer Studio for ripping off your IP. All the effort you put into making a true classic, to have it ripped off like that is just, a total douchebag move on their part.

  11. Good morning, when will we have a new game or a new improvement in the current game? from the news, it's been a while since there's a sign of life....hehehehe

  12. The last post is now almost 7 months old. Maybe he died, or decided to be a chef instead of a game developer?

  13. Hey, how about just saying hi on here so we all know you are still alive? 8 months and.... nada. Merry Xmas btw.

  14. I think he must still be alive. Obviously, someone is still paying the website's hosting bills.

  15. Ok here's an idea... just come on and tell us the new game is dead and you have gone off to live a comfortable life on the millions we would think you made from Banished. No one would begrudge you that, but at least you would put us fans out of our misery from this seemingly deafening silence for near a YEAR now.... we all wish you well Luke, just say even a "Hi, I am still alive folks"

  16. Settlement Survival is much more fun than Banished! China based Gleamer Studio owns Shining Rock!
    OK, if an insult like this doesn't wake him up, I don't know what will...

  17. Maybe playing that Chinese knock off will scratch the itch I can't otherwise satisfy on Android...

  18. I'm approaching 600 hours on Banished and it never gets old!
    Thank you for this amazing game. Keep up the faith for the sequel!

  19. Just wanted to say hi. Thanks for Banished, and good luck with your current project. Hope the negative comments won’t discourage you. Take all the time you need. Your earned it.

  20. Hope that you are well, that your current project is progressing, and that you're enjoying the process. Very much looking forward to an update.

  21. Hi Dukus, thank you for the interesting post. Don't let the negative comments influence your life. You don't owe anyone anything. I'm still loving Banished and I'm thankful for your time. Have a nice day!

  22. Are you still working on the game? Did you give up on working on it because its was such a spaghetti mess of code?

  23. Hope you're doing alright! If you're still planning on developing the new game, godspeed! If not then best of luck in your endeavours 🙂

  24. Bro you good? Please say something, it doesn't have to have anything of substance just give us a sign of life.

  25. Luke, your lack of response is scaring your fanbase - and you do have a big one. I honestly now just don't care about the new game as its clear its probably dead in the water, but could you just do some simple comment or update to the site so we all know you are at least still alive, it hasn't been touched by you for 2 years!

    And if anyone out there reading this has more recent info on Luke, please put it here for us all to read - thanks.

  26. Hey brother. I'm a little late to the site, but I've loved Banished since it was first published, logged a few hundred hours in it over the years. I hope you're well, and that you had a lovely holiday season! Take your time man, these things are hard enough with a big crew attached, I can only imagine the workload as a solo developer! Thanks again for an amazing game, we're all out here rooting for you!

  27. Like others have said, hope you’re doing well. Loved Banished and came to check in and see how you were doing. Sending love and care from Chicagoland.

  28. Hello! Hoping to see more update on anything! You're an inspiration to programmers such as myself!

  29. Hello, to add up previous users comments - thanks a lot for Banished! I hope you are well. The page is still on, so I assume you didn't give up on game development. I miss your articles so if you think about a comeback, please do!

  30. I say this as an almost 50-year-old gamer who's been playing every game under the sun since the 80's: Banished was as close to a perfect game as I've played. Hope to see another release from you sometime.

  31. I'm glad to hear that you are working on something new. Banished is one of my all-time favorite games. I am a gamer who loves losing myself in a brilliantly designed game that leaves the player open to create and explore. Looking forward to playing your next masterpiece. Good luck!

  32. 2 years without an update. Yeah, I have been scanning obits also. I wish some info on if he is ok would come out.

  33. Please comeback back. I loved your first game and would love to see the whats next.
    I hope everything is alright with you

  34. Hello!

    I revisit your website often in hopes of an update, but its been silent for two years.
    Hope you're doing well and that everything is alright!
    Thank you for all the years of entertainment that Banished has given so far.

    Take good care of yourself.

  35. Hey , 10years later, you are the best.
    Your game is 100x better manord lord.
    Thx for all, i Still play .<3

  36. Hello Luke,

    Are you still working on this new game? Have not seen anything from you in quite some time

    Take care,

  37. Hi,
    Hope you're doing well and that everything is alright! Banished has a special place in my heart and I revisit it every couple of months.

    Best wishes.

  38. just know that at any given moment there is someone (several hundred according to steam data) playing this game. You are helping create memories for people, you are helping people escape the troubles of the world even if its just for a brief moment. You're game is still so beloved because people can tell how much love has been put into it. Not only that but the games intentions are so pure, you aren't trying to make people addicted and empty their wallets <3 whatever you're doing take all the time you need, don't feel pressured and enjoy the fact you're game has only had a positive impact on this world. peace and love homie dawg

  39. So are you still alive / working? 🙂 No updates for a few years.. have been looking for a game as good as yours, tried a few 'Early Access' games that should not have been released yet etc.. none are as good. Hope you are OK 🙂

  40. started playing again after 10 years, STILL such a fun and addictive game. Hope the next game is still in the works!

  41. I've loved playing Banished (especially with the CC update), too, and was hoping for an update on a new game when visiting this site. Clearly, the developer has abandoned any new games. If ya'll have played Anno 1800 yet, it.is.amazing!!! Unlike in Banished when I seemed bored waiting for an event, Anno will definitely keep you busy. And...the developers are continuously making it better and have a real future game they are working on. Farewell Banished!

  42. Hi, I really like playing Banished. I played it couple of years ago, and has been playing since recently again.

    It's a really good building/management game that keeps me entertained and is thought through on a good level. It is also challenging on a hard level, which is cool, it's like cracking a puzzle.

    Thought I'd find any news about any new projects from you here, as I think they'd be just as good. I hope you're okay.

More Posts

UI Redo: Part 3

October 25, 2021
1 2 3 47
Back to devlog
Back to devlog
© Copyright 2021 Shining Rock Software
Website Design & Branding by Carrboro Creative
menu-circlecross-circle linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram