How would you draw a contour line dynamically?

So I can finally articulate what I’ve been trying to ask for awhile now about ‘map borders’ and influence maps and so on, the word I was looking for is contour. I found a topic on this but it uses hex tiles which is far too complicated for what I’m after, does anyone know how to draw this kind of effect just in 2D space?

https://gamedev.stackexchange.com/questions/87396/how-to-draw-the-contour-of-a-hexagon-area-like-in-civ-5

To give some examples of what I’m on about, I’m specifically thinking of how to draw contour lines of the style that Settlers 2 and Black and White have. Here are a couple of screenshots I’ve searched for that illustrate what I’m on about.

http://www.sztab.com/tapety/Black-&-White-2 124821,1.jpg


I’m not looking for anything fancy right now like taking note of the terrain height and things like that, but just being able to draw these through script and dynamically change the scale would be great.

I found something that’s very close to what I’m looking for but this is too complicated and involves terrain.

Do you have a screenshot of your own game / a mockup of what you’re looking to achieve?

Black and White is 3D and uses a “wall” rather than a flat border. Settlers uses a bunch of individual images.

Well I can give a description, what I’ve got is a player, a gameobject that you ‘capture’ and then I want an influence ring to appear around it and I want to be able to maybe build stuff as well that expands the influence ring. Black and White as well as Settlers were just what I could think of as examples.

It’s all very basic at the moment and I just want to focus on getting the influence ring effect to work since that will be a main game mechanic.

Oh I see, you mean more like an RTS unit selection where all of the selection rings merge.

There’s some good answers here: shaders - How to make unit selection circles merge? - Game Development Stack Exchange

1 Like

Oh wait, that’s something I was looking at before I think and it was in regards to influence maps and regions etc. that’s interesting, thanks I’ll check it out, looks like I’ve got experimenting to do. How would I make it into a ring though if I’m using a sprite?

Oh! My brain just clicked, I don’t need to worry about that at all I can just make the sprite a ring in photoshop and then scale it accordingly, then after that I’ll use the blend technique to do everything. Oh oh! I’m going to test this out :smile:

1 Like

Just to double check, is this the right sort of think I’m looking for?

Or am I overthinking this? It looks like I might need to write my own shaders for this effect to work properly.

I’ve just found an absolute cheat way to do this effect I’m looking for without using shaders and I’m going to have to adjust the material and stuff so I can change the colours freely and mess with transparency but what I’ve done is actually made a 3D sphere and then flattened it.

With the way the geometry blends in you can scale up and down the sphere freely and if you are in 2D mode it will look like the spheres are blending in with each other nicely and you don’t have to worry about any weird overlapping effect going on.

Games development never fails to blow my mind with tricks like this lol. Just thought I’d leave this here in case anybody is looking to create some kind of big galaxy map like with Elite: Dangerous or something and wants a fairly cheap and easy way to make the effect.

Edit: Here’s some extra information on the material I used, I picked a completely blank standard material, then I set the rendering mode to fade. There were some problems with the sphere rendering so I set the scale on the Y axis ( Or whichever axis you have set as forward ) slightly above 0.0 so that the material would show clearly.

Now everything seems to be working fine, I just need to get the scripting set up for the colours on a trigger or whatever action I’m going to be using to change the colour and it should all work.