Mythruna

Development => Blog => Topic started by: pspeed on February 12, 2013, 11:11:18 PM



Title: Question about trees...
Post by: pspeed on February 12, 2013, 11:11:18 PM
I've been pondering some things and I come to a point where I may have to break a bit of backward compatibility.

Before I go too deeply... I'm not saying old worlds won't work.  Just that some of the "seamlessness" may be broken.  I'll explain.

Right now the actual generation of the world happens at the tile level.  So a 32x32 part of the world is generated that makes the actual blocks.  Some things like caves (and later towns, buildings, roads, etc.) have a set of descriptors at the 1024x1024 level and then the 32x32 tile sees what intersects it and just injects those parts in during the generation process.   This is nice for a few reasons... not the least of which is that plugins can specifically control what goes into a piece of land because generation of these features happens in two stages: 1) a 1024x1024 level descriptor is generated for a whole "node", 2) the individual 32x32 tiles just pull what they need to make the actual blocks.  Plugins can therefore add to the descriptor... I think I even demoed this once for caves by making a huge crater.

Most things are setup to work this way... except trees.  Trees are generated 100% as part of tile generation.

I don't know if any of you have ever noticed this, but there are places where you can stand and see an entire line of treeless land.  This is because when trees are generated they have to completely fit within the tile and cannot bridge over into the next tile.  In many cases, this is kind of hidden because trees from one tile can go right up to the border and the neighboring tile can also have the same.  But it's more likely that there is a gap... especially in the tree trunks which will never be closer than 3-4 blocks away from a tile border.

I want to move trees over to be more like the other things... where their placement is calculated at the node level (1024x1024 area).  This means that they will be able to fall between tiles and stuff... but it also means that I can a) use this info as part of other generation steps if I want, and b) someday have smarter tree placement based on the larger area.  Currently, the tile 10 meters away from the beach doesn't even know that it is 10 meters away from the beach.  That makes flora-variation a little trickier.

It also means that plugins would be able to add or remove trees as needed for whatever effect they desire.  Clearing an area and planting a grove there, etc..

Now the problem.

While the placement of trees is consistent, it is also random.  But that randomness is based on the specific order that the random was requested.  So if I go with the node-based approach, trees will end up in different places.  I could fix this but the calculation costs would be kind of high for what I get out of it and then we go back to having trees never cross a tile boundary, etc..

How will this look?

Well, for any existing world it may mean that when you go to an area you've never been before that you end up with just part of a tree.  Sometimes this might be a trunk sitting right at a tile boundary with just half of the tree there.  Other times it might be a bunch of leaves floating in the air.

I think this is a fairly small price to pay to bring the architecture in line.  But I thought I'd check with the community.

As I said, I can keep it backwards compatible with some extra time and effort but it hardly seems worth it to me.  Pretty soon there will be plenty of reasons to start new worlds anyway so the effect is minimal to me.

Thoughts?

P.S.: This is also what I need if I'm ever going to put trees in the "far terrain" views I've showed.


Title: Re: Question about trees...
Post by: Moonkey on February 12, 2013, 11:38:44 PM
This is for the better of Mythruna. Our creations don't last forever! So you get a thumbs-up from me. Creating things on a node grid sounds like fun :) (Or just seeing things on a grid)


Title: Re: Question about trees...
Post by: pspeed on February 13, 2013, 12:22:43 AM
This is for the better of Mythruna. Our creations don't last forever! So you get a thumbs-up from me. Creating things on a node grid sounds like fun :) (Or just seeing things on a grid)

Well, they aren't actually created "on a grid".  It's just the area I generate at one time.

And for those of you who didn't notice the problem with the current trees, you probably won't see any difference except if you happen to see a floating tree part in an existing world.


Title: Re: Question about trees...
Post by: FutureB on February 13, 2013, 01:46:46 AM
i havnt been pedantic enough to notice this so im not sure if many other people will have... it sounds good paul so i say go and do it :p


