Jump to content

  • Log In with Google      Sign In   
  • Create Account

Scripting Languages ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
46 replies to this topic

#1 __ODIN__   Members   -  Reputation: 479

Like
Likes
Like

Posted 18 March 2002 - 01:17 PM

Hi, Guys; Just wanted to know what scripting language people are using for their projects ? Are you using an off-the-shelf tool (such as LUA), or are you rolling your own ? Thanks, Odin

Sponsor:

#2 LessBread   Moderators   -  Reputation: 1411

Like
Likes
Like

Posted 18 March 2002 - 01:38 PM

So far I''ve seen talk of LUA, Java, java-script and Python. And there are two recent articles on rolling your own that garnered some attention as well.

#3 __ODIN__   Members   -  Reputation: 479

Like
Likes
Like

Posted 18 March 2002 - 03:01 PM

I''ve used LUA (3.2) before, both for configuration and some simple runtime evaluations.

The main issue I had with it was the lack of execute-sleep-and -continue functionality (allowing me to run multiple non-threaded and non-blocking LUA scripts, or allowing me to pause a LUA script while waiting for some condition, such as arriving at the end of a path). Reading through the updated news pages on it, 4.1 Work 3 adds a Yield function, but it''s not yet totally stable...

So I''m checking around for alternatives =)

Odin

#4 LessBread   Moderators   -  Reputation: 1411

Like
Likes
Like

Posted 18 March 2002 - 05:20 PM

In that case, you might find this thread interesting

Java as a scripting language: using the JNI

Since this thread, I''ve seen Ziphnor praise java-script a number of times. Shaft was supposed to alert me regarding his java based system, but hasn''t yet.

#5 __ODIN__   Members   -  Reputation: 479

Like
Likes
Like

Posted 18 March 2002 - 09:23 PM

Interesting thread.

So in your own case.. do you use an existing scripting engine (JS ? Java?), or have you made your own.

Also, has anyone had a look at Pike ? It''s got some interesting semantics, and it''s nice and OOP, but the GPL is a turn-off..

Odin

#6 Box2020   Members   -  Reputation: 142

Like
Likes
Like

Posted 18 March 2002 - 09:32 PM

I''m curently looking at Ruby to see how easy it is to embed - some success so far but its not quite there yet.

#7 Ziphnor   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 March 2002 - 12:59 AM

quote:

I've seen Ziphnor praise java-script a number of times.



