LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2007, 07:06 AM   #1
LinuxNoob75
Member
 
Registered: Jan 2007
Posts: 90

Rep: Reputation: 15
Java vs OpenGL vs SDL vs ?????


Hello.

I'm working on writing a game, and deciding on a programming language/API to use. Here are some of the rules for what must be done:

1. Speed- the game must work fast
2. Sound/Video- If the API/Language could access Real, or Gstreamer, that would be great.
3. ONLY has to run on Linux
4. The program uses Animation. Lots of it.
5. The animated part of the game are images and text. These images must be loaded from a directory.
6. The game will also have widgets like buttons, listboxes, comboboxes, etc. If the API/language could intergrate with GTK, or has its own widgets, that would be good.
7. 3D isn't neccessary
8. The game could access the internet through a browser, access the local filesystem IN GAME(IE, be able to execute cd ~/game/ or 'ls'), and be able to access other computer filesystems over a LAN/ the Internet

So basically... Networking, Speed, Animation, Image Loading, common widgets, and access to a Video framework(preferably free, or GPL) are what is needed.


So far, I've looked into the following decisions:
-OpenGL
-SDL
-Java and Java3D

JAVA:
---Java is my favorite language. I have a huge background in Java and it was one of my first programming languages.
However, Java on Linux is un-nerving. Can someone supply links to the Java JDK for Linux?
---Also, I've rarely done much graphical programming in java. If there is a good book out there that addresses beginning Java Games for Linux, that would be great.(I already have Killer Game Programming in Java, but it starts out a little too advanced)
---Some say Java is too slow for games, and I've gotten mixed reviews on whether that is true or not


OpenGL:
-I know C++, and a little C. However, I failed when trying out openGL. I don't understand at all how to install a OpenGL development environment in Linux, and I failed miserably. If someone could direct me to some Mesa(I think?) links with instructions to download and install to get an OpenGL development environment going that would be great,
-It appears OpenGL is well liked within the Open Source Community.
-I believe OpenGL is able to work with Gstreamer.
-C++ is a nice language to use to get close to the filesystem
-OpenGL/C++ are fast
-I'm not sure whether OpenGL apps will work with Compiz Fusion. Is there a way to code my game so it can be played with compiz fusion?

SDL:
-SDL seems to be the language most centered on what I'm trying to do, a 2D game.
-There seems to be little documentation on SDL.
-I don't know if it can access Gstreamer, Networking, etc.




So, I'm asking everyone which they think is best for me. Please provide online tutorials for setting a development environment for each up on Linux, and other tutorials would be great. If anyone knows of any really good books on each, please inform me.

thanks,
sqlserver
 
Old 12-06-2007, 08:11 AM   #2
Dox Systems - Brian
Member
 
Registered: Nov 2006
Posts: 344

Rep: Reputation: 31
C would be my first choice.

Java *can* be fast enough... Java has very good optimizations that can make code run just as fast as C, BUT, you don't have control over garbage collection... Not having the garbage collection control results in seemingly random, temporary, decreases in performance during runtime.
 
Old 12-06-2007, 08:47 AM   #3
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
OpenGL is C, not C++.

OpenGL is already installed, the only thing you need is the header files, most distributions include such development information in a separate package, look for "mesa-devel" or something in your package manager.

If your developing 2D, then dont use 3D, or, alternatively, look for a graphics library that can make use of 3D acceleration behind your back (however, im not sure any such library exists that is fast, but its also probably irrelevant).

SDL is just a library, you can use other libraries with SDL, and SDL does have network bindings. Not sure if gstreamer can work with SDL easily tho, never used gstreamer myself. And SDL has very good documentation:

The API reference: http://www.libsdl.org/cgi/docwiki.cgi/

My favorite SDL tutorial to get you started: http://www.lazyfoo.net/SDL_tutorials/index.php

All in all, depends upon the kind of game. Also, SDL cant integrate with GTK, nore is there a SDL widget in GTK (both SDL and GTK have very annoying limitations), i also know of no other UI toolkit in SDL that is not C++ (and for you, this might be a good thing, but i do not remember the UI libraries name, so you shall have to look it up yourself on the SDL website).

Last edited by SciYro; 12-06-2007 at 08:50 AM.
 
Old 12-06-2007, 08:54 AM   #4
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
A jdk can be downloaded from Sun but more and more distributions have one or more in their repositories (Ubuntu, Debian, Mandriva, Suse; Fedora has an open source version but you can get the Sun jdk straight from Sun or through jpackage.org, which builds rpm packages for lots of java related software as well).

