Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  To swing or not to swing??  (Read 725 times)
0 Members and 2 Guests are viewing this topic.
Offline elwiz

JGO n00b
*

Posts: 22


Bom-Shackalack, Jatack!


« on: 2006-02-05 01:57:22 »

Hi all!

I've laid the foundation for my simple Board/strategy game and was going to build some simple frames for the board, dices and news. But then, I read somewhere that one should not use swing for this?
I don't know why - so I have to ask my fellow gamemakers about their opinions?

 Huh
Offline Ask_Hjorth_Larsen

Sr. Member
**

Posts: 316


Java games rock!


« Reply #1 on: 2006-02-05 10:36:47 »

If you're writing a complex fast-paced first person shooter with lots of graphical stuff and high frame-per-second requirement then you should consider something else than swing. Swing is well suited for turn-based stuff. It sounds like Swing would be fine for your purposes.
Offline noblemaster

JGO Ninja
***

Posts: 730
Medals: 6


Age of Conquest makes your day!


« Reply #2 on: 2006-02-07 16:08:23 »

I agree with Ask_Hjorth_larsen. Swing is perfectly fine for turn based/board games. I used it 100% for my game and didn't have any performance issues. The cool thing with swing is, you can define your own look and feel, which makes coding much faster!!!

Games published by our own members! Go get 'em!
Offline Jeff

JGO Kernel
*****

Posts: 3535


Got any cats?


« Reply #3 on: 2006-02-07 20:36:08 »

The *only* issue for swing for these kidsn of games, is that if you want to graduate evetually to action games you will have to relearn how to write code.

If that isnt your goal though then yeah Swing is fine.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline jbanes

JGO Neuromancer
****

Posts: 1178


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #4 on: 2006-02-07 21:59:24 »

The *only* issue for swing for these kidsn of games, is that if you want to graduate evetually to action games you will have to relearn how to write code.

I'm not sure that's 100% correct. Java uses the same Java2D system for Swing and games, so the experience can transfer. For example, if you're doing chess it makes sense to create a custom chessboard component rather than try to line up 64 labels on the screen. Especially since the labels are bound to interfere with the placement of pieces on the chessboard. In  writing that component, you're forced to work with the Java2D APIs to get the results you need. Ergo, experience that can translate.

Same with events. You need to learn how to handle mouse and keyboard events so that you can properly handle piece dragging and quick shortcuts. Again, more experience.

When the time comes, all you really need to do is learn the full screen and BufferStrategy APIs. From there, the rest is a cakewalk. (With a few gotchas scattered along the way.) Beats the heck out of the MemoryImageSource nonsense that we used to do. Smiley

Java Game Console Project
Last Journal Entry: 12/17/04
Offline Jeff

JGO Kernel
*****

Posts: 3535


Got any cats?


« Reply #5 on: 2006-02-09 04:48:40 »

The *only* issue for swing for these kidsn of games, is that if you want to graduate evetually to action games you will have to relearn how to write code.

I'm not sure that's 100% correct. Java uses the same Java2D system for Swing and games, so the experience can transfer.

True but unline Swing you wont be doing it on repaints, you will be doign it in a game loop.

Quote
Same with events. You need to learn how to handle mouse and keyboard events so that you can properly handle piece dragging and quick shortcuts. Again, more experience.

Unless you do it the way most games do and just poll the mouse in the game loop and do all the behavior yourself.  This is typical.  Triying to mix AWT events with a game loop is much less so.  I knwo some pople with rpevious Swing experience go this route but it seems to add all kidsn of needless compelxity.

Quote
When the time comes, all you really need to do is learn the full screen and BufferStrategy APIs. From there, the rest is a cakewalk.\

I really really really disagree.   A fast action game is near real-time type codin g. This is **totally** different from event driven programming and programmers who have learned to program event driven IME need to amjorly rework their neurons to get it.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline princec
« League of Dukes »

JGO Kernel
*****

Posts: 8089
Medals: 96


Eh? Who? What? ... Me?


« Reply #6 on: 2006-02-09 06:45:27 »

I agree with Jeff. It's a completely different paradigm. It's like the difference between OOP design and old fashioned BASIC.

Cas Smiley

Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.07 seconds with 19 queries.