Thrive Game Development

Development of the evolution game Thrive.
 
HomeHome  PortalPortal  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  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 2 users online :: 0 Registered, 0 Hidden and 2 Guests

None

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

» To all the people who come here looking for thrive.
by NickTheNick Sat Sep 26, 2015 10:22 pm

» Build Error Code::Blocks / CMake
by crovea Tue Jul 28, 2015 5:28 pm

» Hello! I can translate in japanese
by tjwhale Thu Jul 02, 2015 7:23 pm

» On Leave (Offline thread)
by NickTheNick Wed Jul 01, 2015 12:20 am

» Devblog #14: A Brave New Forum
by NickTheNick Mon Jun 29, 2015 4:49 am

» Application for Programmer
by crovea Fri Jun 26, 2015 11:14 am

» Re-Reapplication
by The Creator Thu Jun 25, 2015 10:57 pm

» Application (programming)
by crovea Tue Jun 23, 2015 8:00 am

» Achieving Sapience
by MitochondriaBox Sun Jun 21, 2015 7:03 pm

» Microbe Stage GDD
by tjwhale Sat Jun 20, 2015 3:44 pm

» Application for Programmer/ Theorist
by tjwhale Wed Jun 17, 2015 9:56 am

» Application for a 3D Modeler.
by Kaiju4u Wed Jun 10, 2015 11:16 am

» Translator to Serbian here
by Simeartherist Sun Jun 07, 2015 6:36 am

» Presentation
by Othithu Tue Jun 02, 2015 10:38 am

» Application of Sorts
by crovea Sun May 31, 2015 5:06 pm

» want to contribute
by Renzope Sun May 31, 2015 12:58 pm

» Music List Thread (Post New Themes Here)
by Oliveriver Thu May 28, 2015 1:06 pm

» Application: English-Spanish translator
by Renzope Tue May 26, 2015 1:53 pm

» Want to be promoter or project manager
by TheBudderBros Sun May 24, 2015 9:00 pm


Share | 
 

 Planetary coordinates

View previous topic View next topic Go down 
Go to page : 1, 2  Next
AuthorMessage
roadkillguy
Experienced


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

PostSubject: Planetary coordinates   Sat Aug 28, 2010 8:11 pm

I found this pretty cool link

It uses some pretty simple equations too!

With this, we would save the altitude for points that are grid-oriented, and then map them to a sphere to make a planet!
Back to top Go down
View user profile
Commander Keen
Industrial Team Lead


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

PostSubject: Re: Planetary coordinates   Sun Aug 29, 2010 2:52 am

This might be useful, but I'm not a maths guy, I don't understand how it works. Let's have Bashi see it.
Back to top Go down
View user profile
Invader
Experienced


Posts : 528
Reputation : 11
Join date : 2010-07-10
Age : 20

PostSubject: Re: Planetary coordinates   Sun Aug 29, 2010 1:48 pm

Pretty cool... if I wasn't a complete and total idiot in math class.
Back to top Go down
View user profile
~sciocont
Overall Team Lead


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

PostSubject: Re: Planetary coordinates   Sun Aug 29, 2010 2:55 pm

Couldn't we just use regular lat/long?

_________________
Remember our goals: simplicity, science, and playability. Keep them in mind always.
[OE]|[FAQ]|[Wiki]|[My Blog]
Back to top Go down
View user profile
roadkillguy
Experienced


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

PostSubject: Re: Planetary coordinates   Sun Aug 29, 2010 3:16 pm

The problem with LatLon coordinates is that when you get to the poles of the sphere, the points get much, much closer together. It would be hard to measure distances across this sphere, and would cause texturemaps and heightmaps to become ultradense and distorted.

With this method, we would define 6 boxes. One for each side of the cube. Each of the datapoints in the box would represent an altitude for it's point. We wouldn't have to worry about the poles this way.

I found out it's actually how most planet simulators do it. I'm also thinking about using ogre, rather than writing my own engine completely from scratch.
Back to top Go down
View user profile
~sciocont
Overall Team Lead


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

PostSubject: Re: Planetary coordinates   Sun Aug 29, 2010 3:22 pm

roadkillguy wrote:
The problem with LatLon coordinates is that when you get to the poles of the sphere, the points get much, much closer together. It would be hard to measure distances across this sphere, and would cause texturemaps and heightmaps to become ultradense and distorted.

With this method, we would define 6 boxes. One for each side of the cube. Each of the datapoints in the box would represent an altitude for it's point. We wouldn't have to worry about the poles this way.

I found out it's actually how most planet simulators do it. I'm also thinking about using ogre, rather than writing my own engine completely from scratch.
If it works better, I'm all for it.

