Thrive Game Development
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Thrive Game Development

Development of the evolution game Thrive.
 
HomeHome  PortalPortal  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  
Welcome new and returning members!
If you're new, read around a bit before you post: the odds are we've already covered your suggestion.
If you want to join the development team, sign up and tell us why.
ADMIN is pleased to note that this marquee has finally been updated.
ADMIN reminds you that the Devblog is REQUIRED reading.
Currently: The Microbe Stage GUI is under heavy development
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Quick Links
Website
/r/thrive
GitHub
FAQs
Wiki
New Posts
Search
 
 

Display results as :
 
Rechercher Advanced Search
Statistics
We have 1675 registered users
The newest registered user is dejo123

Our users have posted a total of 30851 messages in 1411 subjects
Who is online?
In total there are 12 users online :: 0 Registered, 0 Hidden and 12 Guests

None

Most users ever online was 443 on Sun Mar 17, 2013 5:41 pm
Latest topics
» THIS FORUM IS NOW OBSOLETE
Interesting terrain generation procedures Emptyby NickTheNick Sat Sep 26, 2015 10:26 pm

» To all the people who come here looking for thrive.
Interesting terrain generation procedures Emptyby NickTheNick Sat Sep 26, 2015 10:22 pm

» Build Error Code::Blocks / CMake
Interesting terrain generation procedures Emptyby crovea Tue Jul 28, 2015 5:28 pm

» Hello! I can translate in japanese
Interesting terrain generation procedures Emptyby tjwhale Thu Jul 02, 2015 7:23 pm

» On Leave (Offline thread)
Interesting terrain generation procedures Emptyby NickTheNick Wed Jul 01, 2015 12:20 am

» Devblog #14: A Brave New Forum
Interesting terrain generation procedures Emptyby NickTheNick Mon Jun 29, 2015 4:49 am

» Application for Programmer
Interesting terrain generation procedures Emptyby crovea Fri Jun 26, 2015 11:14 am

» Re-Reapplication
Interesting terrain generation procedures Emptyby The Creator Thu Jun 25, 2015 10:57 pm

» Application (programming)
Interesting terrain generation procedures Emptyby crovea Tue Jun 23, 2015 8:00 am

» Achieving Sapience
Interesting terrain generation procedures Emptyby MitochondriaBox Sun Jun 21, 2015 7:03 pm

» Microbe Stage GDD
Interesting terrain generation procedures Emptyby tjwhale Sat Jun 20, 2015 3:44 pm

» Application for Programmer/ Theorist
Interesting terrain generation procedures Emptyby tjwhale Wed Jun 17, 2015 9:56 am

» Application for a 3D Modeler.
Interesting terrain generation procedures Emptyby Kaiju4u Wed Jun 10, 2015 11:16 am

» Presentation
Interesting terrain generation procedures Emptyby Othithu Tue Jun 02, 2015 10:38 am

» Application of Sorts
Interesting terrain generation procedures Emptyby crovea Sun May 31, 2015 5:06 pm

» want to contribute
Interesting terrain generation procedures Emptyby Renzope Sun May 31, 2015 12:58 pm

» Music List Thread (Post New Themes Here)
Interesting terrain generation procedures Emptyby Oliveriver Thu May 28, 2015 1:06 pm

» Application: English-Spanish translator
Interesting terrain generation procedures Emptyby Renzope Tue May 26, 2015 1:53 pm

» Want to be promoter or project manager
Interesting terrain generation procedures Emptyby TheBudderBros Sun May 24, 2015 9:00 pm

» A new round of Forum Revamps!
Interesting terrain generation procedures Emptyby Oliveriver Wed May 20, 2015 11:32 am


 

 Interesting terrain generation procedures

Go down 
+5
Djohaal
~sciocont
roadkillguy
Chameleonsushi580
Commander Keen
9 posters
Go to page : 1, 2  Next
AuthorMessage
Commander Keen
Industrial Team Lead
Commander Keen


Posts : 1123
Reputation : 36
Join date : 2010-07-23
Location : Czech Republic (not that anyone would know where it is...)

Interesting terrain generation procedures Empty
PostSubject: Interesting terrain generation procedures   Interesting terrain generation procedures EmptySat Sep 11, 2010 9:49 am

Found this at Outerra forums: Artificial Terrain Generation. It even covers spherical planets!
Back to top Go down
Chameleonsushi580
Newcomer



Posts : 14
Reputation : 0
Join date : 2010-09-06
Age : 30
Location : Rhode Island (Eastern Standard Time)

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptySat Sep 11, 2010 12:29 pm

Ooooooooo~.....

How nice looking. Everything on this page looks like it could definitely be of some use, as it covers
basically every department that we need to work on. :3


And also, someone seems to be developing a very ambitious project with this same technology and it looks
like it could contribute to our "space phase"....


http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=12&Itemid=33
Back to top Go down
roadkillguy
Experienced
roadkillguy


Posts : 528
Reputation : 17
Join date : 2010-08-25
Age : 31
Location : Rhode Island

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptySat Sep 11, 2010 2:58 pm

I like the resized hemisphere one.. It may even work within a simple latlon sphere. We wouldn't have strange bumps at the top.. Lemme think about this.
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptySat Sep 11, 2010 6:30 pm

That's a very helpful link, and it covers just about everything we need to implement. Excellent find!
Back to top Go down
Djohaal
Learner
Djohaal


Posts : 144
Reputation : 1
Join date : 2010-12-03

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyFri Dec 03, 2010 11:46 pm

SIGGRAPH man, SIGGRAPH. It is the biggest computer graphics journal out there, and often some of its papers are free! Google for it and go sniffin' on the database
Back to top Go down
Darkov
Newcomer
Darkov


Posts : 58
Reputation : 1
Join date : 2010-09-23

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyMon Jan 03, 2011 6:23 am

the link wont load ?
Back to top Go down
Commander Keen
Industrial Team Lead
Commander Keen


Posts : 1123
Reputation : 36
Join date : 2010-07-23
Location : Czech Republic (not that anyone would know where it is...)

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyMon Jan 03, 2011 5:37 pm

Was working just a few days ago. The basic VTP link is still working though.
Back to top Go down
AIs-null
Learner
AIs-null


Posts : 142
Reputation : 1
Join date : 2011-02-05

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyMon May 16, 2011 1:41 pm

Code:
i = 0;
for(x in 0 to xcount)
  for(y in 0 to ycount)
  {
    addvertex(x * cellwidth, y * cellwidth)

    if(x < (xcount - 1) and y < (ycount - 1))
    {
      addtriangle(i, i + 1, i + xcount)
      addtriangle(i, i + xcount, i + xcount + 1)
    }
  }

Something like this should suffice for a terrain generator. Amiright?
Back to top Go down
Commander Keen
Industrial Team Lead
Commander Keen


Posts : 1123
Reputation : 36
Join date : 2010-07-23
Location : Czech Republic (not that anyone would know where it is...)

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyTue May 17, 2011 11:55 am

Believable terrains will need fractal erosion and snow deposition as well as pretty complex landmasses, but that's something for later. For now, simple perlin should be fine.
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyTue May 17, 2011 8:51 pm

Commander Keen wrote:
Believable terrains will need fractal erosion and snow deposition as well as pretty complex landmasses, but that's something for later. For now, simple perlin should be fine.
That's for dynamic planets, which we'll cover later.
Back to top Go down
roadkillguy
Experienced
roadkillguy


Posts : 528
Reputation : 17
Join date : 2010-08-25
Age : 31
Location : Rhode Island

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyFri May 20, 2011 12:03 pm

AIs-null wrote:
Code:
i = 0;
for(x in 0 to xcount)
  for(y in 0 to ycount)
  {
    addvertex(x * cellwidth, y * cellwidth)

    if(x < (xcount - 1) and y < (ycount - 1))
    {
      addtriangle(i, i + 1, i + xcount)
      addtriangle(i, i + xcount, i + xcount + 1)
    }
  }

Something like this should suffice for a terrain generator. Amiright?

The problem is, we not only have to wrap that around into a sphere, but apply seamless perlin noise to it as well. That means we have to somehow find a way to avoid artifacts at the top. We also need to have a way to LOD the terrain.

EDIT: libnoise works great for perlin noise, that's not the issue.

My idea is to use 3D perlin noise after generating a sphere. We then plug each cartesian (not spherical) coordinate into a 3D perlin noise function. Each value is then used to move that point further or closer to the center of the sphere, creating a seamless heightmap. Unfortunately, hangovers are a no-go with this method. (which probably isn't an issue)
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyFri May 20, 2011 5:15 pm

roadkillguy wrote:
AIs-null wrote:
Code:
i = 0;
for(x in 0 to xcount)
  for(y in 0 to ycount)
  {
    addvertex(x * cellwidth, y * cellwidth)

    if(x < (xcount - 1) and y < (ycount - 1))
    {
      addtriangle(i, i + 1, i + xcount)
      addtriangle(i, i + xcount, i + xcount + 1)
    }
  }

Something like this should suffice for a terrain generator. Amiright?

The problem is, we not only have to wrap that around into a sphere, but apply seamless perlin noise to it as well. That means we have to somehow find a way to avoid artifacts at the top. We also need to have a way to LOD the terrain.

EDIT: libnoise works great for perlin noise, that's not the issue.

My idea is to use 3D perlin noise after generating a sphere. We then plug each cartesian (not spherical) coordinate into a 3D perlin noise function. Each value is then used to move that point further or closer to the center of the sphere, creating a seamless heightmap. Unfortunately, hangovers are a no-go with this method. (which probably isn't an issue)
Hangovers and caves can be added in with boolean operations and populated after the initial heightmap.
Back to top Go down
roadkillguy
Experienced
roadkillguy


Posts : 528
Reputation : 17
Join date : 2010-08-25
Age : 31
Location : Rhode Island

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptySat May 21, 2011 11:55 am

How? How will the vertices be displaced? Were talking low level opengl calls here.
Back to top Go down
AIs-null
Learner
AIs-null


Posts : 142
Reputation : 1
Join date : 2011-02-05

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptySat May 21, 2011 1:23 pm

I belive we have no other option than having caves (and equal) to be independant 3d objects then?
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptySat May 21, 2011 2:03 pm

I suppose caves would have to be independent. I'm no expert on programming in OpenGL, I just assumed you could intersect meshes and delete unnecessary parts to make the caves.
Back to top Go down
roadkillguy
Experienced
roadkillguy


Posts : 528
Reputation : 17
Join date : 2010-08-25
Age : 31
Location : Rhode Island

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyMon May 23, 2011 7:13 pm

Mesh intersection.. you'd have to have an equation governing each cave.. other than that I have no Idea.
Back to top Go down
roadkillguy
Experienced
roadkillguy


Posts : 528
Reputation : 17
Join date : 2010-08-25
Age : 31
Location : Rhode Island

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyTue May 24, 2011 5:50 pm

I've written some code!

EDIT: I found the code box.

Node.cpp:
Code:
#include "Node.h"

using namespace std;

Node::Node(int _levels, int _size)
{
   m_level = _levels;
   m_size = _size;
   
   m_active = false;
   
   m_data = 0;
   
   if(m_level > 1)
   {
      m_a = new Node(m_level - 1, m_size);
      m_b = new Node(m_level - 1, m_size);
      m_c = new Node(m_level - 1, m_size);
      m_d = new Node(m_level - 1, m_size);
      
      m_leaf = false;
   }
   else
   {
      m_a = 0;
      m_b = 0;
      m_c = 0;
      m_d = 0;
      
      m_leaf = true;
   }
   
   //cout << "Node created at level " << m_level << endl;
}

void Node::setActive(bool _active)
{
   int i, j;
   
   if(_active)
   {
      m_data = new float * [m_size];
      for(i = 0;i < m_size;i ++)
      {
         m_data[i] = new float [m_size];
         for(j = 0;j < m_size;j ++)
         {
            m_data[i][j] = 0;  //OR WHATEVER THE VALUE SHOULD BE
         }
      }
   }
   else
   {
      for(i = 0;i < m_size;i ++)
      {
         delete [] m_data[i];
      }
      delete [] m_data;
   }
   
   m_active = _active;
}
Terrain.cpp
Code:
#include "Terrain.h"

using namespace std;

Terrain::Terrain(int _levels, int _nodeSize) //_levels SHOULDN'T BE LESS THAN 1
{
   m_levels = _levels;
   m_nodeSize = _nodeSize;
   
   int leafNum = pow(4, m_levels - 1);
   
   m_size = sqrt(leafNum)*_nodeSize;
   
   m_activeNodeList = new Node * [leafNum];
   
   m_node = new Node(m_levels, _nodeSize);
   
   cout << "There are " << leafNum << " leaves in this terrain (" << sqrt(leafNum) << "x" << sqrt(leafNum) << ") with " << leafNum*_nodeSize*_nodeSize << " data values (" << m_size << "x" << m_size << ") (" << _nodeSize << "x" << _nodeSize << " per leaf)" << endl;
}

void Terrain::UpdateLOD(float _x, float _y, float _depth)
{
   
}
Main.cpp
Code:
#include <iostream>

#include "Terrain.h"

using namespace std;

int main(int _argc, char ** _argv)
{
   Terrain * terrain = new Terrain(8, 8);
   
   return 0;
}
(Assume Node.h and Terrain.h are valid headers)

This is great because.. well it's the data structure for 2D LOD(Level of detail) terrain.

Once a node is created, it is assigned how many more levels of nodes it will, in turn, create. When a node is activated it will initialize it's memory and when it's deactivated, it will delete it's memory, thus conserving RAM --which is essentially the point of LOD. The m_data array contains the list of heights from the average altitude for every vertex on the planet.

The terrain class is essentially a container class for nodes, that contains a list of every possible leaf, as well as some other functions for operating on said node.

If you noticed, the terrain class has an empty function. That's the function that will update which nodes are currently visible/activated. I'm not sure what needs to happen at this point; I'm still thinking of loops and linear functions right now.

In the end, with 8 node levels (layers of subdivision) and 8 vertices per node, it outputs:
There are 16384 leaves in this terrain (128x128) with 1048576 data values (1024x1024) (8x8 per leaf)

Which should give you an idea of just how much memory is used in this data tree.

1048576 floats is 1048576*4 = 4 194 304 bytes of memory. This is for just one of 6 2D faces of the radiated cube. (It's not technically much, but a floating point value may be the wrong datatype to use for the data itself)

Anyway, it's a step in the right direction for terrain that looks like this.


Last edited by roadkillguy on Wed May 25, 2011 9:09 am; edited 3 times in total
Back to top Go down
AIs-null
Learner
AIs-null


Posts : 142
Reputation : 1
Join date : 2011-02-05

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyTue May 24, 2011 6:42 pm

Awwh It's a pain in the...to read Code in non code boxes

Anyways, it looks good. I can't seem to remember what it was called, but it was a method used to hide vertices not shown on screen and just store them on your harddrive instead. That is what you need to put in


Code:
void Terrain::UpdateLOD(float _x, float _y, float _depth)
{
    HERE
  }

Once a terrain is generated, it would need to be stored somewere, and not just erased afterwards so that you can go back and re-visit that area.

I'll get back to this once I can get some sleep...
Back to top Go down
Mysterious_Calligrapher
Biome Team Lead
Mysterious_Calligrapher


Posts : 1034
Reputation : 26
Join date : 2010-11-26
Age : 32
Location : Earth, the solar system, the milky way...

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyTue May 24, 2011 7:18 pm

Terrain - great. Suitably rough when zoomed into, smooths out decently from afar.
Back to top Go down
roadkillguy
Experienced
roadkillguy


Posts : 528
Reputation : 17
Join date : 2010-08-25
Age : 31
Location : Rhode Island

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyWed May 25, 2011 9:01 am

AIs-null wrote:
Awwh It's a pain in the...to read Code in non code boxes

Anyways, it looks good. I can't seem to remember what it was called, but it was a method used to hide vertices not shown on screen and just store them on your harddrive instead. That is what you need to put in


Code:
void Terrain::UpdateLOD(float _x, float _y, float _depth)
{
    HERE
  }

Once a terrain is generated, it would need to be stored somewere, and not just erased afterwards so that you can go back and re-visit that area.

I'll get back to this once I can get some sleep...

I realize that. Would passing around a file pointer be too slow?
Back to top Go down
AIs-null
Learner
AIs-null


Posts : 142
Reputation : 1
Join date : 2011-02-05

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyWed May 25, 2011 11:29 am

roadkillguy wrote:

I realize that. Would passing around a file pointer be too slow?

Now I remember, Occlusion Culling.
https://www.youtube.com/watch?v=fU2L7IdYDVc

It's your choice, so you can try it?
Back to top Go down
roadkillguy
Experienced
roadkillguy


Posts : 528
Reputation : 17
Join date : 2010-08-25
Age : 31
Location : Rhode Island

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyWed May 25, 2011 5:32 pm

Occlusion culling is hardcore.. I've got no idea where to start to make it that fast.

LOD is well, Level of Detail, so the terrain will use more or less vertices depending on how close you are to the object.


I've also come up with a solution to the empty function by placing updateLOD on the node, rather than the terrain. I'm about to put it into code.
Back to top Go down
AIs-null
Learner
AIs-null


Posts : 142
Reputation : 1
Join date : 2011-02-05

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyThu May 26, 2011 1:06 am

How about Face Culling?

Anyways maybe it is more clever to not worry about this right now.
Back to top Go down
roadkillguy
Experienced
roadkillguy


Posts : 528
Reputation : 17
Join date : 2010-08-25
Age : 31
Location : Rhode Island

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyThu May 26, 2011 8:51 am

Face culling isn't very much faster due to the fact that you still iterate through those vertices. It's very easy to enable, and requires no other math.


Code:
void Node::updateLOD(float _x, float _y, float _depth)
{
   if(!m_leaf)
   {
      float dist = sqrt(_x*_x + _y*_y);
      
      cout << "x: " << _x << ", y: " << _y << endl;
      
      float level = dist/LEVEL_THRESHOLD + 1;
      
      cout << "dist: " << dist << endl;
      
      cout << "level: " << level << endl;
      
      cout << "m_level: " << m_level << endl;
      
      cout << "depth: " << _depth << endl;
      
      //ENFORCE THE DEPTH
      if(level < _depth)
      {
         level = _depth;
      }
      
      //IF THIS LEVEL IS DEEPER THAN OUR LEVEL
      if(level < m_level)
      {
         setActive(false);
         
         getNodeA()->updateLOD(-m_width/4 - _x, -m_width/4 - _y, _depth);
         cout << " on A" << endl;
         getNodeB()->updateLOD(m_width/4 - _x, -m_width/4 - _y, _depth);
         cout << " on B" << endl;
         getNodeC()->updateLOD(-m_width/4 - _x, m_width/4 - _y, _depth);
         cout << " on C" << endl;
         getNodeD()->updateLOD(m_width/4 - _x, m_width/4 - _y, _depth);
         cout << " on D" << endl;
      }
      else
      {
         setActive(true);
      }
   }
   else
   {
      setActive(true);
   }
}

This function will hand down the distance relative to each node throughout the node tree, and toggle them displayed or not based on the distance.

The only problem is, I no longer have a way of keeping track of an active node list in my terrain class.
Back to top Go down
~sciocont
Overall Team Lead
~sciocont


Posts : 3406
Reputation : 138
Join date : 2010-07-06

Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures EmptyThu May 26, 2011 6:28 pm

roadkillguy wrote:
Occlusion culling is hardcore.. I've got no idea where to start to make it that fast.

LOD is well, Level of Detail, so the terrain will use more or less vertices depending on how close you are to the object.


I've also come up with a solution to the empty function by placing updateLOD on the node, rather than the terrain. I'm about to put it into code.
What kind of scale is LOD generally done on? (logarithmic or linear)
Back to top Go down
Sponsored content





Interesting terrain generation procedures Empty
PostSubject: Re: Interesting terrain generation procedures   Interesting terrain generation procedures Empty

Back to top Go down
 
Interesting terrain generation procedures
Back to top 
Page 1 of 2Go to page : 1, 2  Next
 Similar topics
-
» Voxel terrain generation
» Miscellaneous Bugs And Questions That Don't Deserve Their Own Thread Thread
» Procedural City Generation
» Keeping gameplay interesting as a domesticated animal
» I found a interesting space simulator you guys might like!

Permissions in this forum:You cannot reply to topics in this forum
Thrive Game Development :: Development :: Programming :: Technical Discussion-
Jump to: