🎉 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!

C# as Script Language

Started by
4 comments, last by Hawkins8 20 years, 8 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.
Advertisement
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
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