Archived

This topic is now archived and is closed to further replies.

whimage13

Need help with creating a Scripting engine?

Recommended Posts

I am pretty need new to game programming. I am presently working on a 2d tile-based RPG, just as a start. I have the tile engine, basically finished but I just can''t get a good enough understanding of creating a scripting engine. Any help would be greatly appreciated. Thank you.

Share this post


Link to post
Share on other sites
there are some tutorials on gamedev.net, and several others will pop up in a search engine...
what language are you using? i just finished(?) the scripting engine for my game, in visual basic... it isn''t fast, but it can handle some pretty complex scripts...

--- krez (krezisback@aol.com)

Share this post


Link to post
Share on other sites
Maybe you can use an existing engine? Mozillas java-script engine (SpiderMonkey) is nice. http://www.mozilla.org/js/spidermonkey/

Share this post


Link to post
Share on other sites
I recently wrote a compiled psudo-assembly scripting engine that could run faster than VB code =).

Z.

Share this post


Link to post
Share on other sites
I heartily recommend using Scheme. GUILE is a free (GPL, or maybe LGPL) implementation specifically designed for scripting. I think it''s available for Windows...

Signatures? We don''t need no steenking signatures!

Share this post


Link to post
Share on other sites
I thank you for the suggestions. I using C to program this game and I am trying to stay away from hardcoding anything that I might have to change later.
I have looked at several possible scripting engines but most don''t have enough functionality. I haven''t looked into mozilla''s so at least there is another possible option. I''m looking at any that I could implement without to much of a headache, but than I can''t have everything can I.

Share this post


Link to post
Share on other sites
The ideal, of course, would be swappable scripting engines, meaning a person could just drop a scripting engine that conformed to certain guidelines (even for a language that hasn''t yet been developed) into th application and script away in a familiar context.

It''s been done, but I''m too unconcerned to dig up the link.



I wanna work for Microsoft!

Share this post


Link to post
Share on other sites
Microsoft provide a - you guessed it - Windows only swappable scripting engine called Windows Script. Plugging this engine into you app allows you to write scripts in VBScript, JScript, or any other Windows Script compatible language. Microsoft provide a free ActiveX control that wraps the engine, its easy to use, and can be quite powerful if you expose your application objects as ActiveX objects. You can even use the Microsoft''s script debugger to debug your scripts.

http://www.microsoft.com/scripting

Share this post


Link to post
Share on other sites
I suspect you are just looking at it wrong. Perhaps it isn''t that they lack functionality you need as much as that you are going about it wrong. When the square peg doesn''t fit in the round hole then perhaps you should find a round peg or perhaps you should just stick the square peg in the square hole. I personally have trouble seeing how someone could make Blade of Darkness almost completely in Python, but you can''t move a camera using it. You are going to have to explain that one to me before I can understand it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Python is yet another possibility. QUARK, the quake editor, uses it among others.

Share this post


Link to post
Share on other sites
If you are only trying to not hardcode data into your application, scripting is not the way to go. Use text (or binary) files, to load the data into the application at run time. It will save you lots of time, and pain =).

Z.

Share this post


Link to post
Share on other sites
i try use Python (for write script) embed in my RPG. But i difficult to find some Python/C tutorials, samples.
I Don''t know how to start It.

Could you give me some useful python website? Thanks.

Terence Mok



Share this post


Link to post
Share on other sites
The Python site is here. I imagine that is where you got Python at though. On that site is a document called Extending and Embedding the Python Interpreter. It walks you through all the basics needed to get started. There is also another document called Python/C API Reference Manual. It gives you a more detailed explaination of the actual calls and data types.

Most likely you have aleady found all that. If so then I would say it is most likely your approach. Just jumping in and embedding it right off the bat is a bad idea. Rather you should play with it a bit. If you know OpenGL then try the PyOpenGL. I assume you know Windows so PythonWin would be another extension to play with. It takes a little searching but you can find quite a few interesting extensions. That gives you an idea of how your script interacts with an extension. Embedding Python is mainly about extending Python. You call a script and the script calls functions in your program. Extensions such as PythonWin are extremely complex so you get limited benefit from actually digging through it. Rather you use your knowledge of Windows or OpenGL to make sense of what is going on.

Once you have a handle on using Python and extensions for it work on create a small library of scripts. The user can''t tell the differance between calling another script and calling some function you wrote in C. There is more work involved in coding your function in C though. So you want to get the big picture first. Once you have a feel for the ins and outs of how you might call a function convert it to C as an extension. Embedding Python is mainly about extending it. The only real differance is that instead of the operating system invoking the interpreter you invoke it. Figuring out how to embed it effectively is a litle more involved. That is mainly an application design issue though.

Overall it takes time. If you have no related experience then it may take anywhere from a month to three months to get a handle on it. You won''t be an expert, but you will know more than most. You can certainly spin your wheels much longer if you don''t break it down into small steps that are each fairly simple. It would be like jumping into Windows and trying to figure out how to do inplace editing right off the bat instead of first learning how to create a window. It is simple once you have all the pre-requist knowledge. Once you know how to do it and do it a couple of times it takes no more than a day. Use cut and paste or a library and it can be minutes. That is what makes it a simple task. Learning how is not a simple task. The good thing is that once you do it with one scripting engine the next one is far easier. Instead of a month to three months it becomes a week to a month depending on how dramatic the differances.

Share this post


Link to post
Share on other sites
Thank you suggestion. Then i discover very good sample about script engine of RPG (embed python) c program.

http://www.vex.net/parnassus/apyllo.py?i=580372690
thank author

but test.py need modify

from std import *
from pi import textbox
import system
from pi import party

Share this post


Link to post
Share on other sites