Not logged inOpenClonk Forum
Up Topic General / Feedback and Ideas / switching script language
- - By MastroLindo Date 2009-04-16 10:50
An open development will soon translate to many people collaborating on the project (hopefully). That means that there will be a lot of people coming from outside the actual clonk community, and a lot of developers will come and go in short periods of time.

I was thinking that, even if the actual script language is quite easy, maybe a better way to make newcomers comfortable would be to switch to a more standard script language like python or ruby (that are really really easy to learn anyway)

I read that there are plans to change core engine functionalities and entities like the defcore.txt etc... so anyway work will be done on the script language too I think

Just a low-priority idea, I am for first not really convinced that it is a GOOD idea, but I would like to know people's opinions about it :)
Reply
Parent - - By Caesar [de] Date 2009-04-16 11:00
Well, the general syntax is the same among python, perl, java, cpp, php, etc. You always have {} for blocks, () for functions and priority-adjustment, [] for arrays, and a semicolon at the end of every statement. What would you like to change?
Parent - - By MastroLindo Date 2009-04-16 11:07 Edited 2009-04-16 11:11
you would have object oriented functionalities, inheritance and so on. And to script new objects in a more structured way would be way easier and more traditional than have the include approach of actual script system.
inherited functions, constructors and deconstructors and so on.... it would just be more natural and more similar to almost all the rest projects that require scripting.

And also you don't have to carry on a script language to mantain, correct bugs, etc,  since all the functionalities are already built in and mantain by python (or the other languages) developers...

I think that clonk script system is a child of an era where languages were way more complicated and so I understand the need to develop a "ad hoc" script system that could be easier to use especially for non-developers.

But with modern script languages I think this is not a requirement anymore...

Btw I speak as a guy that knows clonk scripting language and still doesn't know python or ruby (plan to learn them in the next weeks), but I think that I wouldn't mind the transition if than would achieve a better overall project.
At the end I am approaching python now and I have the feeling that in a couple of days I already know it quite well (ok I knew many other programming languages, but if you know c-syntax like clonk scripts it's really easy to switch anyway...)

For modders all they have to learn (and it would be a good thing to do anyway i think) is a bit of object oriented programming (if they want to use it), for the rest the transtition would be almost harmless...
Reply
Parent - - By Enrique [de] Date 2009-04-16 11:59
Well sorry if i misunderstood you, but the clonk scripts are in my opinion easierer than other scriptsystems, so newbies can easilier grow up to developers. Well getting good international developers by using another scriptlanguage may help to build the engine, but it would decrease all the count of released objects on the ccan. As many other people, the first scriptlanguage i learned was c4s. Now, where it should changed, i would stopping developing. For me, it would be very hard, and annoying, to change my nearly finished scripts to another scriptlanguage.
Reply
Parent - By MastroLindo Date 2009-04-16 13:31
the point is that c4s developed being a really really easy and simple language, and then developed in time (arrays, and so on).

If you would also introduce oop inside it, it would be almost equivalent to any scripter language out there. If you know it, it would damned easy to learn languages like python or ruby. If you have to plan something for a wide community, you could consider making the effort to switch to a general language script easier than a lot of people that already knows it to switch to c4s. All the goto and timers structure makes thing harder, not easier for a general programmer imho.
And yes, c4s is fine and has already a lot that it is needed (apart oop), but as i said, I don't see a lot of reasons why keep developing a specific scripting language when there are huge projects already done, with a large community supporting their users. Switching to python/ruby or similar would just make it more maintanable in the long run..

Anyway if you look at the actual state of things, I agree that c4s is enough and that is anyway easy. Just had this idea because i introduced clonk to a friend of mine that is in the gaming industry since 3/4 years (worked for codemasters, sega, and now crytek) told me that in his opinion a general scripting language was a clever choice for many reasons, and I just answered him that c4s was developed since a lot of years and now it was used because ppl got used to it.

But this motivation can be put in discussion if you think about a brand new title, so that's the reason I started the discussion... Anyway I am quite confident that any c4s developer could switch to a python interface in a couple of days of study.... not such a big effort... at least speaking for myself of course..
Reply
Parent - - By Carli [de] Date 2009-04-16 14:30
btw you should abolish case sensitivity. that was what frustrated me most.
Parent - - By ArneB Date 2009-04-16 19:40
Actually, please don't. In my opinion, this is a pretty horrible idea.
Parent - By Caesar [de] Date 2009-04-16 20:42
Ohfullack!
Parent - - By MrBeast [de] Date 2009-04-17 15:15
Are you crazy? CaseSensitivity make the code much more readable.
Reply
Parent - - By Carli [de] Date 2009-04-17 15:29
but it frustrates those who use more case insensitive languages
Parent - - By MrBeast [de] Date 2009-04-17 15:46
Then these people learn at least to not write allways small ;)
Reply
Parent - By Carli [de] Date 2009-04-17 15:50
you could for example add the information: "c4script is case sensitive!"
Parent - - By Caesar [de] Date 2009-04-17 16:35
Hm, isn't VB case sensitive, but the editor always corrects case faults?
Parent - - By Carli [de] Date 2009-04-17 16:40
good idea. but clonk has no integrated editor.
Parent - - By Caesar [de] Date 2009-04-17 16:55
Well, a post-editing script would be sufficient.
Parent - By Carli [de] Date 2009-04-18 13:45
that would lead to the same result like a case-insensitive compiler
Parent - By Fireknight [ch] Date 2009-04-17 18:01
No, the compiler is case insensitive.
Reply
Parent - - By Caesar [de] Date 2009-04-16 13:30
We have classes and instances, we have Ctors and Dtors, and I can't get why you concern C4Script as hard to learn.
Parent - By MastroLindo Date 2009-04-16 13:33
just replied about my reasons...

