Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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 2868 times)
0 Members and 1 Guest are viewing this topic.
Offline lunarknight

Senior Newbie




Java games rock!


« Posted 2004-04-23 17: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 Member




my game will work, my game will work!


« Reply #1 - Posted 2004-04-23 18: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 ??!


MickeyB

Current Project: http://www22.brinkster.com/mbowles/
Offline lunarknight

Senior Newbie




Java games rock!


« Reply #2 - Posted 2004-04-24 02: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 Member




Hola, Paco.


« Reply #3 - Posted 2004-04-24 04: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 18: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 Member





« Reply #5 - Posted 2004-04-26 16: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 Member




Hola, Paco.


« Reply #6 - Posted 2004-05-03 22: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 16:50:08 »

Ok, so i'm a bit late here but what You want to achieve is perfectly reasonable.
take a look at: http://irrforge.org/index.php/Tutorials 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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (37 views)
2014-07-18 06:55:21

Zero Volt (35 views)
2014-07-17 23:47:54

danieldean (28 views)
2014-07-17 23:41:23

MustardPeter (31 views)
2014-07-16 23:30:00

Cero (46 views)
2014-07-16 00:42:17

Riven (47 views)
2014-07-14 18:02:53

OpenGLShaders (36 views)
2014-07-14 16:23:47

Riven (36 views)
2014-07-14 11:51:35

quew8 (32 views)
2014-07-13 13:57:52

SHC (69 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!