There is java3d, which is available separately. Sun has other packages that cover JOGL (Java OpenGL) and media (JMF and JMFmp3); there is also the IBM mp4 package (quite restrictive, however) and the open source Fobs4J (offers far wider codec support than JMF but not complete) or FFMPEGjava. Bear in mind that if you find installing jdk on Linux "unnerving" (it's a piece of cake, really), installing JMF will be a complete nightmare. With hindsight, it wasn't all that complex but it took me a day or two to figure it out...

Saying that one hasn't got any control over garbage collection is only partly true. The JVM has more than one type of garbage collector and selecting the right one can make all the difference in the world. And one does have control over garbage collection through methods such as finalize() and nullify() although the tricky part is calling them at the right moment - not doing so usually results in poorer performance.

Slowness needn't be a concern with modern computers but there is no denying that the overhead of starting up the JVM means that java applications launch slower than C/C++ applications.


I've recently had a look at the O'Reilly book you mentioned. It doesn't seem too complex but it does require some experience with JAVA2D/3D. I suspect that this is where your attention should go, not a basic game programming book. You can download docs from Sun or you can go for a Java book that covers graphics in some detail (such as Ivor Horton's "Beginning JAVA 2", which may be a bit heavy-going at times because much of it is rather technical, frequently with more emphasis on the APIs than the uses that they can be put to).
 
Old 12-06-2007, 03:58 PM   #5
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
There are several OpenGL apis made for java. Just google. Check this: http://opengl.j3d.org/faq/intro.html#availablity

Last edited by Alien_Hominid; 12-06-2007 at 04:00 PM.
 
Old 12-06-2007, 04:37 PM   #6
LinuxNoob75
Member
 
Registered: Jan 2007
Posts: 90

Original Poster
Rep: Reputation: 15
hey-
I'm highly interested in programming OpenGL with Java. If anyone could provide any really good tutorials/books for that it would be great.

Also, if someone could compile a list of all the necessary downloads for a development environment for OpenGL/Java it would also be great.(I use Eclipse, if it requires some Eclipse additions or option changing) The hardest part of programming for me on Linux has been setting up my environment, once I'm able to run a 'Hello World' program I'm fine.

The only question is will it work with Compiz Fusion? I run XGL and Compiz Fusion on an ATIX600 and it would break my heart to have to have to switch to metacity when I test the program. Also, I have to account for it to work with users running Compiz.
thanks,
LN75
 
Old 12-07-2007, 12:52 AM   #7
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
And there is the rub. Proper Compiz-Java integration at this time is still not a given although a number of initiatives have been launched to produce a set of patches. Apparently jdk 1.6u3 already works a lot better.

For jogl and related packages, visit sourceforge:
http://sourceforge.net/search/?type_...oft&words=jogl
It also has jlgl, the java lightweight gaming library, which could also be of interest.
Or the jogl home page (which has user's guide):
https://jogl.dev.java.net/

Quote:
The hardest part of programming for me on Linux has been setting up my environment, once I'm able to run a 'Hello World' program I'm fine.
I'm sorry, I fail to see what could be the problem. You install a jdk, then netbeans or eclipse and you point it to your jdk. Whichever, you choose, you'll also need to point it explicitly to the jogl jars for them to be picked up.
 
Old 12-07-2007, 07:30 AM   #8
Dox Systems - Brian
Member
 
Registered: Nov 2006
Posts: 344

Rep: Reputation: 31
Quote:
Originally Posted by jay73 View Post
I'm sorry, I fail to see what could be the problem. You install a jdk, then netbeans or eclipse and you point it to your jdk. Whichever, you choose, you'll also need to point it explicitly to the jogl jars for them to be picked up.
I'm wondering about that too. Installing the JDK and Netbeans and/or Eclipse is a whole lot easier than installing & configuring Linux... Not sure how anyone can get Linux going, then have trouble with Java
 
Old 12-07-2007, 03:18 PM   #9
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
What's the problem of Compiz and Java? Does it not work or what? I doubt so, but I don't use this fancy stuff (compiz).
 
Old 12-07-2007, 03:36 PM   #10
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
I would say ... do you know of any good games programmed in java ? (and that's the only comment I can offer on java without starting a flame war)

If you're not doing anything 3D, then there's no real need for OpenGL.

Indeed SDL is a library, and I would recommend using it to make your game.

If you need your game to be fast, then C is the way to go. C++ is also an option.
 
Old 12-07-2007, 04:34 PM   #11
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
I could ask do you know of any good (large) games except IdSoftware ones (including their ports and conversions) and NWN from Bioware written for OpenGL and not DirectX?
 
Old 12-08-2007, 02:02 PM   #12
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Unreal Tournament 200? (made by Epic Games)

Now, do you know any good games written in java ? Please list at least one.
 
Old 12-08-2007, 04:30 PM   #13
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
I know only MMORPGS: http://www.projectdarkstar.com/ is worth to be mentioned and the notorious runescape (of course not good, but lots of players).

FreeCol is Java based open source game. Lots of others board game implementations are written in Java (I mean 2D), e.g. Risk. Of course, there are almost none 3D games, because there is no 100% working hardware acceleration support and what is working in one platform, it doesn't necessarily work on other.

In this article http://www.unrealtechnology.com/html...ogy/ue30.shtml , it is claimed that UE3 is developed for DirectX PCs.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using SDL/OpenGL, need help. kornerr Programming 33 11-19-2005 11:19 PM
sdl / opengl - cant press up and right atrain Linux - Games 2 03-27-2005 11:29 PM
Question about SDL OpenGL and -lglut doody Programming 2 11-16-2004 04:17 PM
Using OpenGL (+SDL) for 2D programs R00ts Programming 4 07-16-2004 12:33 PM
OpenGL lighting with SDL MadCactus Programming 0 09-21-2003 11:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration