Recommend a scripting language? (to use with C/++)

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
User avatar
GyroVorbis
Elysian Shadows Developer
Elysian Shadows Developer
Posts: 1874
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Mon Mar 22, 2004 4:55 pm
Location: #%^&*!!!11one Super Sonic
Has thanked: 81 times
Been thanked: 64 times
Contact:

Recommend a scripting language? (to use with C/++)

Post by GyroVorbis »

I'm looking for a scripting language that'll run on the DC and can easily cooperate with C/++. I'm working on Null and I'm interested in using a scripting language for some things that might be tedious in a lower level language.

I'm fluent with Perl, but I haven't been able to find any realistic way to cooperate Perl with C and C++. I've read about libperl++, but I can't find it anywhere online (not even CPAN seems to have it). Every other way I've seen involves a deep knowledge of perl's inner workings and is just plain a pain in the butt.

I've heard good things about lua and ruby. Would anybody recommend either of them? Anybody have any experience with calling perl subroutines and passing data between perl and C++?

Thanks in advance.
Strapping Scherzo
DC Developer
DC Developer
Posts: 2285
Joined: Fri Feb 21, 2003 7:37 am
Location: Chicago, IL
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Strapping Scherzo »

I've already ported a JavaScript engine to DC that I'm using to do all the GUI in the upcoming NesterDC SE. It's a port of KJS, the JavaScript engine from Konquerer. Of course, I haven't yet released it yet. I plan on making an official release shortly after NesterDC SE and it'll be called DreamScript.

It's actually quite functional right now and not slow like I thought it would be. If you really need it now, I could give you what I have. It's easy to expose function, objects, and classes to the script. I've already implemented image, sprite, music, file system, and font classes.

If you're interested, let me know.
Image
GPF
DC Developer
DC Developer
Posts: 529
Joined: Wed Oct 17, 2001 7:44 pm
Location: Texas
Has thanked: 0
Been thanked: 0
Contact:

Post by GPF »

there is lua under kos-ports since at least kos 1.19, if not earlier

Troy
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5666
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Post by BlueCrab »

Lua works wonderfully. I use it for a lot of stuff (like the actual game logic and such) in ljsdcdev Demo 7 (ljsdcdev Engine 0.9.0).

I would, however, recommend that if you're gonna use lua, upgrade the version in KOS to 5.0.x, its included with ljsdcdev Engine 0.9.0, if you don't wanna figure out how to get it to compile for you. Lua's also easy to integrate in with C++ code, especially with tools like tolua++ and such.
quarn
DC Developer
DC Developer
Posts: 80
Joined: Wed Oct 17, 2001 7:44 pm
Location: Sweden
Has thanked: 0
Been thanked: 1 time

Post by quarn »

I suggest AngelScript. The interopability with C++ is fantastic. You do not have to write any wrapper-functions and you can register object methods, variables and everything directly.
Strapping Scherzo
DC Developer
DC Developer
Posts: 2285
Joined: Fri Feb 21, 2003 7:37 am
Location: Chicago, IL
Has thanked: 0
Been thanked: 1 time
Contact:

Post by Strapping Scherzo »

quarn wrote:I suggest AngelScript. The interopability with C++ is fantastic. You do not have to write any wrapper-functions and you can register object methods, variables and everything directly.
I never heard of that. Looks like it's well thought out though. I wonder how the speed is compared to KJS. I'm guessing it's faster.
Image
User avatar
chronofurb
DCEmu Freak
DCEmu Freak
Posts: 79
Joined: Wed Jan 07, 2004 11:33 pm
Location: Earth
Has thanked: 0
Been thanked: 0

Post by chronofurb »

also, python shouldnt be too bad, I know you can include the interpreter with a full distribution, as long as you set up the environment vars, python is a little bigger, but more robust, I dunno if anyone has tried it yet, maybe it is impossible, but it shouldnt be...
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

I have a BASIC interpreter, but it's a pain to actually get it to do anything useful, and it's not that easy to integrate into something else (I had to build my entire thing around the BASIC interpreter), so I'm not recommending that. Then again, it was never intended as a scripting language, so I suppose I can forgive it for that.

I'd have to recommend Lua, Ruby or Angelscript. They all make pretty good scripting languages. Just try them out, and see which one(s) you like. Personally, I quite like Ruby, although I've not actually used it as a scripting language yet.
I wonder how the speed is compared to KJS. I'm guessing it's faster.
Probably. KJS is definitely not known for it's speed. It's used in the web browser I'm using (Konqueror), and it definitely slows down a lot on pages that use a lot of JavaScript.

I wonder if Mozilla's JavaScript interpreter (SpiderMonkey would be portable to the DC? It's not as well designed as KJS, and likely isn't as easy to build stuff on top of, but it's a hell of a lot faster, and apparently is written in plain C. I don't know how it fares for memory usage though.
User avatar
GyroVorbis
Elysian Shadows Developer
Elysian Shadows Developer
Posts: 1874
Joined: Mon Mar 22, 2004 4:55 pm
Location: #%^&*!!!11one Super Sonic
Has thanked: 81 times
Been thanked: 64 times
Contact:

Post by GyroVorbis »

Yeah, I think I'll try several out over the summer (just a few more weeks!) and use my personal preference.

I'd like something that I can stick with, and I just don't have time to experiment with them now. Final exams are coming up so I won't even have time to do anything. But then after that is summer break so... yeah.
User avatar
chronofurb
DCEmu Freak
DCEmu Freak
Posts: 79
Joined: Wed Jan 07, 2004 11:33 pm
Location: Earth
Has thanked: 0
Been thanked: 0

Post by chronofurb »

also python has something called swig for class generating, if you program is heavily dependent on classes, you could do something on a smaller scale similar to unreal script, just depends on how indepth you need to go.
Post Reply