Geodesic globe WIP

This project is live on the Asset Store - HexGlobe
(v1.02 released 10/29/12)
Web Demo:
http://www.electricrune.com/Worlds4/GeoGlobe4.html

The Early Version (0.1)
(keep reading for 0.2)
http://www.electricrune.com/GeoSphere/GeoSphere.html

930979--34882--$GeoGlobe.jpg

My first version used a limited subdivision routine that could only split the faces into halves/quarters/eighths/etc, and it crashed with too many vertices after level five.

The picture above (and the player) show level three, with eight divisions per original face.
It could do 16 and 32, but crashed at level six (64 divisions).

Still, I used it as an early prototype, figuring out how to place the interactive components on the map, and key them to the actual surface.
In the first demo, you can mouse over the individual hexes, and the GUI will display vars that are associated with each hex on the globe (Latitude, Longitude, and the terrain type).
This demo also shows a routine I am experimenting with to make the map look less ‘hexellated’: the actual colors of the hex are painted on the hex, but stops short of the border, leaving a white band.
Then I run what I call a ‘FireFill’ on the white area which basically randomly grows the existing neighboring colors into the white space until it is all filled.
It is pretty basic (and slow), but it is experimental at this point.

I didn’t like the restriction on how many times I could subdivide each original facet, so I started over from the ground up, and this is the result so far:

Version 0.2

http://www.electricrune.com/Worlds/Worlds.html

I threw a texture from an icosahedral map of Earth. The seams that are apparent are from that texture, when the textures are blank, it is smooth as a cue ball. This picture shows level 50, with 100-mile hexes, 250 around the Equator, and 25002 hexes (12 are always pentagons, at any level).
This one doesn’t have the code to highlight the hexes yet, but I have implemented that in the working version. (This version is about five days old)
Also, the actual painting of the hex colors isn’t in this version, but it is part of the current version I am working on at this very moment.

Drag the slider on the left to get started, a button will appear once the value has been changed.
You can see the data on number of hexes, length of the Equator, and size of the hexes updating as you slide.
Click MAKE GLOBE, and it will tessellate and normalize the globe to a sphere.
Click DRAW HEXES to draw the hex borders. There will be a slight pause during processing, I didn’t write it as a co-routine (yet).

This version can hexellate the globe anywhere from two to one hundred hexes per original triangle edge.
(Actually, it can go up to 140 before it starts to run into vertex limitations)

Stats on a level 100 globe:
Equator = 500 hexes
Hex Size = 50 miles (flat side measurement)
Number of Hexes = 99,990 (+12 pentagons)

I used a layered material, so the hex borders are a separate texture from the underlying map data, and could be toggled on and off. They can also be of two different resolutions.
I’ve come up with a very fast way of drawing the textures; those hexes are calculated and drawn in real time, hence the short pause when you click DRAW HEXES. Drawing filled hexes takes a little longer, but its really pretty quick, considering all the calculation going on…

Version 0.3…

Currently moving ahead to planetary terrain generation. I will seed the world with land, based on a given percentage of water/land, and then run a simple plate-tectonic model to bump up mountains and merge/tear apart landmasses.
This will establish where the land is, and what is mountain/hill/flat…

Then the plan is to generate a simple weather model to set up winds that will blow air from over water onto land, and establish biomes. Areas in the middle latitudes that get a lot of rain will be jungle; at higher latitudes, forest; at arctic level, glaciers. Areas that get winds that blow from overland will be dry (Desert/Steppe/Tundra).

The other thing that is in development is the simple fact that one could take any given section of the globe, or any specific hex, and expand and subdivide to any degree needed. You could take a 100-mile hex and blow it up and have twenty-mile hexes. Then you could have another level with one-mile hexes. Or you could just go straight to a map with 100 one-mile hexes…
A simple interpolative routine would use the terrains from the main hex and the neighbors, spread the terrain across the new sub-hexes, et viola…

I’m not sure yet what the final product is for this; whether it is something I try to sell on the Asset Store, if it is going to be a part of a war game, or if it is going to be part of a space game.

One thing I am sure of, it has worlds of potential… (ba-dum-bum-ting!) :slight_smile:

Version 0.3
New version: the beginning of planetary terrain generation…
NOTE: THIS WILL NOT WORK ON CHROME
There are time-out issues in Chrome that crash on long pauses, this player wasn’t designed with that in mind, but will be, going forward
http://www.electricrune.com/Worlds3/Worlds.html


This is a globe with twenty subdivisions, with 100 hexes around the equator; if this is an Earth-sized globe, each hex is 250 miles across.

A slider selects the percentage of water, and then runs a cellular algorithm on the randomized start to clump up the land.
(truly random land looks terrible, so it was necessary to run this algorithm. A lot.)

Right-drag to rotate the globe; you can also mouse-over the globe to display the lat/long, climate zone, and terrain type.
Also added an unfolded map in the corner.

Just the first phase. Next, a plate-tectonic simulation to grow mountains. First pass will probably simply use the triangular original faces as the plates, so mountains will tend to be along the edges of those zones.

Later, I can see some refinement where the plates are built by a randomized flood-fill type routine…

Version .3 Link is not working. This project is interesting. What is the advantage having a HexPlanet, or isn’t there one?

Sorry, typo…

What do you mean, what is the advantage?

I think most people who experiment with this want to move away from the Civ-type model, where the world can wrap from east to west, but the poles are impassable. I essence, you play either on a plane, or a cylinder where you cannot cross over the ends.
With the GeoGlobe, you can have paths that approximate Great Circle routes

I started doing this as a project to hexellate a sphere, but I am starting to think that it’s too confining to think totally inside the hexes. The way I have it now, the map doesn’t have to have anything to do with the hex entities, except that the hexes draw themselves onto the map.
It could work the other way around… I could draw a detailed fractalized image on the map, and determine what terrain type each hex was by sampling the texture.
I am exploring several different angles, but it will almost certainly involve manipulating a tri-mesh using some sort of fractal routines.

I hope to be able to take sections of the globe and apply a fractalizing routine and create detailed surface maps.
Using a version of the n-level triangle subdividing function I wrote, I could take the six triangles surrounding any given hex.
The outside corners and the center can be seeded with the terrain from the planet map. Then you could do a triangle version of the square-diamond process to subdivide and randomly distort the terrain in between to whatever degree is needed…

Ok, the .3 example is not populating on my computer. (Tried three times). Running Chrome. Thanks for your detailed explanation. I guess it’s about hexellating rather than triangulating. I’m still a little in the dark though. Why not just use a triangulated sphere?

Well, when I say ‘a few seconds,’ it actually takes 57 seconds on my end…

It’s slow because I’m running the cellular function 1000 times.
Also, Unity is a little slow on the texture drawing routines…
I plan on this part being generated off-line, this is just for demo purposes.

The other benefit of this type of sphere over the regular sphere is that all adjacent vertices are almost the same length.
On a regular sphere, as you go away from the equator, the east/west vertices get closer and closer, like the lines of longitude on a globe. Essentially, a Unity Sphere is a distorted cylinder with no ends.
In this version, you can always move in 6 directions (5 in twelve places), and each move choice will be almost the same distance.
I say almost because there is about 20% difference between the minimum and the maximum side length, but this is not between adjacent verts, but the sides next to the poles vs. the sides in the center of the triangular regions.

And as to triangulating vs. hexellating, this is really both…

My hexes are at the corners of the tri-mesh. If you take one of these verts and find the center of the triangles around it, and connect those points, you end up with a hexagon.
Its essentially a Voronoi diagram, with points in a regular triangular pattern…

I’m very interested about that because I have a great idea about a game using this solution !

Ok, that has clarified it somewhat.

I’m interested in why it’s not running for you… Do the other two versions work?

It might take longer on some computers, like I said, I plan to take this part off-line in final production…
The only pause you’d see in this case is the initial pause when it first loads…
It is slow because I’m processing the map 1000 times with a cellular automata routine to make it look like real terrain, rather than a random scattering.

I’m curious, are you still working on this?

Thanks for your interest; here’s a status report

I’m working on three things that are closely related…

I’m getting close to wrapping up a new version of HexTech, using a segmented fractal landscape to enable hex maps of unlimited size.

The techniques I’m perfecting in the flat map will transfer over to the release version of this project.
The early versions of GeoGlobe use a sphere collider at each hex with a MouseOver function.
This has performance issues when the number of hexes got high.
The pointer routine I’m perfecting with the flat map will make larger globes much more functional.

The third thing is the game that is my background project, the thing that I’m developing this all for in the first place…
You can find a lot of discussion about that game and the technical aspects of the flat map in this thread:
http://forum.unity3d.com/threads/143632-Glyph-Fantasy-4X-TBS

So, in summary, my to-do list:

  1. Update HexTech to 2.0
  2. Finish development of GeoGlobe and release on Asset Store
  3. Glyph (next step is Combat Engine)

Working on another project, I’ve discovered there are some time out issues with Chrome.
If you have a processor-intensive task that holds the computer up for over twenty-thirty seconds, the webplayer will crash.
This is taking a lot of time processing and clumping the land; when I get back to development on this, it won’t be a problem going forward.

Interesting, look forward to V2.0.

Just finished updating HexTech to 2.0; will release after a short testing interval.
If you’re interested, link is two posts up…

Actively working on this project again, seeing hex-covered spheres in my dreams… :wink:

An early test of the fractalizer routine. The regions do not splice at the edges, yet, but this should give a decent preview of what I am going for with this…

[EDIT: something went wonky with the image, re-attached four posts down…]

Hey Tasarran. It’s great to see some progress on this, I am sure I am not the only one who is waiting for this one to be released. The thing is that I don’t know to which screenshot you are referring to in your last post. Maybe you forgot to attach it?

Edit: According to the page’s code, the attachment is there; however it’s not rendering for me …

Working for me.

Heh dude this is pretty cool.

[EDIT: OK, this one is working… That was strange…]

Now I get it! :wink: That pic is beyond awesome, I love the noise applied to the coast; it makes it quite realistic. Is this based on a 2d map as HexTech or you are using some random seed with noise to create the terrain? I would like to have both approaches, but it’s more important for me to be able to recreate the earth from a 2D image, than have totally random planets; although I can see why that can be even better. In any case I can’t hardly wait to get under the hood on this, excellent work as usual Tasarran.