_________________
Remember our goals: simplicity, science, and playability. Keep them in mind always.
[OE]|[FAQ]|[Wiki]|[My Blog]
Back to top Go down
View user profile
Bashinerox
Programming Team lead


Posts : 238
Reputation : 8
Join date : 2010-07-07
Age : 27
Location : Australia

PostSubject: Re: Planetary coordinates   Tue Aug 31, 2010 11:14 am

Yes, no, yes, no, yes, no, yes, no, undecided.

Pros:
Much easier to map some form of "game grid" onto the sphere. You simply treat it as a cube.


Cons:
Possible artifacts at "cube edges". Can you test this with various textures, and post results?

If i'm looking at it right, we need to distort the textures slightly at the inverse of the cubemapping to get the them to look right
Back to top Go down
View user profile
roadkillguy
Experienced


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

PostSubject: Re: Planetary coordinates   Tue Aug 31, 2010 5:11 pm

What do you propose we use then? I don't think the texturemaps will have to stretch very much unless we use one for the whole planet :affraid:, and I don't like the idea of lat-lon vertices.

I haven't even made a hollow subdivided cube yet, so I can't exactly test it.:lol:
EDIT: By made, I mean "Written an algorithm to do it based on a specific width" It wouldn't be too hard to do it manually, I just want to write a master-equation. Which is hard.

Also, we need some method of LOD (Level of Detail) decimation. I found something called quadtrees, but I have yet to look at any source.
Back to top Go down
View user profile
Bashinerox
Programming Team lead


Posts : 238
Reputation : 8
Join date : 2010-07-07
Age : 27
Location : Australia

PostSubject: Re: Planetary coordinates   Tue Aug 31, 2010 8:03 pm

Aha, just as in the other post i replied to, yes you use quadtrees to represent the sphere's surface. setting the texture coordinates shouldnt be too hard, if you can reverse the transforms done on the cube in order to get a sphere
Back to top Go down
View user profile
roadkillguy
Experienced


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

PostSubject: Re: Planetary coordinates   Tue Aug 31, 2010 10:17 pm

I would actually think to create the sphere, and then modify the (altitude) of each point. Maybe that's not what you were talking about.
Back to top Go down
View user profile
Bashinerox
Programming Team lead


Posts : 238
Reputation : 8
Join date : 2010-07-07
Age : 27
Location : Australia

PostSubject: Re: Planetary coordinates   Tue Aug 31, 2010 10:45 pm

Okay..

The planet would be represented by 6 quad trees. one for each flat edge of a cube. The quad trees are wrapped around a spherical shape.

A quad tree is as follows:

you have a node, the root node, that can be split into four more nodes.


Code:

      O
      |
  ----------
  |  |  |  |
  O  O  O  O

each of these nodes can then be split into four more nodes, and so on.
the lowest level nodes, ones without nodes underneath them, are called leafs.
(note, however, that each leaf isnt necessarily sitting the same amount of nodes in.)

Each leaf represents a cell. And when taking into account what i said in parenthesis above, each cell could be a different size. This is how the example video represents the data for the planet. If the leaf gets a set distance to the camera, it splits. when the camera moves away again, the leafs are discarded.

Every time you split a leaf, you need to generate more detail. so each leaf then needs to have its height modified by some amount.
if you use a psuedo-random function with the coordinates of the leaf on the tree, you can recreate the same planet every single time.

Of course, you would eventually stop splitting the leafs as well, you need to impose a limit, to stop "infinity detail" being created and asploding the cpu
Back to top Go down
View user profile
roadkillguy
Experienced


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

PostSubject: Re: Planetary coordinates   Tue Aug 31, 2010 11:00 pm

I understand how it works, it's just the act of creating the vertex and triangle lists that will seem a little more daunting. Not to mention the texture mapping.
Back to top Go down
View user profile
Bashinerox
Programming Team lead


Posts : 238
Reputation : 8
Join date : 2010-07-07
Age : 27
Location : Australia

PostSubject: Re: Planetary coordinates   Tue Aug 31, 2010 11:24 pm

If you walk through the tree as follows:
Code:

    u
l        r
    d
   
child1 child2
child3 child4
Code:

