Terrain lifted/lowered removed on load


#1

Issue: Loading a game reverts terrain height to default (unless there’s a building on it).
Crash (y/n): No
Platform (Windows/Mac/Linux): Windows (10).
Description: Lifting terrain to create hills or lowering to water level will revert back to default height on the next game load. If there is a building placed on that hill, the terrain directly under the building will remain heightened.
Example:


#2

Wow, nice catch! I’ll dig into that tonight.


#3

One other small issue I’ve noticed is that the scenery object placement is a little iffy… I mean when they place, they place in the correct position, but a lot of the time the placement just isn’t working (despite the fact there is seemingly nothing to restrict them).

For example, that huge open green land in my above photos. I’ll go crazy placing scenery trees and in some areas they’ll place down just fine, other areas it’ll just go red when I click and nothing will happen.


#4

Going red means that the scenery item has detected an obstacle which blocks the position where you’re trying to place it.

Right now, scenery items such as trees check to make sure that they don’t intersect with paths. The older trees and mushroom models have some custom code which changes their bounding boxes to only include the trunk of the tree (approximately) for this test, but all the newer models are still using the whole model bounding box. So… yeah, if you’re trying to place any of the newer variety of props (trees, especially), they’re probably not going to play nicely anywhere near paths, since they’ll be considering those paths as blocking their canopies.

That’s definitely something I need to fix properly.

Oddly enough, scenery items don’t appear to check whether they’re obstructed by buildings, when they’re being placed; only paths. That’s something I should fix, too.


#5

Okay! The terrain lift/lower is now fixed. It was a fun bug in the loading code (the terrain changes were saved correctly; they just weren’t being loaded back into memory).

This might have affected some other things as well; in particular, lots of ‘daily history’ data might also have been affected. This was an issue with loading raw arrays of floating point values or integers. I’ve now fixed it; thanks for pointing it out!

This fix will be in the next build, which I’m very much trying to get out tomorrow.


#6

Hm, the trees weren’t being placed close to any paths when they were turning red. There were seemingly no obstacles that should have been preventing them from being placed. I wouldn’t fuss too much about building obstruction, I can imagine one day I’ll purposefully have a building surrounded by specially placed trees - much like Oasis in Fallout 3.


#7

Can you tell me specifically which tree type you were trying to place? Might be something specific to just one of the models. But… I can’t find anything that should lead to the behaviours you’re seeing; just the code that’s trying not to let you put scenery items intersecting with roads.


#8

I don’t think it’s specific to the model, it’s hard to trace since it’s unpredictable. For example, here’s the issue:

After recording this, I exited and reloaded, same issue occurred. I exited and reloaded again. Suddenly it was working perfectly.
I reloaded a different (earlier) save, the issue was happening again. I reloaded a couple more times and it was working fine. Shut the game down and reloaded my save, issue was happening again.


#9

Thanks for that video! It really shows the behaviour. I guess I have some more debugging to do! :smiley:

Can you send me that save? I’d be interested just to see if it’s something specific to that setup; I still haven’t seen that problem, here…

I should really implement a “report a bug” feature in-game which can upload a save automatically!


#10

I’ve sent the save from the video your way. Hopefully you can get to the bottom of this one, occasionally I’ll load it and it’ll just work fine, I’m thrown for a loop. At first I thought maybe it was something really obvious I was doing wrong!

Good luck!


#11

I’m about to start digging into it right now.

My initial bet is that it’s an uninitialised variable somewhere. We’ll see! :slight_smile:

From the video, it looks like the scenery objects are becoming obstructed when you click; they’re showing white (which means that they’re placeable) as you move them around, but when you click to actually place them, they turn red (obstructed) and don’t get placed. Am I interpreting that correctly?


#12

That’s correct. They appear to be placeable but turn red after left clicking to confirm the placement.


#13

The weird thing about that is that the test for being obstructed is performed every frame, and it’s the same test regardless of whether or not you’re clicking at that moment… I’m a little puzzled about why anything would change when you click, compared against immediately before you click.

It’s an interesting one!


#14

Okay. So far, I’ve been unable to reproduce this. However, the only thing which could cause clicking to fail and the scenery object to turn red like that is if the game thought that the scenery object was intersecting a path.

I’ve made an improvement which will be in the next build; when a path blocks placement of a scenery object or building, the path turns red for a short while. This should make it really visible which path thinks it’s blocking the scenery items, and maybe will help track down what’s going wrong!


#15

I’ve been testing out certain things trying to find a pattern. Only pattern I could find so far:


The road ends before the red arrow. There is an invisible path blocking placement on left-click.