Script language for JVM and DVM

2

I intend to use a script language coupled with Java SE applications, my fear is to develop something and then later have a hard time porting it to the Android platform. I'm not a professional in the area, but I know the importance of portability, since the mobile world is a reality for a long time now, and since I sometimes do some utilities to help with some day-to-day tasks, I'd sure like to port them to the Android (the most popular OS currently for mobile).

I saw that Google did not include the javax package and in it we have the ScriptEngine. I researched today and found an alternative, Apache's BSF . The problem is that I do not know if this business is still under active development ...

What do you suggest? I've never touched games (it's not my interest here either), but I know that people usually use Moon for scripting (to extend application functionality so that they do not need to recompile all of it). And on Android, how do you do?

More details

I need a script language because:

  • I sometimes do web scraping and need to change the code frequently;
  • I run tests with Wikipedia and have a pretense to test algorithms to detect vandalism (often it has to be updated);
  • I like having a REPL (Read Eval Print Loop) for prototyping, etc.

Once years ago I did a test of Java SE with Rhino, using ECMAScript myself, I found it cool because I could develop a REPL called in the application, it was very good for prototyping.

    
asked by anonymous 08.05.2016 / 05:52

1 answer

3

There are many languages that can be emulated in Java, but when it comes to portability for games, the problem goes to another level. Some examples of difference:

  • You will not only run the same language as you will need both platforms to provide access to graphical features and other requirements for developing games through the same APIs.
  • The above implies that you will not be able to use common libraries and frameworks for game development unless it is available for target platforms.
  • Differences in screen size often require different images for each resolution.
  • The input interfaces of the devices are also very different, for example mouse versus touch screen.

In summary, even if the code is 100% portable, there are still many things that require two different implementations.

Of course, differences can be mitigated by imposing some limitations on the Game, such as displaying graphics with less quality in the desktop version, but I have put the above points just to try to highlight some aspects that you may be ignoring.

As for the language used, it is true that it is tricky to do ** scripting on Android, but there are at least two options:

  • JavaScript in PhoneGap . I have some colleagues who have created simple games using this platform. You can even a tutorial gives some ideas. I confess that I'm not a user of this technology, but apparently you can create hybrid applications for mobile and desktop devices. Of course the performance of these applications will never be able to compete with native code.
  • Java. If your focus is limited to Android and desktop with Java SE, there is no technical reason for you to need a scripting language over. The reasons why people use Lua over C and C ++ is to have a higher level of language while still being able to enjoy the high performance of those languages when needed, but Java is already of a higher level than those languages and easy enough of working, while still providing reasonable performance, something like a middle ground.
  • 08.05.2016 / 07:03