Squirrel Discussion

Discuss the development of Reality Factory 2
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Squirrel Discussion

Post by Jay »

I have a suggestion to make. You all talk about scripting languages, and that's ok. But what if we used a programming language as our scripting language? To make it short, I am talking about Java.

Advantages:
-Massive language library, supports for example:
-HashMaps
-ArrayLists (encapsulating arrays)
-Many usefull String operations
-Sorting of sortable Collections
-Importing of dll functions made easy through JNA
-Users can use the freely available development tool Eclipse which supports:
-Javadoc for scripting commands documentation
-Code completition
-Syntax checking
-Automatic script compiling
-Many language tools which can be used to build a scripting framework that can make thinghs very easy for RF users, having all default functionality without writing real code and still be able customize the whole system by overriding functions (We would have a base class RealityFactory and then you inherit from it - an empty class would be default, but then you can begin to override the methods....) This is absolutely not problem because in Java all functions are virtual.
-Object orientation with single inheritance, but as many interfaces as you want (interfaces are abstract classes where all functions are abstract=pure virtual, and have no member variables. They can, however, have static variables)
-Compiled language for good speed
-The language supports Multi-Threading natively. (We don't have to use this feature though if we don't need it)
-Scripts can run simultaneously and in different threads if needed, might need some twaking though. (Like above, we can make it so that they run after each other if needed)
-The language is still actively developed and in the past there were some speed opimizations regarding Java. We don't have to develop it further, instead it is developed FOR us (and i think that suits RF2 very well, seeing that Ogre is also actively being developed for us!)
-I don't think we even have to recompile RF2 to get access to the newly added language features of Java. This is because they are 'in' the language, and we would just implement an interface to Java in RF2's source code.
-I have just been looking at its license and it seems to fit for RF2 (http://www.java.com/en/download/license.jsp)
-throwing of Exceptions can make it easier to debug scripts

Disadvantages:
-Users have to install the JRE (and maybe the JNA, which simplifies the process of importing the scripting functions from RF) with RF.

I don't think speed of Java itself will be an issue, however it could becme a task to make the interaction to RF (into C++) and from RF to Java possible. Might become a task, but it IS certainly possible!

Also the base concepts of Java are simple to grasp in my opinion (the more complex thinghs are a bit more complicated yes, but not every user will need to write their own interfaces and abstract classes!).

Sme examples of how script writing could look:

The easiest 'game script' possible:
Image

Overriding the setup() method of the RealityFactory class:
Image

Eclipse presenting you the thinghs you can do with the object:
Image

(The above samples are, of course, pseudocode)

Tell me what you think.
Everyone can see the difficult, but only the wise can see the simple.
-----
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Squirrel Discussion

Post by Danimita92 »

I'm sorry, but wasn't the main idea of RF to have a suite of programmes that allow you to create a videogame without the need to write a single line of code?
I mean, yeah, if you want to make a more advanced game you need to write scripts, but that's just copying and pasting orders from the manual into a simple syntax. Maybe it's okay for you people that are used to writing with programming languages, but what about the people who just want an easy enough utility to make the game they've always dreamed of making? There are several (some free) engines that allow us to make games by writing many lines of code, but RFs way of writing enemy AI is so easy even 11 year-old kids are able to make their own games.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Squirrel Discussion

Post by Jay »

I mean that RF is programmed in c++, but our scripting language can be Java. You want it to be easy and simple - And that's exactly why i want to use Java. To make it as simple as possible. Like the pictures i posted show, the framework can be written in such a way that the end user (you) does not have to mess with all the complicated stuff. BUT you can alter it to your needs if you really have to. We could also write different base frameworks for different kinds of games very easily that users like you can then use.

From what i gather from Andys and paradox's posts, RF2 is going to have some 'main' scripts (bootstrap.py etc) which will setup and start the game, maybe even run it. The default ones will offer default behavior, but they are there so that you can modify it and custumize it all. If you want. Those standard scripts can be written in a way that allows that 95% of all users don't have to touch them at all. This is the same with Java. Switching to another scripting language like Python, Squirrel or Java certainly will change the way scripting is done in RF2 versus the scripting in RF1 just because it will be another language.

Right now, what do you have to do to get the game running? Ok it's easy. You make a room, then add PlayerSetup and PlayerStart. That's all. It can, however, be even more simplified. What if PlayerSetup was already built-in (it has no location so it makes no sense to have to put it into the level at a specific point) and just had to be adjusted in the editor. The editor would then write the PlayerSetup-script for you and then you don't have to script at all! But lets say you want more than just the standard package (for whatever reasons). Then you can go into the code of the PlayerSetup-script and alter it to your needs. I believe this is the way RF2 will be going.

So if the editor can write all the basic scripts, what is going to be different for 95% of all users?

Also, scripting essentially IS programming. Using a programming language as a scripting language (and java is somewhere inbetween) would give us much more flexibility. Writing an advanced script is really a pain in Simkin. Thinghs like lists, arrays and such are difficult to achieve in Simkin. And objects...VERY difficult. But since Java supports those types natively, it all can be much EASIER to write advanced scripts for example for pawns that can maintain aggrolists, can 'chat' with each other, can have their own inventory, can be used in 'Groups' so that you don't have to write the same scripts twice (makes it much better to read your scripts). So that a 'Leader Soldier' is essentially a 'Soldier' and has many of the same base abilities etc. . Ok, this may be the same with other languages...

I admit that Java is more complicated than Simkin. I admit that it might not be the 'best' option because it offers other stuff too (which you won't need and therefore may distract you), and i also admit that many people will find it strange that a program uses Java as a scripting language. But i see the flexibilty of the language, the stuff you can do with it. Like building base scripting frameworks for for example Car-games, FPS-games, Adventure-games... that the community can then use to make their life easier. (Of course other languages can be used too, but i somehow think Java is more suited for this 'Framework building')

If you are doing your scripting by copying and pasting orders from the manual, then it's not going to be much different when we are going to use Java, Python or Squirrel. I repeat myself, but the reason i want to use Java is to make thinghs easier, not more complicated. In all scripting languages you can make it so that you have write more code to make thinghs happen, or less code to make thinghs happen. It's not dependent on the language.

I am not talking about using Java as a programming language for RF2. That is NOT what i mean. I want it to be a scripting language which we can use to build frameworks to be available to the users of RF2.

If we are going to use Python or Squirrel or whatever i will not argue. I trust the RF2 developers will find the perfect scripting language for RF2, it was just a suggestion, and maybe it is not the perfect scripting language for RF2, but Java should also be taken into account.

Again, a long post...

EDIT:
Forget it, Java would be overkill and too difficult to learn for beginners. I and my crazy ideas :lol:
Everyone can see the difficult, but only the wise can see the simple.
-----
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Squirrel Discussion

Post by Danimita92 »

Don't kill yourself over this, I just meant that for example Simkin I learned in a weekend of reading the manual, learning from other predone scripts and asking questions in this forum. ONE WEEKEND. If you think java can be learned in a weekend of hard work (by someone who knows less about programming than a dog) then I'm with Java too
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: Squirrel Discussion

Post by paradoxnj »

I agree with Danimita. Althought Java has been used for commercial games, it's way too cumbersome and slow for it to be effective. The games it was used on were focused games. We are trying to make a shell that can be used for any type of game. Something that is a little more abstract, lightweight and easy to learn is the target.

Danimita...the statement about not writing a single line of code is incorrect. Scripting is still coding. You just don't need to compile that code. It should not be "Games without Programming"...it should be "Games without Compiling".
Many Bothans died to bring you this signature....
User avatar
zany_001
Posts: 1047
Joined: Fri Mar 02, 2007 8:36 am
Location: Aotearoa

Re: Squirrel Discussion

Post by zany_001 »

but that's just copying and pasting orders from the manual into a simple syntax.
I lol'd.

No offence. :D

I agree with Mr. P that Java is too weighty for RF2, althogh it would be interesting to see. It isn't that hard to learn IMO, and I suck at programming, but it is fairly slow and as Jay said, it's overkill for game design, and probably most of what Jay is suggesting could be acheived wth Squirrel, although Java is more advanced.

We should use that as RF2's motto:" Reality Factory 2: Games Without Compiling?!"
Once I was sad, and I stopped being sad and was awesome instead.
True story.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Squirrel Discussion

Post by Jay »

Ok, no problem.

I lean more towards Squirrel (because of syntax and because it looks 'cleaner'), but if that Stackless Python is faster, then we should use that instead. RF2 is not going to get any real attention if the speed is not right.

Btw, has there been a decision yet? I would really like to look at the scripting language of RF2 before it is released, so that i can start right away when it gets released.

Oh, and another thing: Will RF2s scripting support to read and write from/to files? That would open up many possibilites.
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: Squirrel Discussion

Post by paradoxnj »

A concrete decision has not been made. Stackless Python still has the same language syntax annoyances that regular Python does. So...I am leaning further towards Squirrel.

Yes...RF2 will allow File I/O in scripts no matter what language it uses.
Many Bothans died to bring you this signature....
Post Reply