Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (799)
Games in Android Showcase (237)
games submitted by our members
Games in WIP (865)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Reasons for using a scripting language in your game?  (Read 5510 times)
0 Members and 1 Guest are viewing this topic.
Offline Jacob Pickens
« Posted 2014-12-05 02:57:56 »

Whats the point of having a scripting language in Java? Why can't you just program everything in Java? What the point of putting it in a different language?

Offline HeroesGraveDev

JGO Kernel


Medals: 382
Projects: 11
Exp: 4 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #1 - Posted 2014-12-05 03:14:34 »

Java already is bytecode, so having one kind of bytecode being interpreted by another kind of bytecode is quite redundant.
Scripting is really only useful in compiled languages where recompiling the entire game for one small change is a waste of time.

Also, the awfulness of C++ probably contributes to people wanting to use another language as much as possible without sacrificing performance.

Offline deepthought
« Reply #2 - Posted 2014-12-05 03:55:47 »

It makes your game easier to mod because your users won't have to compile java code and get the clsspath to the game's libraries right, they can just edit the script files.

I also remember seeing somewhere that it's easier to secure than classes loaded by reflection

Mad Scientist
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Ecumene

JGO Kernel


Medals: 200
Projects: 4
Exp: 8 years


I did not hit her! I did not!


« Reply #3 - Posted 2014-12-05 04:02:04 »

Scripting is really only useful in compiled languages where recompiling the entire game for one small change is a waste of time.

Wouldn't the script's interpretation take time too? I mean it's kinda a big overhead for a possible convenience factor..

It makes your game easier to mod because your users won't have to compile java code and get the clsspath to the game's libraries right, they can just edit the script files.

Why do this with Java? Java has a archive loader to make 'plugin' development really easy, and you get to have a TON more access than you could with any scripting language. Plus, no interpretation time.



Also, there's some really good answers here: http://stackoverflow.com/questions/22219768/why-use-scripting-languages

Offline SHC
« Reply #4 - Posted 2014-12-05 04:19:27 »

Wouldn't the script's interpretation take time too? I mean it's kinda a big overhead for a possible convenience factor..

You are half right. In the case of Java, JVM has to load the bytecode of the classes and interpret them. There is already one interpretation being done, then interpreting another scripting language will be an overhead, and is not recommended.

In the case of C++, there is no VM lying around, the code is completely compiled to native platform code, and is loaded in the runtime by the operating system's loader, so having an interpreting script language won't be much of the overhead when compared to Java. This is what Heroes meant in his comment.

However, I don't think so, with the JIT, Java in the recent years is much more faster, and sometimes, due to optimisations, can outperform C++ (citation needed), so I don't think performance or speed consideration is needed now-a-days.

Offline HeroesGraveDev

JGO Kernel


Medals: 382
Projects: 11
Exp: 4 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #5 - Posted 2014-12-05 05:09:54 »

When I said waste of time I was referring to compilation time.