don't take it as an attack to c4s.. i already use it and I agree it's ok for the actual state of things.

I just don't find it very strong and reliable in some core features, like the goto, the built timers, etc...

but as I said i just want to know ppl's ideas... I am not saying that changing it is a critical point.. just an idea :p
Reply
Parent - - By Anonymous [de] Date 2009-04-16 14:03

> You always have {} for blocks ... and a semicolon at the end of every statement


Not in Python, though. ;)
Reply
Parent - By Caesar [de] Date 2009-04-16 14:20
Uhm, yes, I did only one day of python, and this is quite long ago...
Parent - - By Kanibal [de] Date 2009-04-16 12:32 Edited 2009-04-16 14:26
In my opinion, c4script is great. It's easy to learn, has got an easy syntax etc.
Reply
Parent - - By Carli [de] Date 2009-04-16 13:01
[deleted]
Parent - By Kanibal [de] Date 2009-04-16 14:26
Sorry, mistake.
Reply
Parent - - By Günther [de] Date 2009-04-16 12:54
Unfortunately, Python is out because it has insurmountable security problems if you want to execute random scripts from strangers. I don't know about Ruby. Lua might be an option. If somebody were to provide a patch in that direction, we will have to seriously consider applying it. But I'm not going to write one myself, I have too much fun working on C4Script. As a computer science student I'm allowed to ;-)
Reply
Parent - - By Carli [de] Date 2009-04-16 12:59
i would keep c4scripts, maybe widen it a bit and call it c5scripts, implementing oop and floats.... but no other script language (or does anyone think sth else?)
Parent - - By Newton [es] Date 2009-04-16 13:11
If someone implements Sven2's idea on the bugtracker to use OOP for C4Script, one could call it c4script++ ;-)
Parent - - By Carli [de] Date 2009-04-16 14:33
an other alternative was to use precompiled files: you can write clonk scripts in your mother tongue (pascal, basic, c++, any other....) and generate a precompiled bytecode that is linked to the engine. it also saves loading time. there could be also a way to implement x86-opcodes instead of bytecode (demo: hello world in assembler used as linked script SVN http://opensvn.csie.org/CompilingTools)
Parent - - By Newton [es] Date 2009-04-16 15:01
yay, Clonk goes closed source! I think this is exactly the development we should favour... O_o
Parent - - By Carli [de] Date 2009-04-16 15:04
precompiled<>closed source. in my developed format example are debug symbols which can be used to get source code back.
It's possible to disassemble end regenerate scriptgode again, too
Parent - By Anonymous [de] Date 2009-04-22 23:22
If someone wanted to post "closed source" precompiled blobs, they could likely strip the debug symbols, I do not think the engine could do anything about that.
Reply
Parent - - By Fireknight [ch] Date 2009-04-16 21:57
Yeah, thats 100% no security risk... ;)
Reply
Parent - By Anonymous [de] Date 2009-04-22 23:21
"Bytecode" environments like Java and the .NET runtime generally get the sandboxing thing right. Java applets seem to work well enough to that effect, but I would not want to unleash Java on even the Clonk community. I am not aware whether the code security part of the CLI is implemented in Mono, but since the Mono project is implementing Silverlight, they are basically going to have to do it anyway.
Reply
Parent - By Anonymous [de] Date 2009-04-22 23:28
Giving everybody the ability to program in their favourite language seems to be a problem rather than an advantage. Given a single scripting language, a competent developer would be able to pick apart pretty much everybody's scripts in order to borrow code for her own project, fix bugs or add enhancements. If everybody broke out their obscure pet language of the week, most of the "codebase" will be essentially unmaintainable.

That is not to say that there are not advantages to be gained from using a third-party byte code engine. The project could profit from the effort that enterprise-level virtual machines have put into optimisation, scalability and security. I would imagine that if the scripting engine was moving into this direction, at least the core packages would stick to a single language by convention, anyway.

Using x86 opcodes sounds like a horrible plan that kills portability, binary-compatibility and just-in-time optimisations.
Reply
Parent - - By Fireknight [ch] Date 2009-04-16 21:55
I don't see why Clonk needs OOP? You've got the definiton calls and the object calls. I think that should be enough and I've no idea of any case where OOP in Clonk would be useful.
Reply
Parent - By Newton [es] Date 2009-04-16 23:09
For proper inheritance for example.
Parent - - By Anonymous [us] Date 2009-04-17 00:36
Quite a lot of things. Cosider Effects, for example. Right now, you need to access local effect variables using awkward EffectVars. GetEffect().varname would be much better. Another example: per-player-variables. Right now, e.g. to count relaunches, you need to create arrays for each variable and keep them updated for player joins/removals. GetOwner().relaunches; would be much more convenient.
Reply
Parent - By Fireknight [ch] Date 2009-04-17 11:03
Well
func & GetRelaunchesByPlayer(iP) { return a[iP] };
GetRelaunchesByPlayer(GetOwner())++; GetRelaunchesByPlayer(GetOwner())--;

Shouldn't be that inconvenient. You could also write dummy objects for those EffectVars. But of course,
if Clonk would support 'real' OOP I've nothing to say against it.
Reply
Parent - - By MastroLindo Date 2009-04-17 08:36
apart from what they just said and that I agree upon, don't underestimate the style of code.

Yes c4s can do almost everything a modder or developer might need. But keeping the code styling coherent with the normal style of code used in every other software project that uses normal scripting languages, could really make the code more readable, easier to upgrade and to mantain. New people that comes from other project could get what the code does in just a quick look at it. Yes its true, learning c4s just takes a few days. But switching from c4s to for example python (even if as said by gunther maybe there are better choices) would take like 50 people switch to python (that is a language that is useful to know anyway for thousands of other projects). Switching from python (or other) to c4s for new developers could take hundreds of people to learn a specific language that apart from clonk is completely useless.

Moreover apart from the clonk core community other developers might have experience of YEARS with such scripting language, making their work faster and higher in quality.

There are huge reasons for the switch in my opinion. Inheritance, stlyle, public libraries, and so on. One can say (like people in this thread) that it is not a priority or that is not easy to find the best script language for the task, or that the switch would take too much time and remove efforts in other fields (like the main engine).

But you can't say that there are not advantages...most of all when you look at the long term and not stay in the blind condition of just saying "i have learned scripting clonk with c4s so it's the best language" because that is not an argumentation, it just take in account a personal experience instead of thinking at the design level which is the easier, higher quality, most reliable, most documented language.

And also the switch from c4s to another language, if you mantain the names of the engine functions, would be reaaaaaaally fast (for users..of course it's not that fast to implement the new language in clonk)
Reply
Parent - - By Fireknight [ch] Date 2009-04-17 11:06

>i have learned scripting clonk with c4s so it's the best language


I'm speaking much more languages than C4S (including Python), so that's not my point.

In Clonk we already have Objects (created from Definitions) and wouldn't it be a bit complicated if there would be an other kind of objects?
Reply
Parent - By Anonymous [de] Date 2009-04-22 23:39
It should be possible to integrate the existing Clonk objects with another language's object system. Javascript code seems generally well-integrated with the host environment, and the web browser interface, the DOM object hierarchy and services do not really feel like "another kind of objects". It should not be a problem at all to wrap Clonk objects into your favourite dynamic language's objects, and even a traditionally static language like C# should be able to compile against an interface generated from Clonk object definitions.

The advantage is that objects could be used for data structures where regular Clonk engine objects come with too much semantic game mechanics baggage, or are plain too heavy-weight. Lua or javascript can easily express a lot of things in their respective nested associative arrays that would not easily be possible in C4Script if at all, for example.
Reply
Parent - By Kanibal [de] Date 2009-04-17 18:34
ACK.
Reply
Parent - - By Loriel Date 2009-04-24 18:24

> Lua might be an option.


I was looking around a bit and http://lua-users.org/lists/lua-l/2000-11/msg00021.html suggests that disabling floating point numbers is rather simple, fwiw.
Parent - By Zapper [de] Date 2009-04-24 18:41
I'm planning to use Lua for one of my own projects but I wouldn't really say that it is "better" than C4Script. I would rather say that the syntax of C4Script is even "better".
And if you want to have OOP Lua wouldn't be very great as well since you can only achieve OOP fooling around with the functionality of lists in Lua. (Or you can use luabind, I think it understands some OOP)
Parent - By henry [de] Date 2009-04-25 09:55
I had to use Lua, when I made a Mod for Gusanos (a Liero-Clone),
but (like Zapper) I don't like the syntax. :I
Up Topic General / Feedback and Ideas / switching script language

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill