Advertisement

C# as Script Language

Started by October 20, 2003 05:37 AM
4 comments, last by Hawkins8 21 years, 3 months ago
Anyone has tried out to use C# as script language to a C# game engine. Do you have any idea on how to do this? Thanks.
quote:
Original post by Hawkins8
Anyone has tried out to use C# as script language to a C# game engine. Do you have any idea on how to do this?

Thanks.


I''ve never done this but the .net framework has the compiler built in. You can just have your game engine pass it valid C# code and spit out a dll. Here is an article on how to use the compiler. Good luck!

http://www.c-sharpcorner.com/Code/2003/Feb/RuntimeCompiler.asp
Advertisement
Look for "Hosting the Common Language Runtime" in the .NET documentation, here you should find the information needed.
Using C# for scripting is AMAZING to say the least. I have worked with it for small plugin type components which I scripted for a few applications at work.

You basically use a combination of reflection and the CodeDom compiling. This allows you to easily build in a scripting engine using C#.

You basically call the JIT to compile the script at run-time and use reflection as it was part of the .dll

I could post some URLs if you are further interested in this method.
I''m interested.
ok here's some links:

http://www.ingorammer.com/conferences/windev2003/WINDEV_Scripting_IngoRammer.pdf

http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=118

and I have a few others I'll have to boot my other system and grab em.


EDIT: The second link is probably the best read regarding the subject.

[edited by - Imperil on November 4, 2003 5:52:35 PM]

This topic is closed to new replies.

Advertisement