compiling C# Scripts at runtime

Started by
3 comments, last by ShotgunNinja 16 years, 11 months ago
Greetings Gamedev members! I have used C# for a little over a year now and have a MUD styled game engine that includes a complete GUI based tool set to create objects and environments for the game. I am wanting to include a C# scripting language that allows developers to write scripts in C# and then during runtime the engine would compile the script into memory and execute it. Is this possible? When I asked on the MSDN forums I was told that the scripts can only be compiled into binary code, but this is incorrect according to the MSDN included with C# Express. Has anyone done anything like this? Would it be simpler for me to integrate an existing programing language (like Lua) for my engine to use? If so, how would I go about doing so? Thanks alot for any help or advice you guys provide! Scionwest
Advertisement
Yes, it is quite possible.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Nice! Thanks for the reply, I did some searchs on here as well and found some good information. I will be giving the mdxInfo.com library a shot tonight and see how it works.
The only thing I am confused about is people talk about sandboxing your code. If it is 'sandboxed' can the script and my C# application pass information back and forth from each other? What if I have an NPC that is loaded by my C# library and updated in my game loop, but it's actions are all within the C# script. I would need to retrieve all of the NPC variables that have it's location and actions from within the script and apply to my NPC class within the engine on my next loop.
Is that possible?

Thanks again,
Scionwest
As Washu said, it is quite possible. Quite easily possible. But I am not too good at C#, I personally prefer premade game engines better. But good luck, and keep at it!
Hehe, bad grammar.

This topic is closed to new replies.

Advertisement