Porting to Java

Note: This was an April Fool’s Joke. Please do not take any information in this blog post seriously.
As you all know, the languages currently supported by Panda3D are Python and C++. Unfortunately, this forces the user to choose from a trade-off between simplicity and performance. Python is simple and fast to prototype with, however its performance is very poor. A CPU-intensive algorithm in Python will typically run hundreds of times slower than the same algorithm implemented in C++. C++ on the other hand provides almost native performance, but it comes with a plethora of inconveniences for the developer, the most notable being that it’s easy to induce a crash or cause your application to leak memory.
Enter Java, a language designed to be a middle-ground between these two goals. Java is a modern, high-level language with strong OO capabilities and garbage collection that doesn’t expose the coder to the dangers of manual memory management as C++. But Java is also an order of magnitude faster than Python.
In light of these properties of the Java language, the development team has unanimously decided to adopt Java as the only supported language for the Panda3D API. As 1.7.0 has just been released, now is the perfect time to switch. The upcoming 1.7.3 release of Panda3D will drop all Python and C++ code, in favor of Java. Effectively today, development has commenced on a Perforce repository that drops support for Python and C++.
What does this mean to you? Let’s start by comparing how Panda usage will look in the future as opposed to now. This is the current basic Panda example in Python that you may recognize from the manual:

from direct.showbase.ShowBase import ShowBase
 
class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)
 
        # Load the environment model.
        self.environ = self.loader.loadModel("models/environment")
        # Reparent the model to render.
        self.environ.reparentTo(self.render)
        # Apply scale and position transforms on the model.
        self.environ.setScale(0.25, 0.25, 0.25)
        self.environ.setPos(-8, 42, 0)
 
 
app = MyApp()
app.run()

And this is how the same will be achieved now in Java:

import org.panda3d.*;
public class MyApp extends ShowBase {
    private NodePath environ;
    public MyApp() {
        this.environ = this.getLoader().loadModel("models/environment");
        // Reparent the model to render.
        this.environ.reparentTo(this.getRender());
        // Apply scale and position transforms on the model.
        this.environ.setScale(0.25, 0.25, 0.25);
        this.environ.setPos(-8, 42, 0);
    }
    public static void main(String args[]) {
        new MyApp().run();
    }
}

Needless to say, this is a major improvement over the Python equivalent. This will definitely help Panda3D expand in the marketplace since Java alone has more demand than Python and C++ combined (see the graph below).
Java versus Python and C++
We are already seeing the first benefits of changing to Java. For example, we have replaced our build system, makepanda, with Java’s ant. This allows us to leverage the XML format to streamline the build process’ bottom-line in a monitored, decentralized way.
We hope that this multi-tiered non-volatile migration process enables us to provide synergized encompassing software emulation through realigned composite management trends, and resulting in universal global process improvement in the end.
We are also in the process of officially renaming the engine into Janda3D. This is because the P in “Panda3D” stands for Python. This involves registering a new domain name and registering the trademark with the US Patent and Trademark Office, so it may take some time.
Please stay tuned until our next blog post, in which we will explain how we plan to make the networking system in Panda3D version 1.7.9 fully compatible with RFC 2324.
Janda3D

39 thoughts on “Porting to Java

  1. Why Java, I much prefer working in Ada, that language really prevents the user from making mistakes…

  2. Will it be possible to write Jampa3D code through the IMPS (2795) protocol? It would be soooo great!!

  3. wtf? –> Python actually was the REASON for me using panda3d… java is terrible to use… its neither “simple” compared with python nor “fast” compared with c++. It has bloated libraries etc…
    Considering that python is much younger than java, hence still needs optimization in a lot of areas, its performance is not as bad as poeple say compared with java.
    For real fast performance you GOT to use C++ there is no way around.
    Java is like the typical bad compromise in politics. In terms of programming usefulness, this change will make panda3d very unattractive.
    Please at least consider support for jython.
    On the other Hand:
    Java made me thinking: will there be support for android? because on that platform a “useful” 3d engine is something that’s really missing. And since you’re going to java anyway. Maybe that would give panda3d back its lost purpose?
    greetings, tom

  4. Wow, you nearly got me. In Paragraph 4 i got suspicious and
    “We hope that this multi-tiered non-volatile migration process enables us to provide synergized encompassing software emulation through realigned composite management trends, and resulting in universal global process improvement in the end.”
    totally nailed it. I didn’t even need the RFC hint to get that April 1st joke.
    But well done, this was the first news today that was really close to make a fool out of me.
    Greeting, Mike

  5. I think it is an April 1st joke too. The only REASON for me to use Panda is the fact of being able to program it in Python, when these changes come I will leave Panda community. I hate Java!

  6. “wtf? –> Python actually was the REASON for me using panda3d… java is terrible to use… its neither β€œsimple” compared with python nor β€œfast” compared with c++. It has bloated libraries etc…”
    I agree on that, java suck. If you tell that to most java developer, they won’t like to hear it. They think they are the most clever person and will look down on you.
    But the fact is java has somekind of programming flow structure disorder (deprecated if not good), if you learn it enough it can cause your mental disorder, that’s why sometimes its hard to chat with a java developer in a normal way πŸ˜€

  7. so bad πŸ™
    Panda3D is great because it uses Python, this makes it easy. Programming in Java is horrible.

  8. Keep in mind that this was really an April Fool’s Joke. The blog post wasn’t meant seriously. Panda3D really isn’t switching to Java. πŸ˜‰

  9. I think that a better option can be Mono and then, make support for another languages like c#, boo, lua, etc… all above the mono runtime, but porting to java will be a very good transition anyway.
    I think we can talk, because I am thinking on a project that already do this language support for some engine, and Panda is my choise for now.

  10. Really not funny. I was examining the possibility to use Panda3d for a project. How am I supposed to know that this is a joke? I almost decided against panda because of this post.

  11. About time. The performance stats show, even Java will outdo C++ on some things (anything with hash searching).

  12. Will i can use jython at future? I think that ‘Jython’ will be more confortable for python’s programmers.
    P.S: I sorry for my bad english

  13. While having more java game engines is really a good thing, i think you’d really leave at least c++ support.
    This is because the gaming industry still thrives on c++. No ios development is possible in java at the moment.
    If you were able to create a complete java/c++ engine, you will address practically every possible system.
    I’ve read horrible things about python performances and other troubles, I think letting it go is a good thing. Sorry python devs.
    Open the codebase, create a cross-deployment system, and you’re done. Not a easy thing I know. But if you’re really serious about it, you need to address the old and the new, imho.

  14. Oh Go?,
    this mean there are no better Panda any more. We must use those old Pandas when Janda is better and better. Oh my!

  15. well that’s me out, the reason there are more java jobs is because it’s trusted in the business sector that doesn’t make it more suitable than c++ for games, also python is easier to prototype in

  16. Why don’t use Jython??? we can be benefited with the Java JVM resources, and maintaining the Python style of programming, and use some interesting resources offered by Java Libs and Class Libs.
    Someone have developed something for tests using Jython? Please publish here the results.

  17. I thought you would really be using java…that’s the reason I would like to try…hmmmm…learning python and panda3d is ok too…

Comments are closed.