PW3 browser. Java Virtual Machine - impressions
Posted: Mon Feb 08, 2021 9:38 pm
Hi all,
There have been a few discussions here (and elsewhere) about Java on the DC. Of course, PW3 has java applet support. Yet, I have not found any reviews/discussions of that JVM. So, I spent some time this weekend exercising PW3's jvm. Here are my impressions: Good, Bad and Ugly.
Good - It is a functional JVM on the DC. In itself, that is pretty amazing! And it works, just about as good as one could expect an obscure JVM to run. I put it through the paces and it passed on everything: threads, network calls (back to server of origin), GUI (awt), drawing primitives ( lines, pixels, etc). In short, this JVM is quite well done. There are a few classloading bugs that sometimes appear when the page is reloading, but other than that it is fairly complete. Does anyone know how/where planet web acquired this jvm? Did they port it themselves (which would have been a large endevour, I imagine).
Ugly - It is Java 1.1.8, which was old even in 2001. Likely, few applets at the time of its release would have worked on PW3 because most applets would have been targeted at least java 1.2. So, this JVM was likely dead in the water before it was released. I never owned PW3 at the time of its release, so I can't say for sure how it was experienced at that time. And, speaking of ugly, that PW mouse cursor is so big and nasty looking.
Developing for this JVM requires sticking to the Java 1.1.8 APIs (documentation found here Java 1.1.8. When compiling, make sure to target 1.1 (add [-target 1.1] to your compile command).
Bad - This is an implementation of Personal Java, which is a jvm intended for devices with lower resources, so it is pretty slow. I imagine that this JVM does not do any JIT, but simply runs an interpreter. Also, Java 1.1.8 is missing many of the graphics libraries of later editions. For example, Java 1.2 introduced a new powerful graphics library, which can't be used in this version.
Could this be used to create a game? Yes, without a doubt. However, the game would need to be graphically pretty simple. I think it could handle point and click adventure games (like Monkey Island) or even a game like Silver (with pre-rendered backgrounds and a few simple small flat shaded models). It can handle software 3D rendering, but it is pretty slow.
To test this, I programmed up a simple flat shaded 3d applet that can load models in the obj file format. It chokes pretty bad once the number of polygons increases, but it was a fun little project to test the JVM. If you want to see it running, load up PW3 and go to http://www.dreamcast-java.com, and click on the 3d cubes link. It will not work in modern browsers that do not have applet support, which is a fun edge-case where the DC can view content when modern browsers can't. I could probably get the frame rate better, but will likely leave the project where it is and move on to learning about DC homebrew-ing.
Cheers!
-AdamARM
There have been a few discussions here (and elsewhere) about Java on the DC. Of course, PW3 has java applet support. Yet, I have not found any reviews/discussions of that JVM. So, I spent some time this weekend exercising PW3's jvm. Here are my impressions: Good, Bad and Ugly.
Good - It is a functional JVM on the DC. In itself, that is pretty amazing! And it works, just about as good as one could expect an obscure JVM to run. I put it through the paces and it passed on everything: threads, network calls (back to server of origin), GUI (awt), drawing primitives ( lines, pixels, etc). In short, this JVM is quite well done. There are a few classloading bugs that sometimes appear when the page is reloading, but other than that it is fairly complete. Does anyone know how/where planet web acquired this jvm? Did they port it themselves (which would have been a large endevour, I imagine).
Ugly - It is Java 1.1.8, which was old even in 2001. Likely, few applets at the time of its release would have worked on PW3 because most applets would have been targeted at least java 1.2. So, this JVM was likely dead in the water before it was released. I never owned PW3 at the time of its release, so I can't say for sure how it was experienced at that time. And, speaking of ugly, that PW mouse cursor is so big and nasty looking.
Developing for this JVM requires sticking to the Java 1.1.8 APIs (documentation found here Java 1.1.8. When compiling, make sure to target 1.1 (add [-target 1.1] to your compile command).
Bad - This is an implementation of Personal Java, which is a jvm intended for devices with lower resources, so it is pretty slow. I imagine that this JVM does not do any JIT, but simply runs an interpreter. Also, Java 1.1.8 is missing many of the graphics libraries of later editions. For example, Java 1.2 introduced a new powerful graphics library, which can't be used in this version.
Could this be used to create a game? Yes, without a doubt. However, the game would need to be graphically pretty simple. I think it could handle point and click adventure games (like Monkey Island) or even a game like Silver (with pre-rendered backgrounds and a few simple small flat shaded models). It can handle software 3D rendering, but it is pretty slow.
To test this, I programmed up a simple flat shaded 3d applet that can load models in the obj file format. It chokes pretty bad once the number of polygons increases, but it was a fun little project to test the JVM. If you want to see it running, load up PW3 and go to http://www.dreamcast-java.com, and click on the 3d cubes link. It will not work in modern browsers that do not have applet support, which is a fun edge-case where the DC can view content when modern browsers can't. I could probably get the frame rate better, but will likely leave the project where it is and move on to learning about DC homebrew-ing.
Cheers!
-AdamARM