Land survey algorithm

Thoughts on the further development of Haven & Hearth? Feel free to opine!

Land survey algorithm

Postby Dakkan » Wed Feb 07, 2018 7:07 pm

Currently the land survey tool has a bias for digging/filling in from the northernmost point of the survey towards the south, probably just how the code searches for the next point needed to dig/fill at.

Problem:
When doing a land survey to substantially lower a large piece of uneven terrain, frequently the character will waste time digging only 1-2 units of soil at a time on the side of an uneven slope, despite having a shovel that allows the play to dig much more. The max difference in terrain elevation, combined with an uneven peak causes this. If the algorithm selected instead the highest point of the survey to dig and work downward, this should increase efficiency of digging and reduce the number of times they'll need to revisit the same node.

The same issue appears with filling in an uneven pit, though not as common for me at least.

So when digging downward, the character should chose the highest (diggable) point of the surface instead of just the northernmost one. And when filling in, select the lower diggable point.

One advantage to the current system is that by constantly focusing on the northern side (or any side, instead of peak elevation), this creates a flat surface sooner which is beneficial to placing dirt stockpiles for holding the remaining dirt to be dug. On a highly uneven starting surface, digging from peak elevation down might have a very "noisy" surface until the bottom of the survey is reached. Maybe a toggle in the survey menu, "Favor maxima/minima, Favor one edge."

tl;dr: survey digging logic should favor digging from the highest points, not the northernmost points. Maybe a toggle though for the occasions where an edge bias is more important than a peak bias.
User avatar
Dakkan
 
Posts: 666
Joined: Thu Dec 12, 2013 2:58 am

Re: Land survey algorithm

Postby loftar » Wed Feb 07, 2018 7:43 pm

It actually chooses the point closest to the player character, and I myself have never noticed any deviation from that.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 9051
Joined: Fri Apr 03, 2009 7:05 am

Re: Land survey algorithm

Postby Dakkan » Wed Feb 07, 2018 7:54 pm

loftar wrote:It actually chooses the point closest to the player character, and I myself have never noticed any deviation from that.


I should have been more specific, I mean that if you start digging in the center of a survey, and all vertices around you are acceptable targets for the next dig operation, it is biased towards the northern one. Then east/west, then finally south. I'm guessing just on how it loops through the check of available nearest vertices.

Instead I was thinking of initially a total check on the entire query for the highest diggable vertex, then highest adjacent vertex after that.
User avatar
Dakkan
 
Posts: 666
Joined: Thu Dec 12, 2013 2:58 am

Re: Land survey algorithm

Postby Fierce_Deity » Wed Feb 07, 2018 8:04 pm

I guess this is somewhat reasonable...but ultimately the result is the same no?
Fierce_Deity
 
Posts: 783
Joined: Thu Feb 12, 2015 4:11 pm

Re: Land survey algorithm

Postby Dakkan » Wed Feb 07, 2018 9:52 pm

The ultimate result without any survey system and just digging each vertex manually is also the same.

I'm just suggesting an alternate way that the survey system can choose vertices that should greatly reduce the number of steps to finish a survey. Not sure about the operations cost behind the scenes however, which could be a problem.

edit:
Image
This is a simplified example. The point where I dug could only be lowered two units due to the height of a nearby vertex. Then, the character checks the nearest vertex and digs those, even though they will now only be diggable by 2 units. Eventually the character reaches the bottom of the incline with these small digs, then heads to the top and digs the vertex that was originally holding back the character from digging more. Sure, in this example the problem would vanish after this happening a few times, but frequently with very unlevel surfaces it will happen over and over and over, significantly extending the time it takes to level a survey. For the record in this example the first 11 digging events my character only dug up 17 soil.

Instead if the highest point was chosen first, then the highest adjacent side and so on, it would ensure that the digger would always excavate the maximum possible amount their shovel is capable of with the exceptions of unusually placed surveys.
User avatar
Dakkan
 
Posts: 666
Joined: Thu Dec 12, 2013 2:58 am

Re: Land survey algorithm

Postby jorb » Thu Feb 15, 2018 1:42 pm

Will consider, at least.

EDIT: Won't change the code due to other cases becoming less optimal -- prioritizing the highest point prevents multiple people from using the same survey, for example -- but a simple fix is to position the character at the highest point manually.
"The psychological trials of dwellers in the last times will be equal to the physical trials of the martyrs. In order to face these trials we must be living in a different world."

-- Hieromonk Seraphim Rose
User avatar
jorb
 
Posts: 18437
Joined: Fri Apr 03, 2009 7:07 am
Location: Here, there and everywhere.

Re: Land survey algorithm

Postby Dakkan » Thu Feb 22, 2018 7:43 pm

jorb wrote:Will consider, at least.

EDIT: Won't change the code due to other cases becoming less optimal -- prioritizing the highest point prevents multiple people from using the same survey, for example -- but a simple fix is to position the character at the highest point manually.


Two players can't work the same survey though?

I guess I just want the player to choose the highest neighboring tiles to dig from after a digging event, otherwise the closest diggable point. This way the character might work their way towards these troublesome peaks when they show up.
User avatar
Dakkan
 
Posts: 666
Joined: Thu Dec 12, 2013 2:58 am

Re: Land survey algorithm

Postby jorb » Thu Mar 01, 2018 11:30 am

Two players can indeed work the same survey.
"The psychological trials of dwellers in the last times will be equal to the physical trials of the martyrs. In order to face these trials we must be living in a different world."

-- Hieromonk Seraphim Rose
User avatar
jorb
 
Posts: 18437
Joined: Fri Apr 03, 2009 7:07 am
Location: Here, there and everywhere.


Return to Critique & Ideas

Who is online

Users browsing this forum: Claude [Bot], Selles and 82 guests