Jump to content
  • Advertisement
Sign in to follow this  
Thomas Wiborg

Terraria clone. What do I need to learn

This topic is 1049 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello fellow programmers.

I want to make a terraria clone. Ofc in alot smaller scale. And i therefor wonder what kind of skills i need to learn to do so.

What is the difference between procedural generation of my map and perlin noise generating my map array. Ive tried out Perlin, to get my array filled with random numbers.
Are those the same thing or am i all wrong?

What other skillset do I need to learn?

Im newbie so go easy on me smile.png

Edited by Thomas Wiborg

Share this post


Link to post
Share on other sites
Advertisement

Hello fellow programmers.

I want to make a terraria clone. Ofc in alot smaller scale. And i therefor wonder what kind of skills i need to learn to do so.

What is the difference between procedural generation of my map and perlin noise generating my map array. Ive tried out Perlin, to get my array filled with random numbers.
Are those the same thing or am i all wrong?

What other skillset do I need to learn?

Im a newbie so go easy on me smile.png

 

procedural generation is a broad term that can refer to pretty much any form of data generation where the software creates data based on a set of rules (which may or may not include perlin noise), perlin noise is good for procedural terrain since it creates clusters of similar values that have reasonably "natural looking" shapes but you probably want to do more, you can for example add rules to modify the terrain based on things like slope and altitude,  add caves, add objects, etc. 

 

This one can be worth looking at: http://www.roguebasin.com/index.php?title=Cellular_Automata_Method_for_Generating_Random_Cave-Like_Levels

allthough it is intended for top-down rogue-likes you can use pretty much the same method to generate caves for a terraria clone (generating a bunch of such caves and placing them at not quite random positions below some suitable depth is fairly easy and makes the maps a bit more interesting)

Edited by SimonForsman

Share this post


Link to post
Share on other sites

Either Terraria or the Starbound guys had a blog entry a year or two ago about their base algorithm.

 

It mostly boils down to layers of noise. One layer might be pockets of ores. Another layer handles surface elevation. Another layer can form the foundation of cave systems. Combine them together with various filters and you get a 2D world.

 

The harder parts are going to be getting all the other stuff working, e.g. rendering, physics, gameplay, dynamic level features, digging, building, rpg mechanics, etc.

Share this post


Link to post
Share on other sites

It's a little more tricky than that.

You'll probably want to study up on advanced math concepts before tackling this. Particularly fractals.

 

Usually for a fill random generation you're going to use some advanced math. It's not just one function. It's going to be a variety of passes and combinations.

 

I think it's a very detailed combination of fractals for the main passes which do the fills.

 

So... first is a 2D heightmap that can be generated by a modifed perlin noise algorithm.

With a field clamp now, they go ahead and start filling in areas. And also checking for certain rules to make sure the world looks correct before they start editing.

Then they go in and carve out rooms. From common patterns I have seen. It's a mixture of Marble, Mandelbrot, and sawtooth. They probably use an algorithm like celluar automa to check for neighbors, following some rules, and connect rooms together.

 

As far as dungeons and such. Those look to be prefabs.

Edited by Tangletail

Share this post


Link to post
Share on other sites

I see, pretty much alot of learning,

What kind of math should i study more on? I see Tangletail says fractals. What else is good to learn?
 

Sean, how do you learn all those concepts, rendering, physics, etc etc... Just learning by doing? Or use google as your friend?

Share this post


Link to post
Share on other sites
Books, I'd say.

Trig, algebra, calculus, discrete math, vector algebra, and algorithms. Edited by Tangletail

Share this post


Link to post
Share on other sites

OP: I'm not sure what your current education level is, but "Trig, algebra, calculus, discrete math, vector algebra, and algorithms" is a huge, totally non-specific list. Furthermore, you could take multiple classes in all of these (except maybe for algorithms) and still be totally clueless as to how to apply these to randomly generated worlds. Unless you're looking for the mathematics to be your primary focus, I think using the internet to find specific things will be a much better option than books.

 

Don't get me wrong, a good grasp of mathematics will always help, and if you want to learn all the mathematics required for a really in-depth, intuitive understanding of what's going on, then good! But you don't need to learn all of those things to be able to use an algorithm.

Share this post


Link to post
Share on other sites

OP: I'm not sure what your current education level is, but "Trig, algebra, calculus, discrete math, vector algebra, and algorithms" is a huge, totally non-specific list. Furthermore, you could take multiple classes in all of these (except maybe for algorithms) and still be totally clueless as to how to apply these to randomly generated worlds. Unless you're looking for the mathematics to be your primary focus, I think using the internet to find specific things will be a much better option than books.

 

Don't get me wrong, a good grasp of mathematics will always help, and if you want to learn all the mathematics required for a really in-depth, intuitive understanding of what's going on, then good! But you don't need to learn all of those things to be able to use an algorithm.

 

The reason why I mentioned them, is that the use of fractals and graphics requires methods from all of those fields. Yes, the general idea of them is important, because everything involved in the concept of generating an entire world, is basically the use of all the general concepts of math.

And combining them into something useable is no real easy task on it's own.

 

Celluar Automata, which is often used to combine rooms together is a procedural algorithm that follows a set of rules. These rules can not be used correctly in a setting featuring two dimensions or three without Vector Algebra.

The vector algebra will allow you to draw shapes in the grid fairly easily, and fill out it's area in between correctly with minimum effort. The use of matrixes to rotate entire functions is also pretty important in this category.

Calculus, because you will be doing a number of derivations in a variety of fields, using falloff functions, basis, logarithms to find limits, blending, ect ect... because usually fractals are some sort of data over steps or seeds.

Discrete math more specifically because it allows you to make sure that this equation will work for all given situations, or only for a few. And if it only works for a few, it means you can be sure that you will not run into errors. This will also help you learn how to layer equations together.

 

Trig is the base steps that is needed in all upper levels of math involving spatial relationships.

 

The use of them alone won't be immediately apparent, just as learning how to code won't be immediately useful right off at the beginning. But to walk you must first crawl. That is to understand the concepts of the primitives first that drives everything else in the procedural generation process. 

Edited by Tangletail

Share this post


Link to post
Share on other sites

Mmmm... most game math books won't really focus on a language. And if it does it's usually C#. And most of what I have seen only does 3D. But it's just as easy as removing one of the dimensions from the math. Give me a few, and I can go tearing through my Universities Library, and my own collection to see if I can come up with anything.

But, the best alternative would probably to seek an actual professional class.

 

EDIT:

Essential Mathematics For Games & Interactive Applications by Van Verth.

This books will go over a lot of the basic concepts you will find in a Vector Algebra class, but it does an excellent job at giving examples to it's uses in practical applications. There are also a number of other math concepts that you would need to know for anything interactive, or games. Such as Collision detection, interloping, splines, ect.
 

Mathematics for 3D game development and Computer graphics, Third Edition.
Yes, this is a book on 3D math. But it does not mean it doesn't work for 2D math as well. As once again, it's simply a matter of removing the third dimension from the math. Perfectly doable for most applications.

 

Then... this website.
http://gamemath.com/

Which is more of a direct knowledge than general concepts

Edited by Tangletail

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!