Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (806)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (868)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  What I am up to  (Read 15377 times)
0 Members and 1 Guest are viewing this topic.
Offline princec

« JGO Spiffy Duke »


Medals: 1146
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #30 - Posted 2014-12-30 15:29:28 »

I'm gonna wait patiently for Java to get value types Smiley

Cas Smiley

Offline Roquen

JGO Kernel


Medals: 518



« Reply #31 - Posted 2014-12-30 16:29:15 »

You should be able to exploit symmetry.
Offline princec

« JGO Spiffy Duke »


Medals: 1146
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #32 - Posted 2014-12-30 16:43:13 »

Yes, in theory, but in practice, my brain can't quite cope Smiley This algorithm does have an advantage in simplicity. Well, apart from the memory mangling.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

« JGO Spiffy Duke »


Medals: 1146
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #33 - Posted 2014-12-30 17:12:01 »

Here's the super-duper extra fast uses-barely-any-memory version.

http://pastebin.java-gaming.org/09ab5586c1318

Looks a bit like C code Smiley Runs like it, too (that is, fast)

Cas Smiley

Offline princec

« JGO Spiffy Duke »


Medals: 1146
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #34 - Posted 2014-12-30 17:21:15 »

On to my next problem. I now have a working topology for my world. However, it exists purely in the mathematical sense... there's no "up", there's no way of knowing exactly what it really even looks like. Working backwards from where I need to be...

I have an atlas projection of the world. In fact I've got several different ones, some more suitable than others, but the key piece of data I have is a rectangular bitmap (for now let us assume it contains just 1 or 0 for "land or sea"). I need to wrap that atlas around my sphere, but each node in the sphere is only known by a simple integer index. We know several pieces of information:

- The north pole is index 0
- The south pole is index 11
- There are a known number of territories in the entire globe

However, how exactly the hexes are laid out in memory - that is, the order of their indicies - I have no actual idea. There is no deliberate relation between index and any notional physical coordinate.

This is arguably a much more interesting problem Smiley

Cas Smiley

Offline princec

« JGO Spiffy Duke »


Medals: 1146
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #35 - Posted 2014-12-30 17:24:23 »

My thinking on this one is to adapt the existing algorithm to actually calculate the 3D coordinates of the vertices, and then use some manner of "texture mapping" to sample the bitmap. (Note: still not actually concerned with rendering or OpenGL or anything here... this is purely nonvisual data)

Cas Smiley

Offline Riven
Administrator

« JGO Overlord »


Medals: 1371
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #36 - Posted 2014-12-30 17:36:39 »

Google Maps uses this conversion between coordinate systems:

http://en.wikipedia.org/wiki/List_of_common_coordinate_transformations#From_spherical_coordinates

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline lcass
« Reply #37 - Posted 2014-12-30 17:42:35 »

Well considering the icosahedron is a relatively "low def" shape , maybe go the way of the periodic table at indexing , think of it like flattening out the shape into a 2d map , with north (0) at the centre at the top and the south at the bottom (final index) run through this left to right binding. This should be fairly easy to do. I dont really understand how you generate the icosahedron fully but when you are creating it surely you should be able to store the locations of it whilst generating.
Hope this helps.
Thanks.
Offline Roquen

JGO Kernel


Medals: 518



« Reply #38 - Posted 2014-12-31 09:34:42 »

Quote
You should be able to exploit symmetry.
Yes, in theory, but in practice, my brain can't quite cope...
Well obviously mine's not working so well.  I'm not really thinking about memory reduction or speeding up the generation process but using symmetry to be able to have a simple enumeration of all cells to allow fast "do-stuff": calc index, neighbors, etc. and things built on top of these basic ops.

At zero subdivisions you have 20 tris and 12 cells and the 12 cells will all be pentagons.  After 'n' subdivision steps we still have 12 pentagons which will remain in the same configuration as the unsubdivided version (the centers of pentagons are the 12 original vertices).  So we can have a pentagon at each of the poles and place the north one so there's a vertex straight in the 'east' direction.

Actually look at HeroesGraveDev's posted link - http://kiwi.atmos.colostate.edu/BUGS/geodesic/text.html

It's showing the 5 fold symmetry about the poles (one per color).  And at each vertex of the colored spherical triangles is one of the pentagons.  And each color is made up of four spherical triangles each of which can be folded.  So all of the information is less than one of colored spherical tris.  Less since it has exploitable symmetry as well.  So the interesting thing would be to device a good ordering of symmetry manipulations which is cheap.  (extra credit for someone that can come up with a cheap space filling curve ordering which minimizes the neighbor distance between all cells.)

Somebody check me.  Is all of this correct?
Offline princec

« JGO Spiffy Duke »


Medals: 1146
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #39 - Posted 2015-01-05 14:05:55 »

In case anybody was looking... the pastebinned code above of mine produces a valid topology but one which is decidedly non-Euclidian Smiley When it came to actually visualising what I'd produced it was like something from the 9th dimension.

Some tweaks to the algorithm have sorted it.

The data structure I've settled on for rendering is subdivided faces down to a certain level; and then at the bottom, "buckets" of the smallest faces. The plan is to do a frustum cull based on the upper levels of subdivided faces, and thus end up with a number of potentially visible buckets of faces, which I'll just render in their entirety. As an added bonus I can do a little trick with the top level faces by projecting a triangle out of it which is at a tangent to the midpoint of the face, and thus do a simple winding order normal test on a whole face and all its children in one go and eliminate them early.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

« JGO Spiffy Duke »


Medals: 1146
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #40 - Posted 2015-01-07 10:03:13 »

More stuff:
http://www.java-gaming.org/topics/geodesic-sphere-topology/35346/msg/334542/view.html#msg334542

Cas Smiley

Pages: 1 [2]
  ignore  |  Print  
 
 

 
Riven (587 views)
2019-09-04 15:33:17

hadezbladez (5528 views)
2018-11-16 13:46:03

hadezbladez (2410 views)
2018-11-16 13:41:33

hadezbladez (5790 views)
2018-11-16 13:35:35

hadezbladez (1233 views)
2018-11-16 13:32:03

EgonOlsen (4669 views)
2018-06-10 19:43:48

EgonOlsen (5688 views)
2018-06-10 19:43:44

EgonOlsen (3205 views)
2018-06-10 19:43:20

DesertCoockie (4104 views)
2018-05-13 18:23:11

nelsongames (5125 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!