Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Switching Screens on: 2003-12-15 14:10:45
Hey everyone,

I've been working on a space strategy game and have finally decided to make it a full-screen application. A question I have is, what is the best way to switch "screens"? For example, I want to have an introductory screen appear first, which then brings up another screen depending on which option the user selects ("New Game," "Load Game," etc.). Right now, I have these different screens as individual classes extending the JFrame class. Is this a good design, or should I do something else?

- Rob
2  Game Development / Newbie & Debugging Questions / Re: Game Loop Question on: 2003-12-09 20:46:31

Likely yes.  unless this is a very slow paced game (turn based or puzzle variety)  I think you are likely to find that Swing will give you neither the performance nor the control to do things like
animate smoothly.

Actually, it is a turn-based game.

I just got Developing Games in Java by David Brackeen.  Very good book so far, with many reusable code examples.  One such piece of code is for a simple game loop.  However, it seems that what is provided in the book is geared for games that are constantly being re-drawn, such as platform games.  So should I still implement an animation loop in my turn-based game?  If I don't use one, is there a way to draw, say, a static background image only once?

Also, I'm switching from making my game a windowed application to making it a fullscreen one.  I read in DGJ about how you shouldn't have Swing components paint themselves in fullscreen mode.  Does this only apply to constantly-animated games like platform games, or does it apply to turn-based games too?

Yep. Typically game developers either draw a background, and button art they BLT ontop of it or they draw two complete images, one with buttons up and one with them down. They then BLt pieces of the buttons down one over the buttons up one as necessary.

Right.  I'm thinking of either doing that or continuing to use JButtons but with custom images for them.  What do you think?

I'd need to see the code, My guess is that you are managing to use a peice of video memory that still contains data from the previous image and hasn't been over-written.

Are you clearing that panel or whatever the screen is?

I got that fixed, actually.  Yeah, I think what you described was the problem.  Thanks!

- Rob
3  Game Development / Newbie & Debugging Questions / Re: Game Loop Question on: 2003-12-04 00:14:22
Hey Jeff,

Thanks for your reply!


Two choices:

(a) Do all the Swing stuff first with Swing events, then dispose it all and go into your real game loop which will be an active graphics render/flip loop.

(b) Do it all in a game style render flip loop and write your own menu handling code with menu images painted in a paint prgoram.

Option (a) might be easier and take less art. Option (b) is what most games do because it provides pixel-level control over what the user sees.

Currently I am using JButtons to go from one screen to another.  If I stick with that, then I would need to use Option (a).  The main game itself also uses Swing components right now, however.  Would it be better to change this?

I figure it wouldn't be too hard to go with Option (b), have every screen be a pre-made image file, with "buttons" in the form of picture areas that change color when you move and/or click the mouse on them.  Am I right here?

Finally, I think my code so far is implementing pretty much what you describe in Option (a).  However, there is a problem when I run the program.  Right now, I have it set to load up an introductory screen first, which contains a "New Game" JButton.  Upon pressing that button, the intro screen is disposed of (via scope), and a new game screen is loaded.  This screen contains a "Begin Game" JButton which does nothing right now, but will be used to actually generate a new game.  What happens is this: the program works fine until I press the "Begin Game" button on the new game screen, and then the introductory screen is partially re-drawn!  I don't know how this can happen -- the intro screen is no longer supposed to exist!  Do you know what's going on here?  I can send you the code if you'd like.

Thanks again!

- Rob
4  Game Development / Newbie & Debugging Questions / Game Loop Question on: 2003-12-03 13:01:01
Hey everyone,

I'm working on a space strategy game that will be run using a rather simple game loop (or, you could say, an extremely primitive game "engine"). This game loop will involve multiple screens. When the program begins, an Introductory Screen will be displayed with the following options: New Game, Continue Game, Load Game, and Exit. The Introductory Screen will be an instance of a class that extends JPanel. For right now, only New Game and Exit will work. Upon pressing the New Game button, I want the Introductory Screen object to disappear (i.e. have its memory resources freed up) and a New Game Screen to appear (i.e. an object of the appropriate class be created). This screen will contain options for the new game (such as number of stars, number of players, etc.). There will also be a Begin Game button that will dispose of the New Game Screen object, and generate the game universe desired by the user. I'm hoping to do all of this from a main game class. So my question is, given what I have described above, what would be the best way to implement it in Java? I'm mainly talking about handling the screen object creation/destruction. If I have been too vague in this post, please let me know and I will try to be more specific

Pages: [1]
ivj94 (579 views)
2018-03-24 14:47:39

ivj94 (42 views)
2018-03-24 14:46:31

ivj94 (346 views)
2018-03-24 14:43:53

Solater (59 views)
2018-03-17 05:04:08

nelsongames (104 views)
2018-03-05 17:56:34

Gornova (122 views)
2018-03-02 22:15:33

buddyBro (665 views)
2018-02-28 16:59:18

buddyBro (89 views)
2018-02-28 16:45:17

xxMrPHDxx (491 views)
2017-12-31 17:17:51

xxMrPHDxx (727 views)
2017-12-31 17:15:51
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!