Title: Re: Question about trees...
Post by: BigredRm on February 13, 2013, 06:40:58 AM
Burn it all down. I will rebuild.


Title: Re: Question about trees...
Post by: pspeed on February 13, 2013, 06:52:35 AM
Burn it all down. I will rebuild.

Funny you should put it that way since this is also the prerequisite for someday being able to chop down or burn down trees and have them fall over.


Title: Re: Question about trees...
Post by: G1ZMO on February 13, 2013, 11:46:23 AM
Sounds fine to me Paul.

Maybe I'm missing the point but you mentioned that it could lead to partial trees in places e.g. leaves floating in the air. Wouldn’t the leaves just fall to the earth due to the new physics?

btw I wouldn’t be averse to starting from scratch again

Paul


Title: Re: Question about trees...
Post by: pspeed on February 13, 2013, 01:02:19 PM
Sounds fine to me Paul.

Maybe I'm missing the point but you mentioned that it could lead to partial trees in places e.g. leaves floating in the air. Wouldn’t the leaves just fall to the earth due to the new physics?

btw I wouldn’t be averse to starting from scratch again

Paul

Physics doesn't affect all blocks, just physical objects.  It would be overly expensive to try to find all floating blocks in the world.


Title: Re: Question about trees...
Post by: BigredRm on February 13, 2013, 02:35:00 PM
I was wondering what would happen to my airship ballon made out of sand with physics intigrated.


Title: Re: Question about trees...
Post by: Michael on February 13, 2013, 03:37:25 PM
*votes yes

I didn't notice that either, I don't care how the generation works much, I just like the game.
Do what you want, and I will enjoy.


Title: Re: Question about trees...
Post by: pspeed on February 13, 2013, 04:24:02 PM
I was wondering what would happen to my airship ballon made out of sand with physics intigrated.

Nothing.  Physics will only affect objects.  At some point there will be a way to convert your floating structures into big objects and they will adopt some physical properties during that conversion.

Any building-related physics I might add in the future would be calculated as you build.  I can't realistically examine the whole world for potential structural problems but I could add it to the building process, ie: as you place blocks I build a model.  I don't know that I will but that's how it would have to work if I did it.

That's kind of the reason switching the tree generation is important... since then I will know where each specific tree was placed and what type it was.  As it is now, if you start whacking a tree trunk block, I have no idea if it was a tree or just a block you placed... and even if I figure out it was a tree, I don't know what blocks above are part of that tree or the five right next to it.  Knowing where all of the trees were placed would give me that.

...also, I can more easily found and calculate forests for determining animal populations, wood cutting resources, etc..  It's a lot of win in the long run.


Title: Re: Question about trees...
Post by: BenKenobiWan on February 13, 2013, 05:48:44 PM
So the only downside would be occasional floating trees? I don't think that's too much of a problem to me.


Title: Re: Question about trees...
Post by: danny on February 13, 2013, 06:09:34 PM
I vote don't worry about backward compatibility and make the change.

Is this a future plan for after the alpha release, or ate you looking at implementing this soon?  Frankly, I think working at backwards compatibility to make trees look perfect isn't worth your time.  For individual games, I think people will dismiss it.  On servers, well, I imagine most of the server world will have been viewed and determined anyways.  Eventually, the issue will be moot.


Title: Re: Question about trees...
Post by: Moonkey on February 13, 2013, 11:05:19 PM
I vote don't worry about backward compatibility and make the change.

Is this a future plan for after the alpha release, or ate you looking at implementing this soon?  Frankly, I think working at backwards compatibility to make trees look perfect isn't worth your time.  For individual games, I think people will dismiss it.  On servers, well, I imagine most of the server world will have been viewed and determined anyways.  Eventually, the issue will be moot.
I think sooner. Hey Paul, after this update, how far will Alpha be? 4 Months? *wink* :)


