How would you do full programming?

Co
- in Worlds
25

A world of squares (blocks)

The world is generated based on a random number that should not be much more than 10 generated

The world is infinitely big

If you use the same random number, the same texture (block) should be on the same coordinates

The world should not just randomly place blocks they should also fit together so no huge differences in height every 3 blocks

Like Minecraft if you know that

Thanks I had tried first in which I random numbers and coordinates charged but because the blocks did not fit together and it was, for example, air in the ground or flying blocks

Ge

With a programming program… C ++ for example! Unless you like it on the phone, then Java!

ba

I would try to define the numbers somehow do not know me so well now.

edit:

eg 1234567890

1 = one mountain every 200 blocks

2 = a lake

3 = a forest

to define all this somehow in intervals or you just look in the MInecraft SRC.

Ke

You can take a standard random number generator that accepts a seed. The seed would then be your random number, with the same seed coming out the same values in the random number generator. That actually exists in every programming language.

ju

Well, as with MineCraft.

Your start number is a seed for a pseudo random number generator.

The things spit out almost random numbers, but at the same seed again and again the same numbers. This is how Minecraft always generates the same worlds with the same seed. You just have to make sure that world generation always runs the same way. So you have to use every random number again and again in exactly the same place in the process of world generation.

How to prevent that nothing is generated in the "air"? As soon as you place a stone you check on the z-axis (down) if there's a stone there. If there's no stone (air), then no stone may be placed at the current location. At a certain z-level, say -120, it does not get any further and this level is always considered a stone. Your algorithm now goes up z-level for z-level and places stones, or sometimes no stone.

If you have a stone in place (x, y, z-1), then you can place a stone on (x, y, z). But if you have no stone (x, y, z-1) you can't place a stone on (x, y, z).

Is that enough, or do you need pseudo-code?

ju

Or you program yourself such a thing. Ultimately, this is just a mathematical function.

Then you know how the thing works.

ju

Otherwise, you can also choose a different approach. You first generate all sorts of blocks in 3D space. Then you have your "air" in between.

And then you go through each block and let it fall down until the whole "air is out".

Su

I have no example implementation ready, but that's the way it should be:

Generate an uneven surface of bedrock.
Now generate a height level for rocks for isolated X-Y coordinate pairs (eg at a distance of 10 to 10 a height between 50 and 65).
Generate corresponding height levels for the gaps from "weighted random numbers, so that the whole thing becomes a bit more homogeneous.
Fill from top edge bedrock to bottom edge "normal rock" all (for now) with rock.
Generate with a (adjustable) "rarity" mountain top and the associated "feet".
Repeat steps 2-5 within the mountain radius with slightly adjusted parameters (for example, with altitude ascent to the summit up to altitude level 120).
Repeat steps 2-5 with a "layer thickness" of e.g. Up to 10 but with soil instead of rock (or sand, if you want it to be a desert).
Next search for "holes" and question your random number generator, if water should be there in and if so up to which height.
If water was added in step 8, walk along the shore with some sand.
This would be the "shell" of the world so far so far.

Now you can, for example, Still several ores (iron, gol, redstone, …) distribute in the rock and add forests and the like.

Sw
1

Well that's how minecraft works rather less. The worlds in minecraft are not simply generated with a pseudo random number generator. With your algorithm, no overhangs or cavities would be possible. Also, the world would look pretty chaotic if you just randomly generated the height for every xz coordinate.

ju

You do not seriously believe that this was a complete description, right?

So seriously?

I know, for a layman, it's sometimes very hard to see where it's simplified and where it is not, but it's very, very obvious at the point.

The FS can solve its basic problem with it and that's why it should work. But he does not have a complete world generation with that.

Sw

Well, the mismatched blocks does not solve your approach just. And besides, you've got the z and y coordinates confused.

ju

I use the standard coordinates:

How would you do full programming

https://en.wikipedia.org/...onal_space

But yes, you can keep it like the roofer, you just have to commit to a system.

the mismatched blocks does not solve your approach

I do not know your education level.

Co

I do not want to have it on a cell phone but the phrase programmer says it all

Sw

What does the quote have to do with my educational status?

Your answer is simply null for the questioner. The only thing that brings him a little further here is probably the statement that a rng can be initialized with a seed.

ju

I'm pretty sure you can't judge that.

Which is not bad.

Program a world generator, it's fun.

Sw

Well with my answer, I see two helpful times and your 0 times.

yes, I've never really done thanks for the hint.

ju

Have fun

Sw

And what about your career as a programmer? What have you been up to now? You seem so incredibly happy with your expertise so hau out times.

ju

Why should I have to justify myself? Why should I have to profile myself? From whom?

In front of someone who says that a GPU heatsink replacement is just as dangerous / dangerous as installing a graphics card?

Let's not be ridiculous.

But back to the topic. Programming such a world generation. Then let simulated water rain from the sky and see how the world changes, how rivers form, etc. Etc. Is really interesting.

Sw

Each of your comments is incredibly know-it-all and condescending. You really seem to have to compensate something. You do not have to justify yourself, I just wanted to know what makes such an incredibly clever and successful person stand on his legs because I've only gotten a hello world.

ju

"Hello world" is not bad at all. Everyone starts.

And if it's fun, you might go further and write more than "hello world". Of course, there's still a long way to go until 3D world generation is visualized (from "hello world"), but it can be done well if you just stay tuned.

Sw

So I found hello world already very complicated. Well, probably not everyone can be as crack in the area as you.

ju

For a troll you are quite a crybaby xD

Sw

How do you know that I'm a troll?

Ge

"programmer" just tells me garnix… But also only since 20 years programmer

Co

Then you surely know that a beginner needs more qualified answers than that