🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Scripting Languages ?

Started by
45 comments, last by __ODIN__ 22 years, 3 months ago
quote: Original post by Anonymous Poster
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.



Hi, AA..

how did you find the engine ? It seems to have been discontinued (no new updates since version 0.94a in 99)... Was it stable ? Any problems ?

Odin
------------------------------ BOOMZAPTry our latest game, Jewels of Cleopatra
Advertisement
i don''t remember how i found it, it was some years ago.
but it works, haven''t found any bugs (yet). you can also precompile the script into file and load it later. this means you can encrypt it if you want so no one can hack your game (if you don''t want)... and it''s free.
I am using Fles and Bison, Cygwin tools.

I have tried many others, and these seen the easiest
I am using Fles and Bison, Cygwin tools.

I have tried many others, and these seen the easiest
I am using Fles and Bison, Cygwin tools.

I have tried many others, and these seen the easiest
you don''t have to triple-post
I''m not using any scripting engine, as such. I wrote a very basic system myself that accommodates if/else blocks, and sleeping for a period of time. But there''s no real variable support, no scoping, no switch/case, no for loops, no whiles or repeat loops, etc.

Each script that runs allocates a new Context object. This is where the current line number and variables are stored. If it needs to sleep for a while, it stops executing but keeps hold of the Context object. When I wake it up, it continues from where it left off by continuing to use that Context object, and frees it when it terminates. There have to be lots of checks in the system as it''s possible that the targets of the variables could become invalid while a script is sleeping.

In the future I might try some sort of Flex/Bison thing, but I will have to see how easily I can incorporate the sleeping/yielding into that.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
quote: Original post by __ODIN__

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 can think of one possible solution. Let''s say you have a GameLoop function that updates ticks, renders, etc. You could write an extension to your scripting language that calls the GameLoop function. Here, I''ll call it DoEvents, since it''s similar to DoEvents in VB:


  Character.Goto("Home")Do Until (Character.Location == "Home") {    DoEvents}// etc.  


Thus, the GameLoop would still be executed while the script waits for the character to get home.

One obvious danger of this method: what if a second script gets triggered for the same character while the first one is still running? If so, you need to determine whether the first script should die or the second should get cancelled. Adding a counter to the Do loop might be a good idea, too, so if the guy doesn''t get home after a few minutes, he quits trying.

Anyway, I just thought I''d throw that idea out there. I suspect it would be a bear to implement, but any solution to this problem is likely to be non-trivial.
Post Extant Graphical MUD
So far all the tutorials I have seen are really crummy!

I made my own, its an interpreted bytecode, and changes the game by passing paramiters through external functions using ''registers''

Each class can run one script synchronosly (so no waste time loops, only timers). There is also a class to tie them all together and support the external interface and timers

I made the assembler and dissasembler in VB too
I can think of one possible solution. Let''s say you have a GameLoop function that updates ticks, renders, etc. You could write an extension to your scripting language that calls the GameLoop function. Here, I''ll call it DoEvents, since it''s similar to DoEvents in VB:

Thus, the GameLoop would still be executed while the script waits for the character to get home.

One obvious danger of this method: what if a second script gets triggered for the same character while the first one is still running? If so, you need to determine whether the first script should die or the second should get cancelled. Adding a counter to the Do loop might be a good idea, too, so if the guy doesn''t get home after a few minutes, he quits trying.



This sounds really dangerous, because in most cases you''ll want to have multiple scripts running concurrently. Your technique would either
a) only execute the tick of one of the scripts (freezing all the others).
or
b) Execute all scripts, snaking in and out of different scripts, and probably causing a stack-failure at the end of it..

If you only have one script running (controlling the UI, for example), the system does work, and I''ve used it before.. It''s not pretty, though..

Odin
------------------------------ BOOMZAPTry our latest game, Jewels of Cleopatra

This topic is closed to new replies.

Advertisement