Hehe, i guess i have been, havent i
Anyway, what i like about it, is simply that its so damn uncomplicated to use.
I should point out though that im not passing objects from C++ -> JS or the other way. I send handles(int's) to the java-script which the script can use for calling functions on the native side. (so the script might call makeWindow(blabla) and this method returns a integer handle that can be used to call native functions on the window.
Also, the methods you want to expose to the java-scripts cant be member functions(afaik).
But if these things doesnt frighten you off, i think its a good place to start when looking for a script language. Java itself is properly better and is more powerful(classes can come in handy as templates for different types of scripts) but its also more complicated to use.

[edited by - ziphnor on March 19, 2002 8:00:02 AM]

#8 DaTroof   Members   -  Reputation: 162

Like
Likes
Like

Posted 19 March 2002 - 07:01 AM

I''m using TCL for scripting. So far, I have no complaints about it, although I might try rolling my own language as a learning experience.


#9 LessBread   Moderators   -  Reputation: 1411

Like
Likes
Like

Posted 19 March 2002 - 07:28 AM

quote:
Original post by __ODIN__
So in your own case.. do you use an existing scripting engine (JS ? Java?), or have you made your own.



In my case, I haven't implemented a scripting engine of any kind. However, when I get to that point, I will use java-script first because I already know how to use java-script.

This brings out another issue, how well known the scripting language is and whether that is a factor in your game at all. Javscript is well known (notice the hyphen that the forum board places in the word and that it's also lower case - that's a caution against unscrupulous posts - I didn't add the hyphen, and I capitalized the word at the start of this sentence too). Anyway...

// but the forum board doesn't check for mispellings
Javscript
java-script - this was J***script
java script


[edited by - lessbread on March 19, 2002 2:30:58 PM]

#10 Siebharinn   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 March 2002 - 12:40 PM

I''m using Python. It''s great.

Take care,
Bill

#11 Taulin   Members   -  Reputation: 100

Like
Likes
Like

Posted 19 March 2002 - 01:34 PM

I remember looking at the Vampire:Masq. stuff. Java script ran the game in a sense. However, I would more like my objects to use java-script and get manipulated by it. Ziphnor said you could not give java-script a callback to a class method?

I am curious, in a high level sense, how people are integrating their chosen scripting engines and making them interact with the rest of their world. I am sure this differs depending on which one you are using (java-script versus Python for example)

Thanks!

#12 __ODIN__   Members   -  Reputation: 479

Like
Likes
Like

Posted 19 March 2002 - 01:58 PM

quote:
Original post by Taulin

I am curious, in a high level sense, how people are integrating their chosen scripting engines and making them interact with the rest of their world. I am sure this differs depending on which one you are using (java-script versus Python for example)




Well..

I''ve rigged up a set of functions inside the LUA script that get called upon certain criteria. These are examples of an AI interface

OnReceiveDamage()
OnDealDamage()
OnSpotAvatar()
OnTick()
OnCreation()
OnDestruction()

OnSpotAvatar, for example, is called when the AI sees the player (comes into the LOS) for the first time.

I also expose a set of stub-functions for the scripts to interract with my C++ dataset. Typical examples would be:

GetPlayer() returns a DWORD pointer to a player
ReduceLife(int Life, DWORD player) decreases the life of player


What I can''t do with this system at present (to my eternal grief) is something like:

function OnSpotAvatar(int Player)
{
Say("Hail, "..GetName(iPlayer));
Say("Follow me to House");
GoTo("Tile_12_1"); -- ERROR : this will take a lot of time
Say("We''re here... ");
}

Because the script is blocking while trying to execute the goto. These type of scripts are pretty necessary for RPGs, though..

In general, LUA is very good, though. I think one solution might be to spin it off on a thread, but that will be a LOT of threads for a big RPG level.. Any suggestions ?

Thanks,
Odin

#13 RolandofGilead   Members   -  Reputation: 100

Like
Likes
Like

Posted 19 March 2002 - 05:53 PM

Is it possible to run more than one script at a time? If it is then I think you'll come up with something.

How about instead of GoTo, you have something like an Update or
better yet, SetDestination, that way when the computer comes back to processing that script, it will see if it is at Destination and if it isn't then it'll figure out which way to go and initiate Move(int Direction)?

[edited by - RolandofGilead on March 20, 2002 1:27:38 AM]

#14 __ODIN__   Members   -  Reputation: 479

Like
Likes
Like

Posted 19 March 2002 - 07:04 PM

Well.. the current system can have multiple VMs running concurrently, but it''s not time-sliced.

It''s of course possible to fake it, by setting a destination, and requesting the system to send you an event at arrival.. The main problem with this system is that you''re going from being a designer driven system, to becomming a programmer driven system.

My designers don''t wanna know about events, exceptions, or deferred execution. They just want to be able to write goto("Home"), and watch the little guy run across the terrain towards the spot marked "Home". For that we essentially need to pause the script until we reach the spot, and then continue execution in a linear manner..

Here''s how an event-based system will look.

function OnSpotPlayer()
say("Hi, come with me");
Goto("Home", -- To spot
"HOME_EVENT"); -- Send event when reached
end

function EventHandler(Event)
if (Event=="HOME_EVENT") then
say("We''re here");

....

end

this gets REALLY messy and hard to manage, compared to this

say("Hi, come with me");
Goto("Home"();
say("We''re here");


#15 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 19 March 2002 - 08:14 PM

Dude, make SetDestination a part of Goto, who said the designers needed to see it?
A script is exactly that. Designers use it.
A script enigne makes scripts run. Programmers make it.
More importantly, if this is an RPG, when things happen they always look like events.
What the hell are you doing for things like cutscenes and initiating conversations(from the game view, to progress the story, not like if a player walks up to somebody randomly and presses the talk button) and animations?
Also, what about other NPC movement, how is it handled, surely there must be other villagers idling about while this little bit of the script is going on?
I think of that programmer/designer focus of a script kind of as how much work do you put into it. You could on one end hard code it and your source would be your script all the way to making a script so natural that a writer could write a book and it would be translated into a game.


You the Programming God write
int Goto(place) {
SetDestination()
and whatever you want
}

The Designer writes
Goto(place);

#16 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 19 March 2002 - 08:26 PM

In other words, make the event handler part of the code, why would that even be in the script?
With the event handler you might be able to do the following,

game loop calls script
script calls code
script calls some more code
script calls event handler which is code
event handler calls script
which shouldn''t cause problems cause ultimately everything in the script appears as a line of code somwhere.

They don''t have to see any part of the script, even when an event is called the event handler itself could call a portion of script which the designers could then write out.

That''s what was talking about with the Move being called within Goto, RPG''s can use things like pathfinding too you know.

#17 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 20 March 2002 - 12:48 AM

why don''t you use the seerc scripting engine? (http://stud.elka.pw.edu.pl/~ppodsiad/seer/). i used it
on my adventure game some time ago (you write the script into
file and the interpreter reads and compiles it. then you can run
it whenever you want. very flexible.

#18 Kylotan   Moderators   -  Reputation: 3338

Like
Likes
Like

Posted 20 March 2002 - 07:46 AM

I think you people are missing ODIN''s main problem, which is that the script needs to run concurrently with the rest of the program, and perhaps other scripts, as the simple ''OnSpotAvatar'' example he gave would take a long time to execute, as it involves the character travelling a long distance. This is a real problem, and is why I''m not using Lua in my project.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

#19 __ODIN__   Members   -  Reputation: 479

Like
Likes
Like

Posted 20 March 2002 - 03:29 PM

quote:
Original post by Kylotan
I think you people are missing ODIN''s main problem, which is that the script needs to run concurrently with the rest of the program, and perhaps other scripts, as the simple ''OnSpotAvatar'' example he gave would take a long time to execute, as it involves the character travelling a long distance. This is a real problem, and is why I''m not using Lua in my project.



Thanks, Kylotan;

I''m sorry if I didn''t get the point across. In most cases, the game needs to run multiple concurrent scripts, with the ability to "step out of" the script while executing long-running C functions (Essentially allowing the rest of the program, such as the renderer and the tick loops to run).

I''ll check out http://stud.elka.pw.edu.pl/~ppodsiad/seer; maybe it''s a closer match to what I need... =)

Any other examples of script engines ppl have tried and tested would be usefull as well..

Thanks,
Odin



#20 LessBread   Moderators   -  Reputation: 1411

Like
Likes
Like

Posted 20 March 2002 - 03:34 PM

Kylotan, which scripting engine are you using? I think I missed that, at least I don''t recall. Thanks.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS