I am planning to make a simple game of snake in java. I thought why not make a 3D snake, but i couldn't find any 3D drawing classes in java sdk. I just require basic 3D shapes like cuboids and spheres. Would i have to go for the java 3D API? I really don't want to invest much time in that.
Probably not. If you just want the snake game to look 3D (with a raised effect, like windows buttons) or even isometric (where the view is from a constant angle, like 45 degrees above), you are better of just creating 3D-looking graphics and making it as normal. A lot of games use graphics created in something like 3D Studio MAX, which are rendered into 2D and put into the game, which makes it look 3D but keeps things simple. Java 3D can do a lot, but it takes a bit of learning, especially if you haven't done much 3D before. One you get into it it's fairly simple, but you have to learn all about scene graphs, transforms, behaviors etc before you can actually make anything useful. You can't just say cube(1,1,1) and get a cube on the screen, you need to set up a virtual universe, set up a view, etc.. If you want to make a full-on 3D snake, it would definately be worth looking into, but if you just want it to look good it's probably more hassle than it's worth.
Joined: Nov 30, 2000
you are better of just creating 3D-looking graphics and making it as normal.
How do i go about this. Can u please elaborate how to create 3D looking graphics myself.
Joined: Nov 08, 2000
At the most simple level, you can make something look 3D-like with a couple of coloured lines. If you are using Windows (or anything else that does this), just check out the buttons - they are a flat grey colour with lighter lines on the top & left, and darker lines bottom & right. This works quite well for blocky graphics, which you are probably using. Taking it to the next level, you can create graphics in a 3D modelling package and use them in your game. This is a bit more involved of course, but you can get some 3D apps free, create the graphics you want, and render them to a 2D image. You can even aminate it like it's 3D - I did this with a vertical scrolling shooter, which had a 3D ship rolling as you moved sideways. it was simply a case of rendering it from about 10 different angles each side, and animating it within the game according to how the ship was moving. it was in C though, so the code probably wouldn't be much use.