# Cashgen - (kinda) Infinite Procedural World Generator

**URL:** <https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131>\
**Category:** Game Development\
**Tags:** unreal-engine\
**Created:** [May 6, 2016, 4:37pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131 "2016-05-06T16:37:03Z")\
**Posts on this page:** 20\
**Page:** 11

<div class="post-metadata">

**Author:** ![Mr\_SquarePeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr\_SquarePeg](https://forums.unrealengine.com/u/Mr_SquarePeg)\
**Post date:** [June 20, 2017, 12:14pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/207 "2017-06-20T12:14:02Z")

</div>

> [@mid\_gen;726053](#):
>
> Hmm what could this be?
> 
> ![2OGama7YQaWWWkmTtmTKgA.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/b/cb7c863f74c4bd54046ea6500624771cfc512c86.png)

Cube terrain maybe?

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [June 20, 2017, 12:25pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/208 "2017-06-20T12:25:51Z")

</div>

> [@HeadClot;726069](#):
>
> Cube terrain maybe?

Not quite 😛 First iteration of a geodesic sphere-based world generator.

Just cranking out the basic geometry then I need to sit and have a think about how best to handle subdivision and LODs.

---

<div class="post-metadata">

**Author:** ![Mr\_SquarePeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr\_SquarePeg](https://forums.unrealengine.com/u/Mr_SquarePeg)\
**Post date:** [June 20, 2017, 12:30pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/209 "2017-06-20T12:30:54Z")

</div>

> [@mid\_gen;726076](#):
>
> Not quite 😛 First iteration of a geodesic sphere-based world generator.
> 
> Just cranking out the basic geometry then I need to sit and have a think about how best to handle subdivision and LODs.

So a planet like terrain generator?

Either way I Am looking forward to it 🙂

---

<div class="post-metadata">

**Author:** ![Derjyn](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/derjyn/32/931618_2.png) [@Derjyn](https://forums.unrealengine.com/u/Derjyn)\
**Post date:** [June 20, 2017, 7:37pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/210 "2017-06-20T19:37:03Z")

</div>

mid\_gen, you’re an animal! Keep up the great work man, really appreciate the love you are putting into CashGen \<3

---

<div class="post-metadata">

**Author:** ![AinSophAur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AinSophAur](https://forums.unrealengine.com/u/AinSophAur)\
**Post date:** [June 20, 2017, 9:45pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/211 "2017-06-20T21:45:43Z")

</div>

This would absolutely be of interest indeed!  
I would swap out my current procedural planet system for this at any time. 🙂

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [June 22, 2017, 7:22am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/212 "2017-06-22T07:22:50Z")

</div>

This morning’s efforts

![EOJh65SsS1GqZEnou12guw.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/a/5/ca567c32ea3035dc4e59666f59cd8a42448d20c2.png)

---

<div class="post-metadata">

**Author:** ![sivan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sivan](https://forums.unrealengine.com/u/sivan)\
**Post date:** [June 22, 2017, 12:05pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/213 "2017-06-22T12:05:19Z")

</div>

@ **mid\_gen** ]([https://forums.unrealengine.com/member.php?5136-mid\_gen](https://forums.unrealengine.com/member.php?5136-mid_gen)) hmm… a slightly different thing: as I see and thinking, apparently on a spherical surface triangular “tiles” and “clusters” would be the best for a (RTS) pathfinder. do you have any source/article how you generated the vertices and triangles to produce the sphere? I would need it to help to determine the coordinate-tile conversions in both ways - but it will be a really far future hobby task for me (but quite interesting!) 🙂 collecting tiles into areas/clusters seems to be very similar to the lod generation you use.

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [June 22, 2017, 12:30pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/214 "2017-06-22T12:30:08Z")

</div>

> [@sivan;727082](#):
>
> @ **mid\_gen** ]([https://forums.unrealengine.com/member.php?5136-mid\_gen](https://forums.unrealengine.com/member.php?5136-mid_gen)) hmm… a slightly different thing: as I see and thinking, apparently on a spherical surface triangular “tiles” and “clusters” would be the best for a (RTS) pathfinder. do you have any source/article how you generated the vertices and triangles to produce the sphere? I would need it to help to determine the coordinate-tile conversions in both ways - but it will be a really far future hobby task for me (but quite interesting!) 🙂 collecting tiles into areas/clusters seems to be very similar to the lod generation you use.

Just start with an icosahedron, and subdivide.

Real quick and dirty code. This is the icosahedron :

```auto

	
        const float X = 0.525731112119133606f * aScale;
	const float Z = 0.850650808352039932f * aScale;
	
	MyVertices.Emplace(FVector(-X, 0.0f, Z));
	MyVertices.Emplace(FVector(X, 0.0f, Z));
	MyVertices.Emplace(FVector(-X, 0.0f, -Z));
	MyVertices.Emplace(FVector(X, 0.0f, -Z));
	MyVertices.Emplace(FVector(0.0f, Z, X));
	MyVertices.Emplace(FVector(0.0f, Z, -X));
	MyVertices.Emplace(FVector(0.0f, -Z, X));
	MyVertices.Emplace(FVector(0.0f, -Z, -X));
	MyVertices.Emplace(FVector(Z, X, 0.0f));
	MyVertices.Emplace(FVector(-Z, X, 0.0f));
	MyVertices.Emplace(FVector(Z, -X, 0.0f));
	MyVertices.Emplace(FVector(-Z, -X, 0.0f));

	int32 indices] = { 0,4,1, 0,9,4, 9,5,4, 4,5,8, 4,8,1, 8,10,1, 8,3,10, 5,3,8, 5,2,3, 2,7,3, 7,10,3, 7,6,10, 7,11,6, 11,0,6, 0,1,6, 6,1,10, 9,0,11, 9,11,2, 9,2,5, 7,2,11 };

	MyIndices.Append(indices, ARRAY_COUNT(indices));

```

This is the subdivision method :

```auto

void ACGWorldFace::SubDivide(const FRuntimeMeshVertexSimple &v1, const FRuntimeMeshVertexSimple &v2, const FRuntimeMeshVertexSimple &v3, const int32 aDepth, const float aScale)
{
	if (aDepth == 0) {
		MyVertices.Emplace(v1);
		MyVertices.Emplace(v2);
		MyVertices.Emplace(v3);

		MyIndices.Add(MyVertices.Num() - 3);
		MyIndices.Add(MyVertices.Num() - 2);
		MyIndices.Add(MyVertices.Num() - 1);
		return;
	}
	const FRuntimeMeshVertexSimple v12 = FRuntimeMeshVertexSimple(((v1.Position + v2.Position).GetSafeNormal()) * aScale);
	const FRuntimeMeshVertexSimple v23 = FRuntimeMeshVertexSimple(((v2.Position + v3.Position).GetSafeNormal()) * aScale);
	const FRuntimeMeshVertexSimple v31 = FRuntimeMeshVertexSimple(((v3.Position + v1.Position).GetSafeNormal()) * aScale);
	SubDivide(v1, v12, v31, aDepth - 1, aScale);
	SubDivide(v2, v23, v12, aDepth - 1, aScale);
	SubDivide(v3, v31, v23, aDepth - 1, aScale);
	SubDivide(v12, v23, v31, aDepth - 1, aScale);
}

```

---

<div class="post-metadata">

**Author:** ![sivan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sivan](https://forums.unrealengine.com/u/sivan)\
**Post date:** [June 22, 2017, 1:28pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/215 "2017-06-22T13:28:30Z")

</div>

Thanks! icosahedron is a super sexy name 😃

---

<div class="post-metadata">

**Author:** ![Markyroson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Markyroson](https://forums.unrealengine.com/u/Markyroson)\
**Post date:** [June 22, 2017, 5:48pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/216 "2017-06-22T17:48:50Z")

</div>

This plugin looks quite useful. Keep up the good work! 😃

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [June 22, 2017, 7:52pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/217 "2017-06-22T19:52:14Z")

</div>

Recursive face generation.

If the number of subdivisions for a face exceeds 4, it’ll spawn 4 new faces instead. Stops each mesh getting too big.

![tr-o3m2mQhKTiwZChfVtMw.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/8/6/86ef329095f3226a6e3aa4058c723e5d57437442.png)

Code is in this branch for anyone interested. I’ll probably stick it in soon though as it’s a separate Actor and doesn’t affect anything else.

> **[GitHub - midgen/cashgenUE at CG\_WORLD](https://github.com/midgen/cashgenUE/tree/CG_WORLD)**
>
> CG\_WORLD

---

<div class="post-metadata">

**Author:** ![n00854180t](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@n00854180t](https://forums.unrealengine.com/u/n00854180t)\
**Post date:** [June 22, 2017, 8:03pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/218 "2017-06-22T20:03:23Z")

</div>

Do want, looks amazing. Nice work @mid_gen

---

<div class="post-metadata">

**Author:** ![AinSophAur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AinSophAur](https://forums.unrealengine.com/u/AinSophAur)\
**Post date:** [June 23, 2017, 10:49am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/219 "2017-06-23T10:49:26Z")

</div>

I see a sphere! 😃  
CGWorld has not yet been hooked up to the Set Up Terrain yet, right? Or am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [June 23, 2017, 11:41am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/220 "2017-06-23T11:41:03Z")

</div>

> [@AinSophAur;727534](#):
>
> I see a sphere! 😃  
> CGWorld has not yet been hooked up to the Set Up Terrain yet, right? Or am I doing something wrong?

That’s it so far 😛

An icosasphere with independent recursively subdivided faces. I’m working on the threading part at the moment so it can start generating in realtime instead of doing it on construction.

Then I’ll get the noise hooked up :\>

---

<div class="post-metadata">

**Author:** ![AinSophAur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AinSophAur](https://forums.unrealengine.com/u/AinSophAur)\
**Post date:** [June 23, 2017, 11:56am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/221 "2017-06-23T11:56:11Z")

</div>

That’s Awesome!

I’m looking forward to what this can do for our game.  
Combining PMC and RMC with multithreading in blueprints to make a 20KM universe with 10 planets, is not really optimal at all. It also has a good bit of restrictions we’re not really happy about.  
I kinda want to get into C++, but yeah…

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [June 25, 2017, 11:31am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/222 "2017-06-25T11:31:55Z")

</div>

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/8/188f5d47b32fb05583022e8b91ced50bd9b9853d.jpeg "CashGen - The Next Generation Teaser") ](https://www.youtube.com/watch?v=LH0ZxEdW3m8)

---

<div class="post-metadata">

**Author:** ![AinSophAur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AinSophAur](https://forums.unrealengine.com/u/AinSophAur)\
**Post date:** [June 25, 2017, 11:33am UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/223 "2017-06-25T11:33:29Z")

</div>

Threading achieved I assume? 🙂  
Looks really nice!

---

<div class="post-metadata">

**Author:** ![mid\_gen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mid\_gen](https://forums.unrealengine.com/u/mid_gen)\
**Post date:** [June 25, 2017, 4:20pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/224 "2017-06-25T16:20:03Z")

</div>

Yep. Noise stuff hooked in now.

Still loads of stuff to sort out, normals are a mess.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/3/8/0387e7bf8ac1475d59e4a965019bae3c0a95b921.jpeg "CashGen - CG World Sample") ](https://www.youtube.com/watch?v=AQKtuDsUtzs)

---

<div class="post-metadata">

**Author:** ![AinSophAur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AinSophAur](https://forums.unrealengine.com/u/AinSophAur)\
**Post date:** [June 25, 2017, 8:19pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/225 "2017-06-25T20:19:41Z")

</div>

This plugin is going to save our workload a ton! It’s almost too awesome!  
This is exactly what we want for our game. I’m so excited to play around with this!

---

<div class="post-metadata">

**Author:** ![MichaelWion](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MichaelWion](https://forums.unrealengine.com/u/MichaelWion)\
**Post date:** [June 25, 2017, 10:08pm UTC](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131/226 "2017-06-25T22:08:44Z")

</div>

Hi! I’m trying to procedurally place trees, foliage, etc depending on height, slope, etc…  
Is there a function somewhere that can return the (Z)-height/slope of the terrain at (X,Y)-Location?  
I know I can use raycasts for this, but I was hoping that this information was already stored somewhere in code so that it would be faster than performing traces all the time.

[Previous page](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131.md?page=10)

[Next page](https://forums.unrealengine.com/t/cashgen-kinda-infinite-procedural-world-generator/63131.md?page=12)
