Jump to content
  • Advertisement
Sign in to follow this  
Postie

Recommendations for scripting language for C# game

This topic is 1508 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi GameDevs!
 
I'd like some advice on adding a script language to my game project. I'm writing the game in C#, and am having trouble settling on a scripting language and appropriate implementation.
 
In my opinion, the two main contenders are Lua and Python. Lua seems more game oriented than Python, but Python is also used in non games development. My day job is writing business applications, so learning Python might give me some additional job skills.
 
My intention is to allow players to create mods for the game, so picking the more widely accepted option is probably best to get more involvement?
 
Based on this, I'm leaning towards Lua, though I'm still not 100% sure, and am open to convincing arguments in either direction. 

Share this post


Link to post
Share on other sites
Advertisement
AFAIK there aren't too many scripting languages built to plug into .NET (though there are probably 3rd party libraries to help with that)

While it might be overkill, have you considered using C# itself? You can compile arbitrary C# (or VB) code and run it directly using reflection.

Compiling C# programmatically. Just switch the compiler params to not generate an executable, generate in memory, and then, if you don't have errors, ask the results for the compiled assembly. You can then use reflection on the assembly to call methods, instantiate classes, etc.

Share this post


Link to post
Share on other sites

I've spent a few days looking into various implementations, and the two main contenders seem to be NLua and IronPython. I managed to get NLua up and running in about 10 minutes, and had it loading and executing a script shortly thereafter. IronPython just didn't want to play ball at all, so it seems like NLua is the way forward at this stage.

 

I considered the C# suggestion, SmkViper, but it seems like NLua can be more easily sandboxed, as you specify exactly what it has access to.

Share this post


Link to post
Share on other sites

I've spent a few days looking into various implementations, and the two main contenders seem to be NLua and IronPython. I managed to get NLua up and running in about 10 minutes, and had it loading and executing a script shortly thereafter. IronPython just didn't want to play ball at all, so it seems like NLua is the way forward at this stage.
 
I considered the C# suggestion, SmkViper, but it seems like NLua can be more easily sandboxed, as you specify exactly what it has access to.


Glad you found something that worked for you smile.png

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!