port java game to dreamcast?
-
- DCEmu Newbie
- Posts: 7
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Sat May 21, 2005 8:07 pm
- Has thanked: 0
- Been thanked: 0
port java game to dreamcast?
me and some friends of mine developed a java game. we have to present our project in a month or so at our university...
now i tought it would be cool to present our game on my dreamcast too. that would rock for sure...
i started searching the internet for anything related to java and dreamcast... and the only thing i found, was that a company ported personalJava along with a web-browser... and i found out that it could be possible to use gcj (gnu java compiler), which uses the gcc backend which supports the sh-4.
i would be happy if i could port at least a limited version of the game (no network support, no sound, ...)
to make it short: should i even bother trying to port our game to the dreamcast? do i have a chance to complete this project in a month?
regards,
hansjak
things you might want to know about the game:
- it makes use of lwjgl (opengl, fmod)
- it's 2d only
- it's single-threaded
now i tought it would be cool to present our game on my dreamcast too. that would rock for sure...
i started searching the internet for anything related to java and dreamcast... and the only thing i found, was that a company ported personalJava along with a web-browser... and i found out that it could be possible to use gcj (gnu java compiler), which uses the gcc backend which supports the sh-4.
i would be happy if i could port at least a limited version of the game (no network support, no sound, ...)
to make it short: should i even bother trying to port our game to the dreamcast? do i have a chance to complete this project in a month?
regards,
hansjak
things you might want to know about the game:
- it makes use of lwjgl (opengl, fmod)
- it's 2d only
- it's single-threaded
i'm more smarter than you are be
-
- DCEmu User with No Life
- Posts: 3641
- Joined: Sat Feb 16, 2002 1:55 pm
- Has thanked: 0
- Been thanked: 0
GCJ can compile to native code, so lack of a VM shouldn't be an issue, but I'd think you would essentially end up having to port Classpath as well, unless your code is highly self-contained.
"You know, I have a great, wonderful, really original method of teaching antitrust law, and it kept 80 percent of the students awake. They learned things. It was fabulous." -- Justice Stephen Breyer
-
- DC Developer
- Posts: 9951
- Joined: Sun Dec 30, 2001 9:02 am
- Has thanked: 0
- Been thanked: 1 time
I've been doing some work on J2ME over the past couple of days. Apps written for J2SE generally won't work. The packages available in both J2ME and J2SE are java.lang, java.io and java.util. Even those packages are stripped down somewhat for J2ME.
Other than that... I can't think of anything. Java generally isn't used for games at all, except for mobile phones, and that's only because native code games will only work on a single type of phone, while Java MIDlets tend to work more-or-less the same on anything that has an appropriate Java / J2ME implementation.
Depending on how it's written, it might be possible to get it running, but you'd either have to port a JVM (like Kaffe) to the Dreamcast, or somehow make GCJ work (I couldn't get it working last time I tried, although that was years ago). Either way, you'd need to port the base classes over, you'd have to write a load of JNI-style bindings to KallistiOS system calls, and you'd have to write a back-end for your game that uses those instead of lwjgl. Not fun. Possible, but not fun.
I'll have to have another look at getting a JVM running on the Dreamcast. Last time I looked, KOS's support for the C standard library and C++ wasn't good enough. It might be now though.
Other than that... I can't think of anything. Java generally isn't used for games at all, except for mobile phones, and that's only because native code games will only work on a single type of phone, while Java MIDlets tend to work more-or-less the same on anything that has an appropriate Java / J2ME implementation.
Depending on how it's written, it might be possible to get it running, but you'd either have to port a JVM (like Kaffe) to the Dreamcast, or somehow make GCJ work (I couldn't get it working last time I tried, although that was years ago). Either way, you'd need to port the base classes over, you'd have to write a load of JNI-style bindings to KallistiOS system calls, and you'd have to write a back-end for your game that uses those instead of lwjgl. Not fun. Possible, but not fun.
I'll have to have another look at getting a JVM running on the Dreamcast. Last time I looked, KOS's support for the C standard library and C++ wasn't good enough. It might be now though.
- BlueCrab
- The Crabby Overlord
- Posts: 5666
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
I did have enough of gcj working to get it to compile binaries for the dreamcast, however nothing ever really worked. (At least, not that I can remember)
I think that if I can get a chance to try to work on that again, I might try it. Exceptions would be a problem though, because I can't seem to get C++ exceptions to work at all on the dc.
I think that if I can get a chance to try to work on that again, I might try it. Exceptions would be a problem though, because I can't seem to get C++ exceptions to work at all on the dc.
- Pale Rider
- DCEmu Freak
- Posts: 56
- Joined: Sat Apr 23, 2005 3:17 pm
- Has thanked: 0
- Been thanked: 0
- Contact:
gcj isn't as polished as i tought. i can't even use it (cygwin-version crashes, mingw-version sometimes locks) for my project, because of command-path-limitations, gcj limitations (1.4 not very well supported), ... i can't even compile our project for x86.
i guess we're out of luck.
but thanks for looking into the issue.
i guess we're out of luck.
but thanks for looking into the issue.
i'm more smarter than you are be
-
- DC Developer
- Posts: 9951
- Joined: Sun Dec 30, 2001 9:02 am
- Has thanked: 0
- Been thanked: 1 time
Looking around, I basically see three possible ways to do Java stuff on the Dreamcast.
1 - GCJ, compiling to native SH-4 binaries. Assuming we can get GCC 4.0 working on the Dreamcast (GCJ 4 is much better than GCJ 3.x), that basically means we'd need to port libgcj (the GCJ runtime) over to KOS, and get the compiler itself building and generating working code. The runtime consists of a threading part (should be easy now we have pthreads support in KOS), a file handling part (should be easy now we have a POSIX-style libc), and a signal handling part to handle signals sent by the operating system and convert them into Java exceptions. That could be tough - not only does KOS not have anything like signals, it doesn't even use the SH-4's MMU so we will be completely unable to catch null pointer exceptions. That just leaves things like arithmetic exceptions (like divide by zero), but I don't think we can catch those either. So some modification of KOS itself might be in order, or we could just ignore it...
2 - Kaffe, or another JIT. Kaffe shouldn't be that much more difficult to port than GCJ. Might even be easier - the core library only has threading and file stuff, no signal handling to worry about. It already has an SH JIT backend, and has been ported to a number of embedded operating systems. Would require more memory than GCJ for the code cache, but it does also have an interpreter version, and the (now disappeared) DOS port ran on machines with 8MB of RAM. Doesn't leave that much room elsewhere, but you're not going to be doing 3D games with this thing anyway. Of course, if we have to write an SH-4 JIT, it's going to be bloody difficult.
3 - SableVM, or another interpreter. Slow, but probably a little easier than a JIT.
Once you have the interpreter up and running, that leaves you trying to do something useful with it. That would probably get you the core Java libraries - java.lang, java.io, java.util, and anything else that's part of the interpreter itself or implemented in pure Java. That's probably not all that hard, actually, but it would be a fair bit of work.
Might be interesting to try though.
Oh, one other possibility... Port Mono or Portable.Net over, and run Java code using IKVM. That's even more insane than porting a Java runtime (which, at least, we know is possible), but it'd also buy C# and Vb.Net (if you're using Microsoft's VB.Net compiler).
1 - GCJ, compiling to native SH-4 binaries. Assuming we can get GCC 4.0 working on the Dreamcast (GCJ 4 is much better than GCJ 3.x), that basically means we'd need to port libgcj (the GCJ runtime) over to KOS, and get the compiler itself building and generating working code. The runtime consists of a threading part (should be easy now we have pthreads support in KOS), a file handling part (should be easy now we have a POSIX-style libc), and a signal handling part to handle signals sent by the operating system and convert them into Java exceptions. That could be tough - not only does KOS not have anything like signals, it doesn't even use the SH-4's MMU so we will be completely unable to catch null pointer exceptions. That just leaves things like arithmetic exceptions (like divide by zero), but I don't think we can catch those either. So some modification of KOS itself might be in order, or we could just ignore it...
2 - Kaffe, or another JIT. Kaffe shouldn't be that much more difficult to port than GCJ. Might even be easier - the core library only has threading and file stuff, no signal handling to worry about. It already has an SH JIT backend, and has been ported to a number of embedded operating systems. Would require more memory than GCJ for the code cache, but it does also have an interpreter version, and the (now disappeared) DOS port ran on machines with 8MB of RAM. Doesn't leave that much room elsewhere, but you're not going to be doing 3D games with this thing anyway. Of course, if we have to write an SH-4 JIT, it's going to be bloody difficult.
3 - SableVM, or another interpreter. Slow, but probably a little easier than a JIT.
Once you have the interpreter up and running, that leaves you trying to do something useful with it. That would probably get you the core Java libraries - java.lang, java.io, java.util, and anything else that's part of the interpreter itself or implemented in pure Java. That's probably not all that hard, actually, but it would be a fair bit of work.
Might be interesting to try though.
Oh, one other possibility... Port Mono or Portable.Net over, and run Java code using IKVM. That's even more insane than porting a Java runtime (which, at least, we know is possible), but it'd also buy C# and Vb.Net (if you're using Microsoft's VB.Net compiler).
phew... so many options... and everything sounds so easy
ok, BlackAura, you still got ~25 days to do all this stuff. i'm waiting...
well... i abandon the project. i think it would be easier to port everything to c++. but just to show off that's still too much effort.
i'll post a link where you can download the game when it's done.
so long...
ok, BlackAura, you still got ~25 days to do all this stuff. i'm waiting...
well... i abandon the project. i think it would be easier to port everything to c++. but just to show off that's still too much effort.
i'll post a link where you can download the game when it's done.
so long...
i'm more smarter than you are be