Big games can take a long time to compile (or rather, optimise. It's the optimisation passes that take the longest time. Most of the compilation process is rather quick). No point in recompiling for each little change when you could just edit a text file and retry instantly.

Java isn't optimised at compile time, and so compile speeds are usually fine. Therefore scripting is just a new layer of indirection that isn't really needed.

@SHC: Java will very rarely be able to beat adequately written C++, but it gets close enough that they can usually be classed as the same speed. Really well-written C++ will practically always beat Java.

Offline gouessej
« Reply #6 - Posted 2014-12-05 09:44:09 »

Hi

@SHC: Java will very rarely be able to beat adequately written C++, but it gets close enough that they can usually be classed as the same speed. Really well-written C++ will practically always beat Java.
I have frequently succeeded in writing Java code that beats a bit (about 5 to 15%) moderately well written C++ code since 2006 and this is what refrained me from going back to C and C++ at the beginning. Even my most simple blueprints with JOGL and AWT were faster than their equivalents in C++ with GLUT and SHC seems to forget that Java (OpenJDK and Oracle Java, except maybe OpenJDK Zero) isn't purely interpreted except when you use -Xlint.

Julien Gouesse | Personal blog | Website | Jogamp
Offline basil_

« JGO Bitwise Duke »


Medals: 418
Exp: 13 years



« Reply #7 - Posted 2014-12-05 10:15:31 »

"bigger" studios use scripting to allow "designers" contribute "code" without the requirement of c/c++/java knowledge .. in a "sandboxed" environment.

live-coding is not the biggest advantage since you should not put "expensive" or time-critical code into the script interpreter. yet, one typical application for small dev teams is a scripted finite state machine to handle dialog-trees .. or similar. better put the effort into a shader-live-coding system, which is technically the same.

if you worry about compile duration, get jrebel or learn to code with the JVM buildin hot-swap. o/
Offline princec

« JGO Spiffy Duke »


Medals: 1126
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2014-12-05 10:20:22 »

There are no sound technical reasons to use scripting languages with Java to make games. Scripting solved a problem that C++ has that Java does not have.

Cas Smiley

Offline lcass
« Reply #9 - Posted 2014-12-05 17:27:09 »

To be honest , the way computers are heading is most likely going to mean that future programmers will sort of shrug off on performance just simply to how annoying it is to optimize and how little they would gain from it. But for now scripting is useful , a lot of the previous comments are correct , great for people trying to mod your game , great for loading in external data so that you dont have to right yet another god damn tile class or for things like file handling , python file handling vs java filehandling is a bit step and being able to just call a save script instead of writing out a save class is better. Scripts wouldnt really be performance useful when in a consistent method so you obviously wouldnt use it to handle your tick function. They have their advantages and it;s really a situational thing.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Roquen

JGO Kernel


Medals: 518



« Reply #10 - Posted 2014-12-06 08:19:00 »

A scripting language should make something easier.   AIs and behaviors are classic examples and being usable by non-programmers.
Offline princec

« JGO Spiffy Duke »


Medals: 1126
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #11 - Posted 2014-12-06 12:28:10 »

As yet I've not noticed any scripting languages that are actually easier than Java in any particular way. I notice wryly that Unity uses C# as its core "scripting" language as it is. That should give people some clues Smiley

Cas Smiley

Offline Roquen

JGO Kernel


Medals: 518



« Reply #12 - Posted 2014-12-06 13:00:23 »

Example: directly coding a behavior tree in a java or c++, etc. like language would blow chunks.
Offline pitbuller
« Reply #13 - Posted 2014-12-06 15:26:30 »

To be honest , the way computers are heading is most likely going to mean that future programmers will sort of shrug off on performance just simply to how annoying it is to optimize and how little they would gain from it. But for now scripting is useful , a lot of the previous comments are correct , great for people trying to mod your game , great for loading in external data so that you dont have to right yet another god damn tile class or for things like file handling , python file handling vs java filehandling is a bit step and being able to just call a save script instead of writing out a save class is better. Scripts wouldnt really be performance useful when in a consistent method so you obviously wouldnt use it to handle your tick function. They have their advantages and it;s really a situational thing.

Actual game development is coming totally different direction that your vision suggest. Currenty hype is to get away of redudant overhead(Mantle, metal, dx12, GL next, Data oriented design, more c:ish c++ coding, simd, multithreading, etc). All these need more attention of programmers not less. These all also give you substantial speed gains. Single core performance does not increase fast anymore. You need serious effort to compete. Just look where Unreal engine is heading, hot loadable c++ instead of scripting language.
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (187 views)
2019-09-04 15:33:17

hadezbladez (4874 views)
2018-11-16 13:46:03

hadezbladez (1785 views)
2018-11-16 13:41:33

hadezbladez (5147 views)
2018-11-16 13:35:35

hadezbladez (1016 views)
2018-11-16 13:32:03

EgonOlsen (4367 views)
2018-06-10 19:43:48

EgonOlsen (5216 views)
2018-06-10 19:43:44

EgonOlsen (2946 views)
2018-06-10 19:43:20

DesertCoockie (3867 views)
2018-05-13 18:23:11

nelsongames (4293 views)
2018-04-24 18:15:36
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!