Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (711)
Games in Android Showcase (213)
games submitted by our members
Games in WIP (785)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  3d world  (Read 3898 times)
0 Members and 1 Guest are viewing this topic.
Offline lunarknight

Senior Newbie

Java games rock!

« Posted 2004-04-23 15:06:33 »

How would one implement wrapping a flat 3d world so that it simulates being on a sphere? Ie.. you would run forward and be able to run forever because it wraps around.  I want to implement it this way because I want the world to be flat... but also ... to loop. It's hard to explain! It's like the old flying astroid game where you fly up and suddenly appear on the bottom so you can fly straight forever. But since this is 3d, you should be able to render the stuff on the bottom of the world when you are near the top...
Offline MickeyB

Senior Devvie

my game will work, my game will work!

« Reply #1 - Posted 2004-04-23 16:31:30 »

You want things to appear flat like they do to the human eye, but acutally walk like I would if there was a bridge around the earth...looks flat, but x tim elater I would be back where I started.

Not sure if this would work, but could you set a min and max x and y and if you pass the max, you end up at the min, and vice versa ??!


Current Project:
Offline lunarknight

Senior Newbie

Java games rock!

« Reply #2 - Posted 2004-04-24 00:15:34 »

I think I need to use modular arithmitic... so that if I go past the world limit, it will round to the opposite side of the world...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline javawillie

Junior Devvie

Hola, Paco.

« Reply #3 - Posted 2004-04-24 02:12:02 »

That is exactly right.  For example, if your world was 255*255, then you can set x = (x + deltax) % 255.
Offline CodexArcanum

Senior Newbie

Games == Life

« Reply #4 - Posted 2004-04-24 16:13:10 »

Just a note (Because I like to nag about these things) but if you go off the top and appear on the bottom and then go off one side and appear on the other, then it's not a spere.  That shape is technically called a torus, aka, the donut.  If the world were a flattened sphere, then going off the bottom would bring you back up on the bottom and one radii distance to the side.
Offline bmyers

Junior Devvie

« Reply #5 - Posted 2004-04-26 14:49:07 »

There's two basic ways to approach this:

1)  Use spherical coordinates for everything, and use great-circle calculations for direction, movement, distance, et al.   These are very hard to make fast, since you have to give up all straight-line calculations.

2)  Invent a tile-based system that more-or-less evenly tesselates over a sphere.  Plan on spending lots of time looking at soccer balls and such, and thinking about 72-degree angles.

Both of these approaches are much more difficult than you might think.  We looked at both approaches for our current game and eventually settled on #2.  However, in the process we had to invent an entire coordinate system that is then used for distance and direction calculations.  In retrospect, we might have done a different type of game if we had known how hard this was going to be.

You will basically not be able to use a lot of existing algorithms for your game, because they are mostly assuming flat surfaces.   Plan on spending a *lot* of time on just getting basic geometry stuff working correctly.  And don't get me started on sphere-based navigation and camera positioning... Tongue

On the other hand, having gone through the pain and ending up with a pretty cool system, I can say that the end result may well be worth it.   Roll Eyes  Being able to fly (or walk) all over an entire planet is actually pretty cool...

Also, a lot depends on what kind of game you are making.  If you just want to do collision detection on a sphere for purposes of placing a 3D model, then it's easy.  But it gets harder real fast when you start talking about movement.

Offline javawillie

Junior Devvie

Hola, Paco.

« Reply #6 - Posted 2004-05-03 20:30:44 »

I dunno, maybe it would be cool to have a donut-shaped planet...   Cheesy

But I think the actual shape wouldn't even be a donut.  It would be more like a thick washer.  The reason is the same reason it wouldn't be a sphere.  If the map were interpreted as a sphere, then we would have to assume some kind of spacetime distortion if you move off of a great circle.  Similarly, if you travel along the major circumference of a torus, there is only one great circle, and we'd have to assume a distortion off of that great circle.

"In the beginning, there was a washer-shaped planetoid called Galacto..."
Offline winkman

Senior Newbie

Java games !

« Reply #7 - Posted 2005-07-14 14:50:08 »

Ok, so i'm a bit late here but what You want to achieve is perfectly reasonable.
take a look at: for details

edit: Seamless World and Donut World are the ones to look at Wink
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Archive (91 views)
2017-02-27 19:41:49

Riven (83 views)
2017-02-27 17:26:59

numerical (450 views)
2017-02-21 07:32:16

numerical (455 views)
2017-02-21 07:31:46

theagentd (563 views)
2017-02-18 13:42:33

theagentd (559 views)
2017-02-18 13:35:16

h.pernpeintner (1734 views)
2017-01-24 22:39:11

h.pernpeintner (1689 views)
2017-01-24 22:38:32

Galdo (2271 views)
2017-01-12 13:44:09

Archive (2183 views)
2017-01-02 05:31:41
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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‑
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!