Logs Happy to Spawn Anywhere

Title: Logs will freewilly spawn wherever they damn please, it’s like they don’t even care!

Summary: So when you trop a tree down, it drops logs. These logs seem to have no care in the world what is there when they spawn, they will just spawn there anyway.

Steps to reproduce:

  1. Chop several gazillion trees down in a forest
  2. Observe the logs. The overlapping ones glow (mentioned in another of my bug reports). Some trees may also have a log in their trunk (sounds like either a euphemism :wink: or perfectly natural, but the attached picture should show what I mean.

Expected Results: Logs may only spawn where there’s space.

Actual Results: They do not. They will just spawn randomly regardless of what is there.

Notes: Obviously I can’t see the engine, so I can’t be sure of my theory, but I feel somewhat confident in it. Scold me if I’m wrong though :stuck_out_tongue:

Attachments:


Here you can see the log in the trunk and overlapping, glowing logs. :blush:

Versions and Mods: Alpha 3 Latest Release, no mods

System Information:

  • Acer Aspire E1-571
  • i5-3230M 2.6GHz
  • Intel HD Graphics 4000
  • 4 GB RAM
2 Likes

It’s not exactly anywhere, it is randomly though and aligned to the grid if I’m not mistaken. It doesn’t check if there’s anything in the way.

This is an issue that can hardly be dealt with, however. What would the proper way be? Have the logs stack on each other? Spawn them further away? Abort chopping? Each one of those techniques could potentially be abused for one thing or another, especially if there are things that spawn lots of things, such as large trees.

1 Like

I apologise, yes locked to the normal constraints of the grid and the distance from the tree it can be.

I’m not really sure. To be honest I would prefer it not spawn inside trees etc. and I should check to see if trees next to hills actually lose logs because they spawn in the mountain, which would be an annoyance, though I don’t mind them spawning inside each other so you could have all 5 together in one square glowing super bright. I suppose the problem with that is that potentially you could have no free space, and then they have nowhere to go.

I think they are using the terrain-place-entity function, which means that in the very worst case, the log would spawn on the upper level. I don’t think they use any other function to spawn stuff to avoid these undergrounders.

With the entities-in-area function it could be possible to figure out a spot that is currently not taken, but as said before, the problem arises when there are no spots available. At that point, you will be forced to do something. In the very worst case, you simply ignore the chop attempt and “lock” the tree until space becomes available (check every X seconds to see if an item was moved). That means you lose one chop-animation worth of time, but it would avoid these issues.

Mmhmm. It’s rather difficult, isn’t it? The glowing-bright is a rendering “issue” that happens when entities are overlapping each other, similar to Z-fighting. In the current state, it is rather helpful to see where multiple entities are stacked on top of each other.

A first solution could be, of course, to implement an algorithm that checks for empty space and if there is none available, spawns it randomly somewhere. This could probably hurt performance a bit, but then again you’re unlikely to spawn resources that often in locations that are filled I’d say?

Aha! Yeah I just reported that bug too, and you’ve confirmed my suspicions on that one :blush:

Yeah I would lean toward this. It can’t be that common an occurrence that there is no space, surely? Unless of course you have built your whole settlement right around the trunk of a ‘holy tree’ and have for some reason have now decided to chop it down :slight_smile: