• Advertisement
Sign in to follow this  

What now?

This topic is 1274 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello!

 

I have created some programs using Java, this year. (CD-Key Generator, Calculator with a GUI etc.)

However, I want to create games. The thing is, I don't know where I can learn to do this.

I understand how to program in Java to a certain level, and I know the basics of a game (Refreshing the screen 60 times each second, game loops etc.) I just don't know how to do this in Java.

 

So, my questions are:

- How can I learn to do this in Java?

- If I decide to use another language, like C++, would it be any different?

- I have also heard that if you are to use C++, you usually want to create your own engine, is this true?

- This is not very relevant yet, but if you are to create a 3D game, how do you load models etc.? (I am aiming at simple 2D games first though)

Share this post


Link to post
Share on other sites
Advertisement

I have some ideas for some games, but they are too advanced for me to create at this point.

Still, I want to create the engine myself, for the knowledge.

Where can I possibly learn this?

 

I have also heard that to make games with C++ you need DirectX or OpenGL.

What are these, and why do you need them with C++, and not Java?

 

Also, thank you for the links! I will read them!

Share this post


Link to post
Share on other sites

Morrowa,

 

You never want to start off writing a "game engine."  A "game engine" is just a bunch of reusable and time-tested code.  Write a game.  When it comes time for a second game, recycle some of the code and improve upon in.  Repeat that cycle.  I have found that if you plan on building a "game engine" from the beginning, you end up wasting more time implementing features just for the sake of features.

 

OpenGL and DirectX are graphics API's.  They are the bridge between low-level rendering operations/talking to the hardware and you.

 

EDIT:

To answer one of the questions in your first post: learning to create games in Java is really no different from creating games in other languages.  As someone else noted, languages do different things.  Regardless, there are common "core" principals that drive games.  For example, all games (no matter what language) run in a loop.  This loop usually handles user input, updating, and rendering.  When a game starts up, some initial data is usually loaded to get ready for the game to run.  When a game shuts down, systems are usually released.  Regardless of the language, a loop is a loop.  Loading data is loading data.  Releasing data is releasing data.  How these things are done may change, however, the principals are the same for all languages.

Edited by ByteTroll

Share this post


Link to post
Share on other sites

This:

 


I have some ideas for some games, but they are too advanced for me to create at this point.

 

doesn't fit with this:

 


Still, I want to create the engine myself, for the knowledge.

 

I'd worry about your ability to make an entire game engine if you can't blast out a Pong clone in Java. 

 

Best of luck!

Share this post


Link to post
Share on other sites

Still, if I am going to make a pong game, I need in one way or another to load sprites etc.

Wouldn't that be a very primitive engine if the code does all the basic stuff?

 

When it comes to engines like Unity, I have no idea how they are made.

(Could anybody explain how?)

 

Either way, I guess I will start out simple with some Tic Tac Toe, Tetris and Pong.

Share this post


Link to post
Share on other sites


Still, if I am going to make a pong game, I need in one way or another to load sprites etc.

Wouldn't that be a very primitive engine if the code does all the basic stuff?

 

Someone didn't read the provided links.

 


If you're looking for Java stuff, check out my web site: http://www.indiegameprogramming.com

 

Click that.  Your answers are there.  If you can't make a game with your Java experience and the information on that site, then nothing I can type will be of value.

Share this post


Link to post
Share on other sites

I have some ideas for some games, but they are too advanced for me to create at this point.

Still, I want to create the engine myself, for the knowledge.

Where can I possibly learn this?

 

I have also heard that to make games with C++ you need DirectX or OpenGL.

What are these, and why do you need them with C++, and not Java?

 

Also, thank you for the links! I will read them!

 

Actually, depending on what kind of game you are making, you won't necessarily need either Direct X or Open GL.  Have a look at NetHack, for instance.  That is a full game where all you need is the console.  Also, if you are making a Othello, Chess, Mine Sweeper kind of game, you can just use a normal canvas type of GUI object for your operating system.

 

Of course, Direct X and Open GL are graphics libraries that are closer to the hardware itself, and are much faster than any canvas any GUI component can give you, at least it were so in the past.  It is also specialised in processing graphical data, wether it is 3D or 2D, so it beats anything you would do in pure software.  Nowadays you can even offload computations formerly done on the CPU to the processor on the graphics card.  It is also much more complex (but not necessarily so much more complex than to write graphics application in pure software, which is slow), so it really depends on which aspect of game creation you are looking into at the moment.  You don't explicitly need C or C++ to use Open GL, I believe you can nicely make Open GL applications in Java.  Here is one project aimed to enable that, that I know nothing about: http://jogamp.org/jogl/www/

 

If you start small, you will slowly master the art of making games.  It is much more fun to make a Mine Sweeper clone than you think.  There are some hidden things that are not apparent right from the start, for instance, what if you click a large area that has no surrounding mines?  There you would stumble across making a recursive search to find all the adjacent safe slots on the map.  Recursion is not really hard once you have learnt it, but it may be hard entry point, just like the concept of pointers, for instance (which Java doesn't have, just references).  

 

Good luck!  You are into a lot of fun learning. :)

Share this post


Link to post
Share on other sites

 


'Engines' are siren songs to new programmers lured by the idea, but they just lead to you crashing on rocks.

 

This should be a tee shirt.

 

 

I'd buy it.

Share this post


Link to post
Share on other sites

Thank you!

I guess I will wait with creating an engine then.

 

However, I was thinking:

I have started on a Tetris clone.

However, I have the problem of collision detection.

 

I have made the graphics for the blocks myself.

The blocks shaped like this:

 

XXXX  XX

           XX

 

Is fine with collision detection. However, with these:

 

  X        XX

XXX        XX

 

Where you have these transparent spots, gets a little more nasty for me.

Is the best way to do collision detection here to check first if there is a sprite-sprite collision, then check if the part

the sprite is colliding is transparent?

Share this post


Link to post
Share on other sites

Thank you!
I guess I will wait with creating an engine then.
 
However, I was thinking:
I have started on a Tetris clone.
However, I have the problem of collision detection.
 
I have made the graphics for the blocks myself.
The blocks shaped like this:
 
XXXX  XX
           XX
 
Is fine with collision detection. However, with these:
 
  X        XX
XXX        XX
 
Where you have these transparent spots, gets a little more nasty for me.
Is the best way to do collision detection here to check first if there is a sprite-sprite collision, then check if the part
the sprite is colliding is transparent?


Most tetris games don't use single sprites for each of the tetriminos, but use block sprites arranged in the shape of the pieces (note how each one is made up of four blocks?).

That way you don't have to worry about collision between pieces with "transparent" parts, you just have to see if moving the piece in the desired direction would cause two blocks to overlap.

This also makes line removal easier, because you can just remove a line of blocks rather then trying to dynamically cut up your sprites. Edited by SmkViper

Share this post


Link to post
Share on other sites

Even if you want to write your own engine, learning how to use an existing one would be a good start, then you'll know what sort of features to put in yours.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement