World of Banished

MODS Garage => Tips and Help => Topic started by: embx61 on May 06, 2017, 04:45:51 AM

Title: Digging in the ground help
Post by: embx61 on May 06, 2017, 04:45:51 AM
Can someone explain how to dig in the ground?

I have a mesh in 3ds max, just a simple textured hollow walled box (1x1x1 Meter) for testing and set it below the Z axis so only a little part is higher then the groundlevel (0) and use the quarryfloor from Luke's Quarry building in my code.

In max I copied the box and named it floor and pushed it aside.

I made the FloorMesh file in the Model directory and set the quarry object in the building template file to -1 and -1 depths. ( I take it -1 is 1 game tile?)

The building (box) is placed but the terrain is still seen in the game it won't make a hole.

It is probably something simple  I overlook or my shovels just suck so they can't dig LOL
Title: Re: Digging in the ground help
Post by: Bartender on May 06, 2017, 05:17:02 AM
I've only done some testing with the quarry type of floor, but there's two possibilities I thought of when I read what you tried.
- I would suspect that the floor mesh needs to be a horizontal plane rather than a box. As it uses the z-levels of the mesh to determine the depth, it probably gets confused if there are multiple z levels on the same xy coordinates.
- I've noticed that for proper behaviour, you need a mesh with a sufficient amount of vertices per tile. I'm not sure how this works, perhaps it just needs at least one vertice in a tile, but subdividing my planes generally solved problems if the hole I created was not exactly following my floor mesh.
Title: Re: Digging in the ground help
Post by: embx61 on May 06, 2017, 05:22:23 AM
Thanks @Bartender

I make the floor mesh just a plane and see if that works. :)
Title: Re: Digging in the ground help
Post by: embx61 on May 06, 2017, 05:38:22 AM
No dice.

It does do something to the terrain as I see it moving a bit when I put the mesh down
bool flatten set to false. A picture is sometimes better the words.

The square two walls with a plane under the ground level but the green ground level is still seen.
There is a dark patch in the middle what is not a texture as the floor is your water material mesh :)

I try to make irrigation channels as many players requested this.

(http://worldofbanished.com/gallery/474_06_05_17_5_32_25.jpeg)

And this is what I have in Max.
The plane is a water mesh.

(http://worldofbanished.com/gallery/474_06_05_17_5_40_53.jpeg)
Title: Re: Digging in the ground help
Post by: tanypredator on May 06, 2017, 06:13:53 AM
Ohhh, quarries... So much time digged into them...

If you want just to make a hole (or channel), you don't need quarry mechanics. With that many modders can help you (not me - I managed to achieve that once, but after a long struggle, and the result was bad) - RedKetchup, Kid. You need quarry mechanics only to make gradual digging, but I have never seen this done by any modder.
Title: Re: Digging in the ground help
Post by: embx61 on May 06, 2017, 06:27:57 AM
@tanypredator

Thanks, Red is using the quarry floor in his claypit mesh.

I am making some progress and jus keep churning at it till I get it.
Title: Re: Digging in the ground help
Post by: Tom Sawyer on May 06, 2017, 06:42:25 AM
Quote from: tanypredator on May 06, 2017, 06:13:53 AM
You need quarry mechanics only to make gradual digging, but I have never seen this done by any modder.

I see. Tany never played a nordic round .. digging a clay pit in the ground. ;)

For gradual digging you have to make a simple mesh like on this picture to define the ground level for each tile after 100% digging. The rest comes by float _maxDepth = -3.0; float _initialDepth = -0.5; in this case to start at -0.5 tiles and end at -3 tiles depth when 100% of maximum production is reached.
Title: Re: Digging in the ground help
Post by: embx61 on May 06, 2017, 06:55:22 AM
Thanks @Tom Sawyer

Picture is very helpful.

I don't need gradual digging though and the channel will only be about 1 tile square and about 1/2 tile deep.

I keep playing with it till I figure it out or Red send me a sample of his Medieval channel mesh. The smallest one will do.
Title: Re: Digging in the ground help
Post by: RedKetchup on May 06, 2017, 07:56:13 AM
hello

sorry not have been there :S


if i check your .max screenshot ....
the plane you have selected, to the right, what is its height ? z=-1 ? (is it the lowest plane of your mesh that you made a copy and put to the right ?
or it is the highest one of your mesh ? (it need to be the lowest if i check your design)

here 1 of my canal so you can check
Title: Re: Digging in the ground help
Post by: embx61 on May 06, 2017, 08:00:54 AM
Thanks Red

The lowest plane is the floor. I deleted the rest.

I making some progress and see a hole. The hole need some work though as it looks a bit strange in the game but it is a improvement :)
I will check the Medieval channel file :)
Title: Re: Digging in the ground help
Post by: tanypredator on May 06, 2017, 08:03:11 AM
Quote from: Tom Sawyer on May 06, 2017, 06:42:25 AM
Quote from: tanypredator on May 06, 2017, 06:13:53 AM
You need quarry mechanics only to make gradual digging, but I have never seen this done by any modder.

I see. Tany never played a nordic round .. digging a clay pit in the ground. ;)

For gradual digging you have to make a simple mesh like on this picture to define the ground level for each tile after 100% digging. The rest comes by float _maxDepth = -3.0; float _initialDepth = -0.5; in this case to start at -0.5 tiles and end at -3 tiles depth when 100% of maximum production is reached.

I hadn't, sorry  :-[

I tried to make similiar model, definitely not so smooth (just a rough draft), and it worked very bad (as it got digged to final condition quickly and that condition was not right). Thank you for this information, maybe once I'll get back to my idea of small square quarry.
Title: Re: Digging in the ground help
Post by: RedKetchup on May 06, 2017, 08:12:24 AM
Quote from: tanypredator on May 06, 2017, 08:03:11 AM
I tried to make similiar model, definitely not so smooth (just a rough draft), and it worked very bad (as it got digged to final condition quickly and that condition was not right). Thank you for this information, maybe once I'll get back to my idea of small square quarry.


yeah i always found the process very ... iffy ^^

the way i found it work best and most constant is working with 1x1 tiles pieces placed at x=0 y=0 z=asIwant
like if i need to make 1 of 2x2 , i go for 4 pieces of 1x1 placed at (0,5 0,5 ; 0,5 -0,5 ; -0,5 -0,5 ; -0,5 0,5 )
it works better when there isnt a single pixel going further inside the next tile. sometime, the game react weirdly if a pixel go further
Title: Re: Digging in the ground help
Post by: Bartender on May 06, 2017, 12:12:43 PM
I noticed that determining the depth is a bit weird. Since there are a max and min depth in the quarry code, I first assumed that those would be the only thing determining the actual depth. It turns out that the z value of your mesh is actually more important. If your plane is at z=-2 for example, then no matter what min and max depths you put, it will never go lower than -2. From what I can tell it seems that the min-max depth are only there to assign cutoff points, so that it doesnt go above or below that regardless of what the z values are.
Title: Re: Digging in the ground help
Post by: embx61 on May 06, 2017, 12:55:39 PM
The quarry code is for the stonecutters. They go deeper as the game progresses and more stone is mined.

But I found out that the irrigation channels are hard to do because of the scale.

A 1x1 tile will create a hole far outside the bounderies of my mesh seen from the top and bigger irrigation channels are just meh.
That is why redKetchup's channels have very thick blocks on each side to keep the slopes of the hole inside those blocks.
Title: Re: Digging in the ground help
Post by: QueryEverything on May 06, 2017, 06:55:52 PM
@embx61 is it worth possibly looking at how Kralyerg made his terraform tool (http://blackliquidsoftware.com/index.php?/files/file/32-terraform/)?  Or is that not what's needed?
(I'm not sure on the specifics for you, nor for the tool ;) )
Title: Re: Digging in the ground help
Post by: embx61 on May 06, 2017, 07:07:33 PM
@QueryEverything

I figured out how to do the digging.
But for irrigation channels the holes going to be too wide.
I can avoid it but then the channels going to be at least two tiles wide, maybe even 3 and that is just too big for just Irrigation Channels.

I even put a road next to the channel and the ground came up covering my water.

I looked at the example mesh RedKetchup send me and his walls of the channels are pretty thick (More then a tile on each side just to cover the slope up).
But his channels are 6 tiles wide and for traffic that is fine.

I thinking about making them a bit above groundlevel with some small wooden dams or even dikes on each side.
I have a test done and that works.

I have to make an end piece and corner piece beside the straight piece.
Title: Re: Digging in the ground help
Post by: QueryEverything on May 06, 2017, 08:14:11 PM
@embx61 that sounds really excellent :)
Also (and I know it's too late, but it just occurred to me) that @Necora managed small declines in his latest mod, with the riffles, they were gentle slopes, not the harsher ones.  If that's of any help for you, for the future.    But, just with my trials just now, it still ends up 2 wide, not 1. 



So, I like your idea :D  I think it will add a little creativitiy to farming (??) and a little bit of height to normally flat areas.  :D



Title: Re: Digging in the ground help
Post by: RedKetchup on May 06, 2017, 11:21:45 PM
i suggest you @embx61  to go with 1 tile wild pieces in the map description code.
and do 2 tiles wild mesh centered in the middle which will cover a bit each side. since it is an irragation canal, you dont need to dig deep ! go for a 0,5z or even 0,4z or 0,3z

and also with a very little hole , if people decide to delete them, the ground is still can be used for other things :)
gonna send you my road tiles mods when i dig just a very little 0,3z and see.

Title: Re: Digging in the ground help
Post by: embx61 on May 07, 2017, 03:49:51 AM
Thanks Red

Received the PM and take look at your example :)