To swing or not to swing??

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?

???

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.

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!!!

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.

[quote=“Jeff,post:4,topic:26103”]
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. :slight_smile:

[quote=“jbanes,post:5,topic:26103”]

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

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.

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.

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

Cas :slight_smile: