Small Ideas, Big Changes

As I’ve been working lately, I’ve been very aware that seemingly simple things I wanted to have in a new game have huge implications on the difficulty of making a game and engine.

The first thing I wanted to change from the previous game was the ability for the camera to look up toward the horizon. In Banished the camera always looked down, and the higher the camera got, the more the ability to look up was limited.

This was great for performance – it limited the number of objects drawn, and no graphics models needed simpler level of detail (LOD) versions. The terrain was simple. I didn’t have to have a fancy sky drawn, nothing had to be drawn past the mountains at the edge of the map. The drawback was that you couldn’t ever see the whole settlement once it got large. You also couldn’t move around very quickly.

Now with that simple change – looking up, and zooming farther out there’s more work to do. All models need some of LOD to keep the triangle count down and keep highly detailed objects from aliasing in the distance. The terrain now has LOD as well. Having LOD on the terrain makes texturing it and having decals on it harder. And brings in other problems like objects disappearing or floating because the terrain is less detailed in the distance. I also have to draw to the horizon, ocean or mountains, the sky, the sun.

Drawing shadows also takes more time. Instead of a single shadow map based on what’s visible, to draw to the horizon takes multiple shadow maps, various tricks for distant shadows, and more complex pixel shaders. This also increases CPU load as 4 shadow maps are drawn instead of 1.

The renderer also has to change to handle this. While it works just fine, it’s slow. Instead of dealing with say 4000 visible objects in view, my current test scenes are dealing with 40000. So the renderer has to be changed to handle culling away and drawing 10 times the number of objects in the same amount of time as before. Granted GPUs are a bit faster than before, but CPU time hasn’t increased the same way.

After the camera change, the next change I thought wouldn’t be so bad is arbitrary layout of buildings. No grids. Grids were great in Banished because it made lots of things simple. Pathfinding was on a grid, placement of objects was on the grid, everything used the grid.

But I want to see organic layouts. I’d like farmed land to follow terrain and butt up against a river. I’d like buildings and roads to placed in whatever natural way they end up being.

But with the grid gone, lots of things are more complicated. Placing objects now requires checking an arbitrary shape against everything else already placed. This requires a spacial subdivision structure to be fast. It’s also harder to visually convey the overlap and how far you might have to move something to get it to fit.

It also adds a little friction to placing buildings. With a grid, you might place 2 buildings and leave space inbetween for something else – because you know its size. With arbitrary sizes, rotations, and shapes this can get harder, and potentially frustrating. When you do want to line up objects, its not as easy either.

Because things are arbitrary, I’m no longer limited to square regions – players can create any shape for an area – which is great, but makes the user interface more complicated. At the same time it can add friction to the experience because you have to spend time layout out areas if you don’t want the results of a quick click-and-drag.

I’ve been working on making placing arbitrary objects and regions as painless as possible, but it’s challenging.

As I wrote about last month, pathfinding has also gotten more complicated. However with the complexity comes flexibility. I have pathing setup such that characters can always walk between buildings, reducing the chance of getting stuck, and decreasing search time while running the A-Star algorithm. Search time is also decreased due to much more open area.

Thankfully, graphics doesn’t get anymore complicated, it was written to handle things in any orientation from the start.

These two seemingly simple changes have caused my game engine to get slightly more complicated. What is hardest is that there’s even more tiny details than I’ve written about that I keep running up against that were unknowable until I ran into them. I’ve spent more time making the features work than expected.

In the end, these changes are good – even I went back to building a grid based game with limited camera. It’s just surprising to see how far reaching a simple design decision can be.

24 Comments

    Ben Doerr
    October 1, 2019 1:01 pm

    Great to hear about the progress.

    John
    October 1, 2019 2:07 pm

    Awesome!

    Laura Marks
    October 1, 2019 2:11 pm

    I love reading about your process. Thanks for the updates!

    Web Dev
    October 1, 2019 2:22 pm

    I always enjoy reading your technical breakdowns. Sounds you’ve gotten it figured out and making some great progress! 👍

    YF
    October 1, 2019 2:24 pm

    You are doing great! Keep up the good work!

    Ab
    October 1, 2019 3:38 pm

    It’s so good to know your work goes on! Keep it up!

    Ced
    October 1, 2019 5:12 pm

    Incredible!!! I’m so impress. Continue you hard work.
    Need to see more. Love from Swiss

    jensenthecat
    October 1, 2019 11:44 pm

    More good news. Progress is always good news.

    Jordan
    October 1, 2019 11:50 pm

    Good to hear you’re still working on this, September was quiet! I got my friend into Banished and she is loving it, can’t wait for the new game!

    I will say that Tropico 3 had a non-grid-based system and was my only complaint about that game. It was impossible to plan space for future buildings even if you had an idea what the size was, and when something couldn’t be placed, there was no tooltip telling you why. Not enough space, not enough curb space, not enough money, one pixel of the terrain was too steep, it was just never explained. Further, plopping one building leveled the terrain it was on to an extent which sometimes made the grade of the around it unsuitable for placement even though it was fine before the placement of the initial building. Sorry for rambling, just some things I thought of while reading your post.

    Looking forward to what’s to come!

    OpblaasHaas
    October 2, 2019 3:48 am

    Can’t imagine the struggle of wanting to implement something “easy” for it to become so complex the more you think about it. But i bet you’re doing an awesome job of figuring it out anyway!

    Luciano Busropan
    October 2, 2019 6:37 am

    Awesome to hear from you once again. 🙂

    shyam
    October 2, 2019 6:46 am

    I don’t know the technical details of grid or non-grid systems. The only thing I wish banished had was to be able to place odd shaped farms. like you have perfect 11×11 area mapped out and only 1 red square ruins your plan. Otherwise grid system works well.

    Massimiliano Zanon
    October 2, 2019 11:55 am

    Hello, i never played Banished but i’ve found this post interesting and i have something important to share with you:

    Cities Skylines showed that making a full drawn environment, even with optimized lods for everything, in a game like this and with a modest engine, it’s incredibly taxing for the hardware, and specifically for the CPU.

    I don’t know if your engine is more or less powerful than the Unity3d they used, but i doubt it would do much better, no offense.

    What may happen, as it already happens with that game, is that the CPU and the engine are unable to handle all of this once the city get to a decent size, with the result of having 20 fps at best and compromised calculations (AI, pathfinding, etc.), even with the highest-end hardware avaiable in the market.

    So, be aware and good luck for all.

    Jon
    October 2, 2019 3:34 pm

    Lovely blog post Luke! I just did read both the previous one and this one. Good luck with all the debugging!

    Ray
    October 2, 2019 6:29 pm

    Have you played Foundation at all? It sounds like what you’re trying to accomplish is similar to what they’re already doing with organic roads and buildings.

    In Foundation, you paint an area for homes, and people will build their homes in that area. Roads are built based on how frequently people go from spot A to spot B (i.e. market to woodcutter).

    Perhaps playing it will give you some ideas.

    Barbara
    October 3, 2019 1:00 am

    Would you consider adding a button that would “Snap” a player to the original camera position? Getting back to square one was always a pain, especially if you accidentally nudged the wrong directional key. This “snap” to original camera might also help you solve the lining up of structures problem… maybe we could “snap” to the previous building’s position. I cannot wait to play your next game. Keep up the hard work!

    Goblin Girl
    October 3, 2019 10:25 am

    I’m sure it’s going to be quite some time before this game is released, but I’m so looking forward to it! Thanks for the update.

    The Double E Show
    October 3, 2019 10:45 am

    As a HUGE fan of your previous work (Banished), hearing the little details of what you are attempting for your newest endeavor is encouraging. I have made Banished a staple on my YT channel. Granted I use mods, but without the wonderful base game, they would be useless. I look forward to see where you go with this new game. And by look forward to, I mean I am chomping at the bit to get my hands on it! ….Waiting with anticipation,
    Jibba73

    Luke
    October 3, 2019 10:55 am

    It would be great if you let the players set the foundations for a given building without any cost, so we can plan out cities more efficiently.

    Jan
    October 3, 2019 11:47 am

    Out of curiosity, do you have any plans for Vulkan support? It seems like these APIs (along with Dx12) lessen the CPU load somewhat.

    Natalie
    October 3, 2019 3:34 pm

    The largest challenge with free form placing, from a user experience point, is definitely the complete freedom of it. As others have mentioned, it makes it hard to plan ahead and to do things like ensure there is proper walkway room between buildings.

    A solution that occurred to me while reading – two sorts of guides one can give to the user while they are placing a building.

    Solution 1: radial tick marks. A series of concentric rings indicating approximate “units” of distance from the building while it is being placed. Basically to indicate to the user how much space they’re leaving between buildings with a little more precision than just eyeballing it. This works best if buildings generally have a grid-based sizing, just to make their specific size easy to remember for a player.

    Solution 2: magnetic repulsion: In this scenario, a potential building is hovering on the cursor and waiting to be placed. When the cursor gets close to an already placed building, the potential building is slightly repelled from the existing one. Basically, as the cursor moves closer to the existing building, the potential building moves a little less close. You could still force the buildings to abut, but it requires more mouse movement. This would decrease the potential of accidentally locking the buildings too tight together, and (because of the increased mouse movement) increase the precision when placing buildings close together.

    Kevin
    October 3, 2019 9:33 pm

    I’d also suggest having the AI decide where roads go, maybe the player paints an area and says “i approve stone roads here” and the AI will determine where high traffic area’s are and begin building roads where it makes sense.

    Your talk about placement makes me think rather than having a person specifically place each building instead they paint zones and let the citizens decide the exact details.

    Guy Eshel
    October 4, 2019 3:43 am

    Good things are taking time to work on, I guess we’ll see the next game in a few years…

    Well, that’s the thing with high-quality games in the last decade, find than 🙂

    EFE MISIRLI
    October 8, 2019 6:42 am

    Thanks for the update, it seems you hit some roadblocks which made you lose more time than anticipated but you’have managed to overcome them. Good luck and give us some screenshots next time 🙂

Post a Comment

Your email is kept private. Required fields are marked *

*
*