walk(node, l,u,r,d)
{

node->settexturecoords(l,u,r,d)


if(node->child1)walk(node-child1, l, u, r/2, d/2)
if(node->child2)walk(node-child2, r/2, u, r, d/2)
if(node->child3)walk(node-child3, l, d/2, r/2, d)
if(node->child4)walk(node-child4, r/2, d/2, r, d)
return
}
(Of course i wouldnt use recursion, but it's simpler to write out than a loop.)
(And i'm not sure if that is exactly, right, it looks right to me though.)

l,u,r,d are the negative and positive horizontal and vertical limits of the edges of the node.

the root node's limits are -1,1. Each planet would get 6 textures.
texture coordintates are clamped to 0,1, so you would have to halve the number, then add 0.5 to get the texture coordinates from the cell limits.
Back to top Go down
View user profile
roadkillguy
Experienced


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

PostSubject: Re: Planetary coordinates   Wed Sep 01, 2010 9:05 am

You must have done this before..
Back to top Go down
View user profile
Bashinerox
Programming Team lead


Posts : 238
Reputation : 8
Join date : 2010-07-07
Age : 27
Location : Australia

PostSubject: Re: Planetary coordinates   Thu Sep 02, 2010 1:11 am

Yes and no
Back to top Go down
View user profile
roadkillguy
Experienced


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

PostSubject: Re: Planetary coordinates   Fri Sep 03, 2010 9:57 pm

There's another algorithm I've found.. It's called the ROAM algorithm. They simply subdivide where the camera is, and desubdivide where it's not. They have versions for sphere mapping as well.
Back to top Go down
View user profile
Bashinerox
Programming Team lead


Posts : 238
Reputation : 8
Join date : 2010-07-07
Age : 27
Location : Australia

PostSubject: Re: Planetary coordinates   Fri Sep 03, 2010 10:08 pm

Looks interesting.
Back to top Go down
View user profile
roadkillguy
Experienced


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

PostSubject: Re: Planetary coordinates   Sat Sep 04, 2010 1:28 pm

For simplicity's sake I was thinking of something like the following:



Not necessarily like a quadtree, just sectioned LOD. It may prove to not work if the planet is VERY large, but for this game I was thinking spore sized planets or less.

It would work by having nodes that contain two-dimensional arrays. To get the vertices, we render the initial grid, and then add more vertices depending on the detail level.

It works in my head anyway

EDIT: Here's some pseudo-code.

Spoiler:
 


Last edited by roadkillguy on Sat Sep 04, 2010 4:50 pm; edited 4 times in total
Back to top Go down
View user profile
Commander Keen
Industrial Team Lead


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

PostSubject: Re: Planetary coordinates   Sat Sep 04, 2010 2:56 pm

Planets should be as scalabe as possible, because right now we can't just see what size will have the best gameplay/performance ratio. Limiting it to Spore size or less might lead us into problems later.
Back to top Go down
View user profile
roadkillguy
Experienced


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

PostSubject: Re: Planetary coordinates   Sat Sep 04, 2010 3:11 pm

I'm sure it will work for what we're trying to do.
Back to top Go down
View user profile
~sciocont
Overall Team Lead


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

PostSubject: Re: Planetary coordinates   Sat Sep 04, 2010 10:16 pm

roadkillguy wrote:
I'm sure it will work for what we're trying to do.
Again, experimentation is the best way to figure this out.

_________________
Remember our goals: simplicity, science, and playability. Keep them in mind always.
[OE]|[FAQ]|[Wiki]|[My Blog]
Back to top Go down
View user profile
roadkillguy
Experienced


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

PostSubject: Re: Planetary coordinates   Sat Sep 04, 2010 10:18 pm

Yep. And I just got the ManualObject class working in OGRE. Time to write some loops.
Back to top Go down
View user profile
~sciocont
Overall Team Lead


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

PostSubject: Re: Planetary coordinates   Sat Sep 04, 2010 10:22 pm

roadkillguy wrote:
Yep. And I just got the ManualObject class working in OGRE. Time to write some loops.
Fun. Keep up the good work.

_________________
Remember our goals: simplicity, science, and playability. Keep them in mind always.
[OE]|[FAQ]|[Wiki]|[My Blog]
Back to top Go down
View user profile
The Uteen
Sandbox Team Lead


Posts : 1476
Reputation : 70
Join date : 2010-07-06
Age : 20
Location : England, Virgo Supercluster

PostSubject: Re: Planetary coordinates   Sun Sep 05, 2010 6:11 am

This be used to increase detail in the center of your vision, where you are looking - things in the corner of your eye wont be detailed, you have to look round to see what it is. What do you think?
Back to top Go down
View user profile
roadkillguy
Experienced


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

PostSubject: Re: Planetary coordinates   Sun Sep 05, 2010 10:31 am

That's what it's for. Yes.
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Planetary coordinates   Today at 4:01 pm

Back to top Go down
 
Planetary coordinates
View previous topic View next topic Back to top 
Page 1 of 2Go to page : 1, 2  Next

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