Ferrous Moon
http://www.ferrousmoon.com:80/forums/

2D Objects on a 3D map
http://www.ferrousmoon.com:80/forums/viewtopic.php?f=45&t=1633
Page 1 of 2

Author:  eddieringle [Sat Dec 20, 2008 3:13 pm ]
Post subject:  2D Objects on a 3D map

UPDATE 8/16/2009: Decided to switch to C++, SDL, and CrissCross for the game, JOGL is not user-friendly at all.

-- Original post --
Yeah, I know what you people are thinking, a game in Java would be a horrible idea due to Java's performance, or lack thereof. But, I want to give it a shot, so I need a little help.

Who knows if I'll continue with this game or just drop it, but it'll be good experience either way.

Now, if anyone has played Runescape Classic, then you'll know what I am talking about when I explain what I need. Because a total 3D game right now is too much for just me to handle, I was thinking of creating a 3D map and using 2D sprites. My problems are as follows:
  • Creating a simple 3D map and being able to add/remove objects from it easily.
    Collision detecting between the 2D sprites and the 3D objects.
I'm guessing I'll have to write in-house tools for the map and pretty much everything else, but if anyone can help with this it'd be appreciated.

And once again, this is not a thread where I will be taught how slow Java is, I already know C++ is faster, but I want to try it in Java.

Author:  prophile [Mon Dec 22, 2008 5:14 pm ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

To have good performance (read: more than 1 or so fps) you'll need to have some kind of space partioning. Judging by what you've said there, I recommend implementing the Quadtree structure. You should make your self very familiar with matrices and vectors from the linear algebra side, you'll find 4x4 matrices the most useful since these can represent any 3D transformation. Look up billboard geometries, which you'll find useful to display the 2D sprites within the 3D environment.

Author:  Chase [Wed Dec 24, 2008 12:44 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

Quadtree? For 3D? No no, an Octree is the way to go here.

But I think your jumping in a little quick, I suggest you start with 2D then move up to 3D. 3D in Java is not a simple process, not that it really is in any language that can still call itself such.

Try a few simple AWT 2D games, I find a simple Tetris clone is a nice warm up as it is simple enough not to be annoying, but complex enough to cover all the ground. It gives you some good introduction into graphics buffering and game logic.

If Tetris is to much work for practice, Minesweeper is simpler on the game logic side of things. After you have those, then I can tell you almost all you will need to know to start on 3D in Java.

Also tackling a 3D game by yourself is a real chore, believe me I know. 2D is a great deal more simple. (Plus the math is thousands of times easier).

Your most likely to give up if you try jumping right into the 3D stuff. Really graphics is a pain, the actual game logic is a great deal more simple. Even getting things to behave correctly in a 3D environment can be painful, with the rotations and the eventual Gimbal lock if you don't use Quaternions. Not to mention the camera work assuming you don't use orthogonal or planar viewing angles.

If I had to give any advice it would be not to mix graphics and game logic together if you can avoid it. While its simpler in the short run to have the game logic directly call graphic functions, it can be far more difficult to debug.

Author:  prophile [Wed Dec 24, 2008 9:15 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

Quote:
Quadtree? For 3D? No no, an Octree is the way to go here.
Judging by what he's said so far, everything's going to be ground-aligned, therefore the vertical part isn't particularly problematic, so a Quadtree is the way to go, not an Octree. Believe me, I do know what I'm talking about.

Author:  eddieringle [Wed Dec 24, 2008 9:21 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

Quote:
Quote:
Quadtree? For 3D? No no, an Octree is the way to go here.
Judging by what he's said so far, everything's going to be ground-aligned, therefore the vertical part isn't particularly problematic, so a Quadtree is the way to go, not an Octree. Believe me, I do know what I'm talking about.
I guess use Runescape as an example, as that's what I'm modeling it after.

Author:  Chase [Wed Dec 24, 2008 12:37 pm ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

Quote:
Quote:
Quadtree? For 3D? No no, an Octree is the way to go here.
Judging by what he's said so far, everything's going to be ground-aligned, therefore the vertical part isn't particularly problematic, so a Quadtree is the way to go, not an Octree. Believe me, I do know what I'm talking about.
Oh, that, I was thinking more in the terms of raw 3D graphics. You use an Octree to partition the screen and not render things not on screen.

Author:  prophile [Thu Dec 25, 2008 8:17 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

Yes, same with a Quadtree.

Author:  Miah [Thu Dec 25, 2008 11:10 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

Except Quadtrees work better with 2D or 3D where Z isn't really a thing to worry oneself over.

Author:  prophile [Thu Dec 25, 2008 8:33 pm ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

And in this case, where the terrain is a simple heightmap and the actors are 2D sprites, we have one axis not to worry about (Y).

Author:  Chase [Fri Dec 26, 2008 12:20 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

I don't want to argue about it. At this point its a losing battle anyway (I didn't do my homework on his example game).

I admit if it is fairly simple downward view, it won't turn out to bad, and might be faster, but if you have much camera tilt, its suicide. :/

By suicide, I mean it would probably be easier to have an octree, or face performance issues.

I still think he should try some 2D games first, to get a feel for the flow of writing a game. 3D can be fairly unforgiving to those who dive right into it.

Author:  prophile [Fri Dec 26, 2008 10:12 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

Camera tilt is dealt with by frustum culling rather than the actual scene graph structure.

Author:  Chase [Sat Dec 27, 2008 8:52 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

Quote:
Camera tilt is dealt with by frustum culling rather than the actual scene graph structure.
Your right, I apologize.

Author:  eddieringle [Fri Aug 14, 2009 9:26 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

Sorry to dig up an old post, but would all of this information still be accurate if I wanted to use 2d sprites and 3d buildings?

Author:  bluechill [Sat Aug 15, 2009 6:12 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

most likely and it seems a good way and would be the way I would do such a thing in java (not in c++ but java). One of the langs I know is java but I learned it as my first programming lang awhile a go so I can't help you more than just telling you it would be a good approach.

Author:  eddieringle [Sat Aug 15, 2009 6:59 am ]
Post subject:  Re: Writing a Java game, want to use a 3D map... so...

I think it'll be good for me to work on something in Java seeing as this sophomore year we will be working with Java. I'm also taking Web Design 1 & 2. :)

Page 1 of 2 All times are UTC-05:00
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/