Title: Re: Question about trees...
Post by: Michael on February 14, 2013, 02:13:22 PM
I vote don't worry about backward compatibility and make the change.

Is this a future plan for after the alpha release, or ate you looking at implementing this soon?  Frankly, I think working at backwards compatibility to make trees look perfect isn't worth your time.  For individual games, I think people will dismiss it.  On servers, well, I imagine most of the server world will have been viewed and determined anyways.  Eventually, the issue will be moot.
I think sooner. Hey Paul, after this update, how far will Alpha be? 4 Months? *wink* :)
4 * 10 / 2 - 14.


Title: Re: Question about trees...
Post by: Moonkey on February 14, 2013, 04:23:54 PM
I vote don't worry about backward compatibility and make the change.

Is this a future plan for after the alpha release, or ate you looking at implementing this soon?  Frankly, I think working at backwards compatibility to make trees look perfect isn't worth your time.  For individual games, I think people will dismiss it.  On servers, well, I imagine most of the server world will have been viewed and determined anyways.  Eventually, the issue will be moot.
I think sooner. Hey Paul, after this update, how far will Alpha be? 4 Months? *wink* :)
4 * 10 / 2 - 14.
4 * 10 / 2 - 13*


Title: Re: Question about trees...
Post by: Michael on February 14, 2013, 04:29:34 PM
I vote don't worry about backward compatibility and make the change.

Is this a future plan for after the alpha release, or ate you looking at implementing this soon?  Frankly, I think working at backwards compatibility to make trees look perfect isn't worth your time.  For individual games, I think people will dismiss it.  On servers, well, I imagine most of the server world will have been viewed and determined anyways.  Eventually, the issue will be moot.
I think sooner. Hey Paul, after this update, how far will Alpha be? 4 Months? *wink* :)
4 * 10 / 2 - 14.
4 * 10 / 2 - 13*
4 * 10 / 2 - 15*


Title: Re: Question about trees...
Post by: Moonkey on February 14, 2013, 06:30:42 PM
Now you're just going higher! D:


Title: Re: Question about trees...
Post by: pspeed on February 14, 2013, 06:58:49 PM
Depends on how much of the physics I get done and whether I'm able to put the rest all back together.

My 6 months may become 5.5 months.


Title: Re: Question about trees...
Post by: BenKenobiWan on February 14, 2013, 08:30:03 PM
Now you're just going higher! D:
4*10/2=20
Unn's first was 6, yours was 7, his second was 5.

5.5 months! It's getting so close to being near to approaching alpha!


Title: Re: Question about trees...
Post by: Michael on February 14, 2013, 08:44:15 PM
Now you're just going higher! D:
4*10/2=20
Unn's first was 6, yours was 7, his second was 5.

5.5 months! It's getting so close to being near to approaching alpha!
after 6 months of it being 6 months away, it is now 5.5;
Paul's view of a month and the reality's is extremely different :)

EDIT: in 31 months it will be alpha :D


Title: Re: Question about trees...
Post by: pspeed on February 14, 2013, 10:19:17 PM
Now you're just going higher! D:
4*10/2=20
Unn's first was 6, yours was 7, his second was 5.

5.5 months! It's getting so close to being near to approaching alpha!
after 6 months of it being 6 months away, it is now 5.5;
Paul's view of a month and the reality's is extremely different :)

EDIT: in 31 months it will be alpha :D

I've already explained my math. :)


Title: Re: Question about trees...
Post by: Moonkey on February 15, 2013, 04:20:44 AM
Now you're just going higher! D:
4*10/2=20
Unn's first was 6, yours was 7, his second was 5.

5.5 months! It's getting so close to being near to approaching alpha!
after 6 months of it being 6 months away, it is now 5.5;
Paul's view of a month and the reality's is extremely different :)

EDIT: in 31 months it will be alpha :D

I've already explained my math. :)
Paul apparently travels through time.