Skip to main content
gamedev.net
🔒 Locked

[java] Java interfaces for SDL? Others?

Started by gerryg Jul 19, 2002 at 12:11 AM 3 replies 600+ views
Original Post
gerryg
gerryg
I''m looking seriously into writing a game engine in Java and using a pluggable system for rendering, sound, and networking. Each would be replacable with a new module. One of the things I''m researching is interfacing Java with SDL or other cross-platform yet native libraries. I saw a SourceForce project for Java and SDL but it appears to be abandoned. Anyone have suggestions on where I should look? Has anyone done something like this before? Thanks!
bslayerw
bslayerw
Could you explain why you would want to write a Java game engine on top of SDL?

Java is cross-platform already, Java also has really good networking capabilities. You can use Java Sound for sound and you can use either Java3D/Java2D or GL4Java for graphics.

Is there something that SDL does that these Java API''s don''t do?
gerryg
gerryg
Java is nice for writing abstract models, logic, AI, etc on. I agree with your assessment to a point - it''s good but not necessarily good enough if you need all the speed you can get.

One reason to interface with SDL is a lot of people are using it to write games. I do intend to write the aforementioned modules in Java, but by being modular and open (I forgot to mention in my last message) it gives the engine access to high-performance code in SDL or other libraries, cross-platform or not. SDL is the most appealing at the moment, and combined with OpenGL it''s very powerful. I agree that doing graphics modules in GL4Java would be good too, and I plan to try it out as well.

One of the things I want to do is learn how games can be developed with a number of different libraries and on different platforms. It''s kind of a learning experiment for me in that respect, but on the other hand it''s great for others who want to write their own modules. Take Ogg Vorbis for example - there''s no direct support for it in Java. And likelihood is that it won''t be supported terribly well in a java-written lib. Accessing it from a more native lib or through a cross-platform lib that can use native runtimes gives highest performance. Another example is custom renderers - various people could try out new technologies or just use libraries that they''re used to.

It does sound awfully generic, doesn''t it? Well, I already made up my mind to try it because it interests me. My inspiration right now is NetHack and Falcon''s Eye. I plan to implement a graphical yet character-based renderer, then move on to sprite-based 2D, then on to 3D in Java3D, OpenGL, and custom engines. Each would use the same core. Then I''ll experiment with audio. Then on to networking/multiplayer, and so on and so forth. Wish me luck, and as I mentioned in the first post, if you know of any Java libs or interfaces for Java with SDL or native libs I''d love to hear from you!
HenryApe
HenryApe
quote:
Take Ogg Vorbis for example - there''s no direct support for it in Java. And likelihood is that it won''t be supported terribly well in a java-written lib.

I would not be too sure about that, check out the evaluation for RFE 4499904.
gerryg
gerryg
Henry - an RFE is just that, a request. There''s only the possibility that it will become a JSR, and even then it would take 6+ months to go through the process and implement. If it were already JSR, I wouldn''t be so cynical about it. Like I said - new technology is not always available to every platform right away. This is a case where Java doesn''t have a sanctioned implementation, and though JOrbis could probably be hacked to work, it''s certainly not the only implementation out there.

I''m very much for best-of-breed, so even if Ogg was a JMF codec, it may not be the best implementation. The new JDK 1.4 logging API is a perfect example - it''s lame. Log4J, Syslog, and others are all better APIs and implementations than Sun''s. Of course, there is a point where you can integrate too much and the glue code takes more resources and CPU slices that it should, but that''s something that has to be weighed and balanced with the performance needed for the game being developed.

I still think it would be cool to take a somewhat generic engine and be able to swap in and out various modules, whether written by other uses or by myself. If somebody comes up with a great gameplay game but it has lousy graphics and audio, they can be switched out by fans for something better! It''s the ultimate in modding. The target market for something like this is definitely not the commercial pros, but the hobbyist and part-time game developer.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.