GeeCON Prague 2014*
The moose likes Game Development and the fly likes Movement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Game Development
Bookmark "Movement" Watch "Movement" New topic
Author

Movement

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

Let's say you were making a FPS game. How would you make the game to where when you move, you don't see everything, but just the part to where you are. Like you don't see the whole chess board, just cells C1, B1, D1, and C2. I'm thinking of making games and would like to keep this in mind. I am going to use the Java2D and/or Java3D API obviously.
Thanks,
cc11rocks


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

john price wrote:Let's say you were making a FPS game. How would you make the game to where when you move, you don't see everything, but just the part to where you are. Like you don't see the whole chess board, just cells C1, B1, D1, and C2. I'm thinking of making games and would like to keep this in mind. I am going to use the Java2D and/or Java3D API obviously.
Thanks,
cc11rocks


Are you referring to fog of war, or to field of view? I'm suspecting the latter. You should do this using graphical libraries like Direct3D or OpenGL. JOGL provides OpenGL for Java.

It will be a lot easier to use a pre-made 3D engine though, like JMonkey.
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

What is fog of war? And, yes, I meant field of view. How would you use somebody's libraries? Is it like they write classes and you implements them, such as MouseMotionListener? Why couldn't I build my own engine? Would it be too hard?
Thank you,
cc11rocks aka John Price

EDIT: How do OpenGL and Direct3D make the libraries to do this?
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

It's not necessarily very hard to make a 3D engine, but it is a *lot* of work. You're better off using a pre-existing one.

If you want to know how to use them, look up documentation on JMonkey, or if you want to do it all by hand, find a JOGL tutorial.
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

How would I make it? What do I put in it? How do I get started with making it? Do I need to know Java3D? Is there a tutorial for making a game engine? Why do I need to build a game engine? Why can't I just code it like regular?
The questioner,
John Price aka cc11rocks
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

Why do you mean, code it like regular? What is regular?

"Engine" just means the code that is used to draw the 3D world, and the objects within it, and how they behave. It's like the "look and feel" of a graphical program.
Whether you write this code yourself, or use code that already exists, you still need it.

I recommend you go to the JMonkey homepage, and look up what it's about. I'm sure they have an introduction, and tutorials and plenty of other resources to help you get started.
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

I looked at the website. Why can't you just have a bunch of methods instead of the game engine? Are they the same thing? I haven't used 3D yet, so this may be why I don't understand. So far this is what I think is a game engine:
Using the Java API and "mixing" components to make the game do certain things, such as algorithms, lighting, etc. Why can't you just write this in your code as methods, and not as a separate engine?
Confused,
cc11rocks aka John Price
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

You can, and this is what we would call an engine. If you write all the methods and classes you need to make a 3D world, you have written your own 3D engine.

This is a lot of work. JMonkey provides a lot of the classes and methods you would need.
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

So would making my own engine for a small game (to get started) be too much? Something simple like say, a short animation?
Going back to my original question and adding your input, how would I make the engine to where you move?
Would you have to, if you did your own engine, make an item get larger as you get "closer"? Would you have to have everything "pop" up when you get to it? Like you can't see it now, because it's not there? For example, if there is a building and you move closer, it gets bigger. When you open the door, you then draw the inside of the building and remove some of the outside components of the building?
Or is there a better or easier way to do this?
Thanks,
cc11rocks

EDIT: Or do you draw EVERYTHING and have like a "camera"? How would you make this "camera"? I'm assuming you would use the engine somehow...
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

If you want to do all of this by hand, you can use OpenGL. It handles a lot of stuff like camera positioning, distance, field of view, all that stuff. What you do is describe all your graphical objects as a bunch of triangles located somewhere in space, and OpenGL will draw everything for you. Note that there is a lot of math involved, and matrix transformations in particular. http://en.wikipedia.org/wiki/Matrix_theory
 
GeeCON Prague 2014
 
subject: Movement