• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Project where you can't see the whole screen question

 
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To have a project where you can't see the whole screen, such as an FPS, would you use something like this?:


Like for example, if you are rounding a corner, you can't see around it. When you round the corner, could you set off a "checkpoint" to getOffScreenCanvas or getOffScreenLocation? I'm not completely understanding how to do this.
Thanks,
cc11rocks
 
Saloon Keeper
Posts: 15714
367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you be a bit more specific in what you mean? What do you want to achieve?
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take the famous game, Call of Duty. You cannot see the whole map at one time (I am NOT talking about the mini-map). You just have this screen in front of you where you can see certain objects at one time. If you are in a building facing south, you don't have to see the opposite building facing north. To increase performance and playability, would you render the objects off screen once they turn to a different position? I would think if you had everything showing up at once, it would be too much for the system. So you have to create all the objects off screen and then when the user is there, draw them on screen. Do you understand what I am saying?

cc11rocks AKA John Price
 
Stephan van Hulst
Saloon Keeper
Posts: 15714
367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand what you mean. This is also something you don't have to worry about. All of this is handled for you.

It's important to understand that all you have to do is tell the graphics library which objects are located where in your game world. The graphics library will take care of only rendering the objects that you should be able to see.

Sure, you can take a bit of work away from the graphics library by not telling it about objects, and this is actually done by some games (think about drawing distance in games like Fallout 3, or Grand Theft Auto). Some objects only appear when you are close enough to them. This is an example of hiding objects from the graphics library. But they are only optimizations. The library is smart enough to do as little work as possible, to get you the result you want.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay cool. I have one question. How would you go about doing that? How would you show a car and when they turn left (objects move right). You would fill up all the space on the screen. If you used a JFrame, and it was 300 X 300, would you have to use -x and -y and more than 300 for x and y to show additional objects (where they can't see it until they turn). Like for example:
You are looking at a car. The car's position x is 200. It is in a canvas or JFrame at a size of 300. There is a building to the right. But you can't see it until you turn. Would you make the building's position 450?
Thanks,
cc11rocks aka John Price
 
Stephan van Hulst
Saloon Keeper
Posts: 15714
367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, that's not really how it works. The screen's dimensions are completely independent from your 3D world. You put your objects at specific locations in the world, relative to some origin (the 0,0,0 coordinate). The origin is where you determine it is. For instance, you could put the origin at the very rightmost edge of your world, and all the x-coordinates would be negative. Then you tell the graphics library where the camera is located, which direction it points at, and everything should be taken care of.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I've found in the API is something called "virtual world". Do I use that for what I am describing?
Thanks,
cc11rocks

EDIT: "virtual universe"
 
Stephan van Hulst
Saloon Keeper
Posts: 15714
367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know what API you are using.

Have you already looked up a tutorial?
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the Java3D API for VirtualUniverse:

http://profile.iiita.ac.in/IEC2008063/Documents/study/Java/Java%20Documentation%20and%20Trails/java3d-1_5_0-docs/javax/media/j3d/VirtualUniverse.html

Thanks,
cc11rocks AKA John Price

EDIT: Is this a tutorial that I need for the type of thing I am describing?

http://profile.iiita.ac.in/IEC2008063/Documents/study/Java/Java%20Documentation%20and%20Trails/java3d-1_5_0-docs/javax/media/j3d/doc-files/intro.html

EDIT2: Found another one, one which I think explains what I am trying to do:

http://www.tecgraf.puc-rio.br/~ismael/Cursos/Cidade_CG/labs/Java3D/Java3D_onlinebook_selman/Htmls/3DJava_Ch04.htm

This is an exert from the site:


This scenegraph shown in figure 4.4 embodies the following relationships:

Moving the grass area upon which the racing circuit sits will also move the circuit and the trees around it.
Moving the circuit will move the advertising billboards, people at the circuit, cars on the circuit, straw bales, and the start light.
Moving a F1 car moves its component parts: stabilizer, rear fin, chassis, and wheels.
Rotating an F1 car’s wheels will rotate the wheel’s spokes, rim, and tire.



That answers my question basically.

If you are in a building and you push left, you would move (in this example) the grass area. That would move the entire Universe. Am I correct? If you don't know what I am talking about, please look at the tutorial...It's short.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
John, I think you should consider going up a level of abstraction or three and using an actual game engine; Java3D is both low-level and (increasingly) poorly-supported. Why make things hard on yourself. Consider something like jMonkeyEngine or Jpct, and spend your time worrying about what you're building instead of the low-level mechanics.

In the meantime, if you're interested in learning more about the low-level stuff, I'd heartily recommend reading a book or three on the theory before trying to code any more. Maybe something like Alan Watt's "3D Computer Graphics" or Eberly's "3D Game Engine Design." Both of these are more about theory, math, and concepts rather than the low-level stuff you're worried about: it really, really helps to understand those big ideas before trying to implement 3D worlds yourself.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jMonkeyEngine does not work with my graphics card. But I'll look into more engines, thanks. Thank you both!
John Price AKA cc11rocks

EDIT: Is Jake2 worth it?
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried Jake2 once, a long time ago, but I personally had some problems and didn't pursue it. I think I was trying to use it on Windows 2000 or maybe ever NT 4, which would definitely not have been the best environment for it; that was probably why.

 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic