Say I'm making this big game in C# with XNA.

What options do I have to include a scripting feature to my code base?

  • 2
    \$\begingroup\$ What features, specifically, of a scripting engine do you actually need? The vast majority of things a scripting engine gives you are already available in C#. \$\endgroup\$ Sep 28 '10 at 7:31
  • \$\begingroup\$ Basically, I'm thinking to make something like a GUI base XNA game maker. So you use this game maker and access my C# classes and functions from script to implement game play. \$\endgroup\$
    – astk
    Sep 28 '10 at 8:06
  • 1
    \$\begingroup\$ Who's the end user? Is this something like Klik & Play (children, hobbyists)? Or is it more like Unreal Kismet (artists and designers)? Or something different? \$\endgroup\$ Sep 28 '10 at 13:00
  • \$\begingroup\$ Let's say like Game Maker. While it allows to implement any game mechanic, it still OK to Klik and Play. It doesn't need to have visual script editor like Kismet. \$\endgroup\$
    – astk
    Sep 29 '10 at 2:39
  • \$\begingroup\$ That is very different to the question that you have asked. Perhaps try asking another one that better explains your requirements. Or take my short answer, which is: use C# delegates as the basis of a system that can treat functions like objects. Use those objects to build a GUI system, or expose the system to advanced end users via C# as described in my answer. \$\endgroup\$ Sep 29 '10 at 6:00

I advocate not using a scripting language in C#. C# is already solves the vast majority of problems that a scripting engine is used to solve. Just use C# in the way you would use a scripting language.

Because I've been over this several times before, here is some reading material for you:

UPDATE: If you want a live-editing workflow, try this cheeky method for using Edit and Continue.


If you plan on targeting the XBox360 or Windows Phone 7, then your options are limited. Those platforms do not support runtime code generation, so your only option would be an interpreted language. I would recommend steering clear of interpreted languages, as their performance tends to range from "sub-par" to "abysmal".

If you are only targeting Windows, and you really need/want a scripting language, then have a look at IronPython or IronRuby. Both target the DLR and perform very well (for being dynamic languages).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.