ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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:
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).
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).
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
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.
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.
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
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.