# City Skylines District tool in UE4?

**URL:** <https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391>\
**Category:** Rendering\
**Tags:** Terrain, rts, unreal-engine, Decals, Splines, question\
**Created:** [August 2, 2015, 2:37pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391 "2015-08-02T14:37:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanInSpace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanInSpace](https://forums.unrealengine.com/u/DanInSpace)\
**Post date:** [August 2, 2015, 2:37pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391/1 "2015-08-02T14:37:51Z")

</div>

Hi, I’m making an RTS in UE4 and I’m trying to create nation territories that can change shape throughout the game (Like the District tool in City Skylines).

I’m thinking about using splines to do this, but am completely stumped.  
Any help or tips towards solving this problem would be great.

Thanks.

Exactly like this: [Cities: Skylines Dev Diary Review - Part 8 ► Districts and Policies ◀ [With Subtitles] - YouTube](https://youtu.be/8f_bvwmQ6Ak?t=47s)

---

<div class="post-metadata">

**Author:** ![birdfreeyahoo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@birdfreeyahoo](https://forums.unrealengine.com/u/birdfreeyahoo)\
**Post date:** [August 2, 2015, 4:34pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391/2 "2015-08-02T16:34:20Z")

</div>

You need to calculate a convex hull, and then you can do with it whatever you want, e.g. draw it.

There are certain algorithms, you can see here:[Convex hull algorithms - Wikipedia](https://en.wikipedia.org/wiki/Convex_hull_algorithms)

The simplest one I think is this algorithm here: [Convex hull algorithms - Wikipedia](https://en.wikipedia.org/wiki/Convex_hull_algorithms)

---

<div class="post-metadata">

**Author:** ![DanInSpace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanInSpace](https://forums.unrealengine.com/u/DanInSpace)\
**Post date:** [August 2, 2015, 5:58pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391/3 "2015-08-02T17:58:03Z")

</div>

How could I transfer this algorithm in to UE4? Thanks btw

---

<div class="post-metadata">

**Author:** ![DanInSpace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanInSpace](https://forums.unrealengine.com/u/DanInSpace)\
**Post date:** [August 2, 2015, 6:10pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391/4 "2015-08-02T18:10:23Z")

</div>

Also, I don’t think a convex hull is exactly what I’m looking for. A convex hull wouldn’t be able to create the type of freeform shape I need.

---

<div class="post-metadata">

**Author:** ![birdfreeyahoo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@birdfreeyahoo](https://forums.unrealengine.com/u/birdfreeyahoo)\
**Post date:** [August 2, 2015, 6:10pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391/5 "2015-08-02T18:10:42Z")

</div>

You first have to create a point list from what you have. The points could be the actor positions, but that is not very precise. You can work with bounding boxes there too.

So you have your BorderManager or something object. There you have a function. It calculates inside points, and with the algorithm then calculates the vertices of the boundary polygon. You can save them. Everyone can query these e.g. for drawing.

You don’t need to calculate it every tick, only recalculte when the user places a new building.

---

<div class="post-metadata">

**Author:** ![DanInSpace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanInSpace](https://forums.unrealengine.com/u/DanInSpace)\
**Post date:** [August 2, 2015, 6:13pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391/6 "2015-08-02T18:13:14Z")

</div>

Yeah, I’m looking to for the player to be able to draw really free form shapes, like even write your name in territory if you wanted to.

---

<div class="post-metadata">

**Author:** ![DanInSpace](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanInSpace](https://forums.unrealengine.com/u/DanInSpace)\
**Post date:** [August 2, 2015, 6:30pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391/7 "2015-08-02T18:30:13Z")

</div>

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/6/7/e67d03b820fb2eef32de42f5ef5c4ecfc44789e1.jpeg "Cities: Skylines Dev Diary Review - Part 8 ► Districts and Policies ◀ [With Subtitles]") ](https://www.youtube.com/watch?v=8f_bvwmQ6Ak)

---

<div class="post-metadata">

**Author:** ![birdfreeyahoo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@birdfreeyahoo](https://forums.unrealengine.com/u/birdfreeyahoo)\
**Post date:** [August 2, 2015, 7:08pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391/8 "2015-08-02T19:08:31Z")

</div>

Well I am overasked here. Maybe try it in a forum especially for algorithms.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_13b2054f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_13b2054f](https://forums.unrealengine.com/u/anonymous_user_13b2054f)\
**Post date:** [April 14, 2022, 3:03pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391/9 "2022-04-14T15:03:36Z")

</div>

Anyone came up with a solution for this problem 🙂 ?

---

<div class="post-metadata">

**Author:** ![sqdcn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sqdcn](https://forums.unrealengine.com/u/sqdcn)\
**Post date:** [June 5, 2024, 4:00pm UTC](https://forums.unrealengine.com/t/city-skylines-district-tool-in-ue4/327391/10 "2024-06-05T16:00:39Z")

</div>

I am able to implement this using UE::Geometry::TGeneralPolygon2, which is basically a vector of FVector2d that forms the perimeter of the polygon and its internal holes. The same module also provides useful functions for polygon union, difference, triangulation etc.

I then render the polygon district with a DynamicMesh.
