Forum

> > CS2D > General > [Java] Making CS2D scripts in Java
Forums overviewCS2D overviewGeneral overviewLog in to reply

English [Java] Making CS2D scripts in Java

16 replies
To the start Previous 1 Next To the start

Poll Poll

Are you a Java developer and would you try the project?

Only registered users are allowed to vote
I'm developer, I want to try it.
16.67% (4)
I'm developer but not interested.
29.17% (7)
I'm not a Java developer
54.17% (13)
24 votes cast

old Poll [Java] Making CS2D scripts in Java

ImCloudy
User Off Offline

Quote
Hello guys,

I would like to ask, if there are any Java developers. I used to make CS2D scripts a long time and well, honestly, I don't like LUA.
I've got an idea to make Java library and exporter for CS2D LUA scripts.

Since Java is programming language and LUA is scripting one, library won't be that hard, but the translation maybe.

Every opinion is appreciated.

old Re: [Java] Making CS2D scripts in Java

DC
Admin Off Offline

Quote
I'm using Java professionally but I don't see any big benefit which would justify the efforts required to implement this project.

The idea of using Lua is to have a lightweight scripting language which allows you to quickly write stuff. Java is more strict and more explicit. This is good for big projects which need to be stable but it also means you have to write a bit more code. You can implement the same stuff quicker with Lua than you could with Java.

So in my opinion it doesn't make much sense to try to write a Java to Lua converter for CS2D. I do however understand that some people prefer certain programming languages and I do agree that Lua is a bit... special. Which is a good and a bad thing at the same time.

old Re: [Java] Making CS2D scripts in Java

ImCloudy
User Off Offline

Quote
I got it. Well. Probably making my own Lua IDE is alot better than making any converter. More people would use IDE with autocomplete and text highlighting than using a Java.

Thanks for opinion.

old Re: [Java] Making CS2D scripts in Java

Avo
User Off Offline

Quote
user DC has written
and I do agree that Lua is a bit... special. Which is a good and a bad thing at the same time.

What do you mean by that? And by the way, I was always curious; why you've chosen lua, not python for example.

old Re: [Java] Making CS2D scripts in Java

ImCloudy
User Off Offline

Quote
user Avo has written
user DC has written
and I do agree that Lua is a bit... special. Which is a good and a bad thing at the same time.

What do you mean by that? And by the way, I was always curious; why you've chosen lua, not python for example.


Well.. LUA is mostly used for scripting in games.
I've never seen Python in any game for scripting. Maybe pawn as well, but pawn is more known as C/C++ language, because its syntax is C.

old Re: [Java] Making CS2D scripts in Java

DC
Admin Off Offline

Quote
@user Avo: Like user ImCloudy Lua is very popular for scripting in games. Probably even the most popular game scripting language. This means many people already know it. Also it was easy to use with BlitzMax and therefore easy to implement in CS2D. Moreover it's fast and the Lua module is tiny in size and doesn't need much RAM either (unless you allocate a lot in your scripts but there's no way around that).

I did not want to say that Lua is bad. The opposite is the case. It is very powerful, fast and the tables are a very clever and super flexible approach. I'm glad that I chose it.

But the tables are also kind of special so you have to learn how they work first - even if you already know other scripting or programming languages. Also Lua has no real OOP and isn't very strict which can become a problem quickly when writing more complex things.

As mentioned before Java would be better for that. In most cases however scripts for CS2D are rather short and clear so Lua is certainly one of the best options.

old Re: [Java] Making CS2D scripts in Java

GeoB99
Moderator Off Offline

Quote
People whose their programming skills are scarce wouldn't grasp Java easily especially when you totally don't know at least the prime basics of C since the Java's syntax is based on C. So I'm kinda against this idea.

old Re: [Java] Making CS2D scripts in Java

VaiN
User Off Offline

Quote
I don't see any beneifit in trying to create a 'script' in a bulky programming language just to compile into Lua anyway. I'd prefer C# over Java personally, but even still, those are not scripting languages.

If you just want to be able to use classes and script in a more OOP-like way, check out moonscript. It's intended for that purpose, compiles to Lua, and might help scratch that itch if you just want something different.

JavaScript would be more reasonable than Java, but all you're doing at that point is adding more syntactic garbage to type for no gain.

Lua really is amazing as an embeeded scripting language, and does it's job very well. It's very lightweight, easy to learn, and doesn't have strict indenting like Python.

LuaJIT would take it a huge step further by being much faster and more powerful. It's sad that it didn't stick because it required people to fix their poorly written Lua scripts.

old Re: [Java] Making CS2D scripts in Java

Starkkz
Moderator Off Offline

Quote
As far as I know Java can be embedded to some applications, you could try to bind it somehow to a dynamic library module for Lua and run it from there.

old Re: [Java] Making CS2D scripts in Java

Vehk
User Off Offline

Quote
Can you tell us what it is that you don't like about Lua and what you like about Java?

Personally, I really like Lua and think it's probably the best pick for CS2D and a lot of games. It's simple and fast, but provides some powerful features: tables, metatables, lexical scoping, and coroutines. And it doesn't come with a lot of predefined libraries and functions that would be mostly useless to game scripting.

If you don't like the way that it's been implemented in CS2D there's at least a couple of projects to simplify it: thread cs2d Modding API and thread cs2d Extending native functions.

I can't imagine anything worst than using Java for CS2D (or anything for that matter ).

old Re: [Java] Making CS2D scripts in Java

Starkkz
Moderator Off Offline

Quote
@user Vehk: I think it's probably because of the amount of libraries and classes available, it makes coding much easier. Lua is good, however, it's restricted and there are more things you could do if you used Java.

For example, the multithreading support. You can't use threading in Lua because it doesn't give any feature that allows you to manage locks and stuff like that.

old Re: [Java] Making CS2D scripts in Java

Vehk
User Off Offline

Quote
@user Starkkz:
I know it's just an example, but how could having multithreading in Lua benefit CS2D scripts? I think if you need threading that coroutines would suffice.

Maybe you mean in the general sense of writing programs in Lua, in which case there are threading modules. If threading is important to your program Python might be a better choice.

I don't see what Lua is missing that would be important for it's use (embedded/extension), especially in the case of CS2D.

old Re: [Java] Making CS2D scripts in Java

Starkkz
Moderator Off Offline

Quote
@user Vehk: I did not mean threading in specific, threading was just an example of a case where having Java would probably be a benefit.

About python, I have had a hard time trying to develop stuff for my university on it. I didn't really like the syntax and the way you had to implement classes, I never got to know how to correctly import files inside folders, lists were complex for me to use.

That's just my subjective opinion, but I would only use this programming language if whenever I get a job I'm asked to.

Java has most data structures already implemented in it (binary trees, hash tables, linked lists, priority queues, queues, stacks, etc), so that I don't have to find on google some code that would do the same but in Lua.

Language features are also a important point, in Java you can design a for loop as you want it to work. In Lua you have to follow some standard
for i = 1, blabla
,
for a, b in pairs(blabla)
either way having your for loop calling a custom function.

And most important, because the way you're able to write classes in Java is pretty clean, in Lua you'd have to find a workaround because there's no standard for this (no specialized constructors, protected and private members, interfaces, etc).
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview