An idea - what about a Scala port?

I am working with JMonkeyEngine for about a half of a year already. From time to time I come across issues that require me to dig into the source code of the engine to understand how it works. I think that I will work with JME3 furhter more for quite a period of time, therefore I have to know it better. Also, my language is not Java, it is Scala. And sometimes I get into Java limitations while working with JME3 and have to implement workarounds in Scala for them. Sometimes that gets rather annoying especially that programming Scala is such a breeze, comparing to Java which is more like a bumpy road with deadends. Therefore I thought that I could port the engine to Scala. That would greatly improve my understanding of the engine, and the various techniques used in it, would widen my programming scope. So I want to know - what do developers think about it? Would this be a favorable attempt? If I would start doing this, I would need some assistance from the core team to stay within JMonkeyEngine world and get a better understanding of “special” places of the engine (are there any?) and graphics-related things. Or maybe this endevour is not welcomed and the developers do not want me to do so? Therefore I am asking your opinion, is this worthwhile?

The benifits:

  • Better cooperation with tasty Scala features
  • Easier project code, faster and easier to write in Scala
  • Less lines in the source code (decreasing up to 1/3 from the original*)
  • Integration with Scala libraries like Akka for, say real-time 3D mass online software
  • Popularity in the Scala-world
  • First break-through from the limitation of the Java language
  • Support for Functional Programming, easier multithreading (Akka actors)
  • Me gaining experience :slight_smile:

    • according to common estimations

      The drawbacks:
  • I know I can port the core libraries. I am not sure about the SDK itself? Just never looked into it…
  • It will take some time…
  • Will have to synch the updates for the two branches.
1 Like
@noncom said:
- Easier project code, faster and easier to write in Scala
- Less lines in the source code (decreasing up to 1/3 from the original*)

This just reminds me of this article:
You should REALLY read that ;)

Scala is by far not the answer and by far not that good as you make it sound ;)

I mean yeah, if you want to learn something, go for it. But jME is a java engine and i really hope it stays that way, meaning i don't want core developers of jME helping you with scala code. it just splits ressources that should better be focused.
1 Like

4get it. jME is a java lib and will stay like that. You can use java libs in Scala and if you want you can wrap jME but none of the core devs is really interested in scala (add to that that its lowlevel antics and “optimizations” often rather confuse the JVM than cause the intended speedups).

In case you don’t believe me maybe you believe somebody who writes JVMs for a living: (somewhere in the middle he makes the comment about scala).

1 Like

@polygnome Well, I speak from experience in production. I have read many such papers when I was tempting to change my language from Java. Then I have studied it in real coding. There is some truth in such papers. Truth can be found anywhrere, as well as lie… I guess it is a personal choice. I have about 7 years experience with Java language and a year+ experience with Scala. The shift really brings it in. About 95% of people who changed to Scala are of the same opinion. I do not “make” anything sound this way :slight_smile: I simply feel and live this way. However, I agree that splitting may be considered risky.

@normen I have looked through the entire video hoping for some real matter - since I want to know all the Scala weakesess even more than you :). The speaker is working in a company that produces a commercial JVM. I was impressed with the amount of knowledge he has - that amount it takes to turn something opensource into commercial - so he has to be a really informed guy. According to the information and graphs on their website - their Zing JVM is really a miracle. I can’t speak from here. But he did not say anything valuable about Scala. He said that “he wished that Scala and Clojure and other languages better would not mess with JVM because their way of handling concurrency is different from fork/join, and that programmers better do that in code”. And also I read his blog with comments on STM that is used in Clojure (not used in Scala). Well, aside from that he said almost nothing, especially comparing to the other areas, where he really understands what is he taking about. Also please know that Scala is not all about concurrency. Concurrency is just one of the pro’s and it is fairly well-made with much more improvements coming. And it works nicely to the extent that I have experienced it and from the experience of many other Scala developers that I had conversations with. That was all about that I do not believe you :slight_smile: Now about the porting - you are right - jME is yours, so I did not want to offend any idea put into it, I really respect the effort put into and the sheer greatness of the engine :). That is true. Please don’t see me as a rival, I am your friend. Please excuse me for proposing such a silly idea. I also would be grateful if everyone else from the core devs “-1” my post so that I never post anything like this here (please “-1” this post too).

1 Like

Of course, I am the asshole and I voted you down. I didn’t even post the first response, why all people think I am voting down? I really rarely do, especially not when I give an actual answer to the thread… w/e… No Scala for jme. From the rest of his talk you should gather that a JVM best works if you write clean, readable java code without any “optimizations” as the JVM can translate that best to efficient code. Scala produces bytecode for the JVM that is not coming from normal java code… And btw its stack traces are abysmal.

1 Like

@normen - I think you are very good man, I read your posts sometimes. You would not be in jME team if you we not ;). Yes, no Scala for jME.

As for Scala itself - I hope that sometime you try to research the tool in it’s full power. It requires somewhat different thinking than Java - if you puch trough the initial wall (which was kinda hard for me - I could only do it from a second try), the revealed world will be amazing. Scala, due to support of functional paradigm on JVM can be slower on current JVMs. However, being dealt appropriately (or if you just write in it like you would write in Java - without any Scala features), it is not slower, makes write much less code and it will not stop at that - it improves and improves fast - it’s creator is Martin Odersky - the inventor of generics in Java - is a pro of a language design and he surely knows what he is after. As for the stack traces - I rarely see any because Scala has that thing like in Haskell - if the presentation compiler is satisfied with your program - 98% that it will work without failures. The stack traces that I see are very readable though. Maybe you have tried it a long time ago, when it was not a production-ready language.

Stack Exchange can’t lie - on memory | on performance | on code

Frankly, as I am VERY interested in knowing all Scala weaknesess, could you tell me what have you been creating and with what version of Scala? If these were not real projects but just simple programs, I also would like to know, since I am very opened to know much and I appreciate your opinion and want to really understand it. I hope that this is an interesting discussion and not a flame war, and I very much respect you as a developer, because I depend on what you create today. That is why I am very tempted to know more on your experience if you let.

1 Like

@noncom, I can’t say anything on that matter because I don’t know Scala.

However what I can say is, even if you are right, Scala is not a good choice for us.

The reason why JME is quite popular is because it’s java based.

There are plenty of very good engines out there, better engines even, but most of them are based on C++.

There are truck loads of java programmers in the world that want to make games with the language they know the most and they use at work.

Maybe this will change in a distant future…I guess than 10 years ago you were considered a freak when talking about a java 3D engine. Maybe someday Scala will be the most popular language…but right now it’s far from being the case.

Also, I don’t find the java road that bumpy, and never found myself lost in a dead end, but again, my only point of comparison is C++.

I think one of @Momoko_Fan friend is leading a Scala 3D engine project (isn’t he the one that coded the TangantBinormalGenerator?). Maybe you could have a look at his project simplex3d.

1 Like

Yes I did look at scala and played with it (no big projects) and theres absolutely no doubt some features are just great but the main drawback is that most developers have to learn it while almost everybody knows java. And again, its no problem integrating jme into almost any paradigm just as you can use C libs with C++ or Obj-C… Also I wouldn’t know what part of the engine would be easier to maintain with Scala, maybe thats where you could give input. Somebody from the jME2 times (darkfrog?) started doing his own game engine based on Scala, idk if he had less problems in general but I doubt so. At least it wasn’t like he finished the engine in a few weeks because Scala made it so easy. In general using or just supporting Scala would mean only overhead for us.

Generally all people who learn a new language come and say “oh, everything should be done like this” after they got the basics and it “clicked” for them. But the java libraries that we use alone would mean a lot of overhead for us to wrap to Scala (or find a Scala replacement), let alone all the systems we developed and tested based on java. All that work and experience would be down the toilet basically if we wanted to do a realy scala-ish jme (anything else would just be wrapping which any Scala user can do for himself).


@nehon I totally agree with you on everything. I just want to say that I did not mean to replace the Java jME coz everything you say is the reality, rather I was proposing a sort of an “experiment” where I would take all the tasks on myself (porting is not creating :D) except for where I would need input from the dev team. The bumpiness and dead-endness is not visible from Java. Talking in terms you say - Java from Scala looks like C++ from Java (but far not that heavier from a CPU pov). In general I felt fine when was doing Java. Now I won’t apply for employment as Java programmer unless the salary is 2,5-3 times more from what I have with being a Scala programmer. And I would still be doubting. And thanks for pointing to the Simplex3D engine, I will definitely explore it right away! :smiley:

@normen All true too. No big benifit rewriting jME with Scala (or it is not visible from here) - just some “sugar” provided by Scala at least as it looks like. The biggest benifit, as I have indicated before - is my benifit because I intended to do it mostly alone, just coordinating with the core team. It is just that I proposed sharing the result with the people because maybe someone will benifit from it. Yes, I am a neophyte, who wanted to re-invent the wheel, trying myself in such a project, learning more Scala. Scala is so different, it just spins the thought, it is mind-boggling and gives so many fresh ideas that surely it calls for so-beloved-by-me mental programming gymnastics and mathematical beauty. But I never meant that jME should be immideately replaced by its scalaish version and all that there is should be wasted. No way. On contrary, that was an idea of a why-not-proof-of-concept experiment (and to reveal Scala weaknesess too and benchmark it against Java and such stuff). Strange that everyone immediately thought that I want to kill something alive. Nevermind. Gone.

Anyway, thank you for your opinions and sharing the thoughts. I have found some interesting points in them. And as I wish you all good, I would love to invite you to expand your minds where I will also be attending. Looking is free :wink:

1 Like

To be honest the resistance you are facing is nothing to do with Scala itself - personally I’ve no real knowledge of the language and have never used it.

The problem is that you are effectively asking the project to fork and support two interfaces. Unfortunately speaking from experience that doubles the maintenance workload involved. Every time a change is made in Java it needs to be made in Scala too. Every time someone works on the Scala version that effort is wasted for the main project unless someone ports it (which may be some, none or a lot of work) to Java.

It’s a nice offer that you are making to do the port yourself but that’s also an absolutely mammoth undertaking. The odds are (with no disrespect to you - it’s just the way these things tend to go. 99% of projects like this are started with the best of intentions but die within a few months) that it will never be completed. In which case all the work supporting you is wasted. In addition even if it is completed there is then an expectation that the Scala port will be maintained and we can guarantee that even if you are still active and maintaining it there will be a support hit on the rest of the team too even if it’s just fielding queries and passing them over to you.

So essentially what you are proposing presents a significant drain & risk to the main JME3 project with no benefits to the project. Yes I’m sure there is a benefit to any Scala programmers wanting to make a game…but that’s not one of the JME mission goals. :slight_smile:

So I expect that’s why you got a -1.

1 Like

@zarch agreed. I just did not realize that it would be such a trouble… thanks for exposing the realistic pov to me! I thought that would be fun, but really, it is just a one big problem :wink: Better the core team keeps doing what they are doing very well, without distractions, bringing the real joy to everyone :).

About the downwote… I am not offended, but the where is the logic?.. I still do not understand why “-1”, ok the post is mocked but the “-1” goes to me, not the post. The reputation stays with me. As if I am a “negative” person while my intent was 100% positive. Oh well, no big trouble, I do not care, it is just an integer value somewhere in the forum’s engine… where is logic?..(rhetoric)


-1/+1 is referring to that post…even though it reflects on you :slight_smile: I wouldn’t worry about it unless your overall total goes negative.

Just do a few helpful posts and you can rack up the positives pretty fast.

For what it’s worth I upvoted it back to 0 as I didn’t think it deserved negative. Someone else has downvoted it since though!

1 Like
@zarch said:
-1/+1 is referring to that post...even though it reflects on you :) I wouldn't worry about it unless your overall total goes negative.

Just do a few helpful posts and you can rack up the positives pretty fast.

For what it's worth I upvoted it back to 0 as I didn't think it deserved negative. Someone else has downvoted it since though!

I zeroed it again... we'll see if it sticks.

There are some vindictive down voters and I think most other posts get thumbs upped again. While I don't think the OP's post deserves any thumbs downs I can see why it doesn't get the balancing thumbs ups.

Maybe we need a system like I've heard about where downvoting someone requires giving up some of your own karma.
1 Like

Or just show

@pspeed said:

Maybe we need a system like I’ve heard about where downvoting someone requires giving up some of your own karma.

Or just show on peoples own profile how many up and down votes they've given (or even just the difference).

(i.e. Zarch [204p] {Given 563, Taken 36} .. or just Zarch[204p] {527g})
1 Like

Or perhaps just leave it because it’s Internet forum votes.

… first world problems.

@thetoucher said:
Or perhaps just leave it because it's Internet forum votes.

... first world problems.

True, it's not a big deal. It might help keep discussion flowing nicely though, which does benefit the community.

Ive been doing java for 10 years professionally and have lately become a total scala convert. Scala makes me more productive and is imho alot more fun to program with. Even though i know is on average 10% slower than Java i prefer the mentioned qualities of Scala. I guess JME, beeing a game framework, needs to focus more on efficiency than language luxery. It wouldnt be that hard to make Scala Wrappers / Adapters for parts of the API that could improve “the scala paradigm”. (implicit conversions and more direct ways). Ie, that could be done as a 3rd party thingy. Until now i havent had any major issues with jme beeing java and i do prefer it puts efficiency first as my scala code aint.

Anyhow… Scala is damn lovely.

1 Like
@kwidell said:
I guess JME, beeing a game framework, needs to focus more on...

You left out an important word that makes it all clearer:
"I guess JME, beeing a Java game framework, needs to focus more on..."

A scala game framework would probably be written with scala in mind. A Java game framework is going to be written with Java in mind, etc... which is why it's nothing like a C game framework either.

Nothing against scala but this is a square peg and round hole issue, I think.
1 Like

I get your point even if i might consider it a JVM framework - but who am i to label it. :smiley:

1 Like
@kwidell said:
I get your point even if i might consider it a JVM framework - but who am i to label it. :D

The developers are Java developers. The API is in Java. The API uses Java language features where possible. The engine tries to use Java friendly patterns where possible.

I know I'm probably splitting hairs but there is a difference between something that runs on a JVM and something that was written with Java development in mind.