Would like suggestions for scripting

Started by
9 comments, last by wodinoneeye 12 years, 6 months ago
So as I've been working on various games in my time I feel like I should have a scripting tool / engine. My idea here ( and I mostly explain this through example because I'm not quite sure what I'm looking for ) is to have like a C# tool that lets you write scripts but I mean writing now why wouldn't I just like write them in a .txt and .... idk maybe someone here has an idea lol. The whole concept is to instead of mass producing .cpp's and classes or extending a CEnemy class to 500,000,000 lines of code to contain all the enemies AI and behaviors or even the same with like items in the game, have a scripting engine and tool to quickly and easily produce enemies and weapons. The game is being written in XNA and I'm basically looking for the most efficient way to do content creation that is not a million classes. I realize I said cpp earlier even though it's XNA but I hope in some way during this rant I've explained my problem that I'd love suggestions for. I want to write some sort of scripting engine for this because I believe that'd be the best way to create content but if I'm wrong someone please suggest something I'm all ears and would love to hear all suggestions. Sorry for the wall of text :(
Advertisement
Yeah, you idea is quite correct and I believe it's common used in the gaming industry. :)

But, why write your own script engine? You are wasting your time.
There are bunch of existing great script engine.
I recommend you have a look at Lua, it's popular in game development, and very simple to use, also simple to bind.
If you don't mind heavy script engine, I really like Javascript, there is great Google V8 engine (300K line of code though).

https://www.kbasm.com -- My personal website

https://github.com/wqking/eventpp  eventpp -- C++ library for event dispatcher and callback list

https://github.com/cpgf/cpgf  cpgf library -- free C++ open source library for reflection, serialization, script binding, callbacks, and meta data for OpenGL Box2D, SFML and Irrlicht.

Oh no absolutely not, I am by no means trying to write my own scripting engine. I'm not a big fan of reinventing the wheel. I'm wondering like what would be a good solution to the problem that is hundreds and hundreds enemies weapons obstacles and items in a game without having to hard code it all recompile every time and just generally suck in that aspect lol. Like if I wanted to write a fireball spell and actively test it without having to recompile the game what's the best direction to head in?
Data-driven design. Build code that can handle general case projectiles (launch, travel, payload, etc...) then feed the system data to represent a fireball, including fireball animations and a script to describe what happens when the fireball hits. Write code to instance a general monster, then feed it the data for a hundred thousand specific monster instances.

In a data-driven approach, you don't hard-code anything. Everything is representable as data, and the program simply operates on that data. One aspect of embedded scripting languages such as Lua, as far as data-driven is concerned, is the idea of code-as-data. Since the script is interpreted, entity behaviors can often be written as script code rather than hard-coded into the engine. The engine provides the hooks and such, the script provides the data that describes the behaviors in terms of the hooks into the code.
What would you say is the best Scripting language for such design, JTippetts? Well best scripting language ( or rather ease of implementation and use ) to get into an XNA engine?
I couldn't say, since I've never used XNA, and I don't use .NET. You'd be better off asking someone who does use them.
You've been helpful none-the-less, thanks ! That being said if anyone has been reading this and has a suggestion I'd love to hear it
Alright so what I hear is the problem is that XNA recompiles all files regardless of type at runtime anyways so even if I were to change a script the game would have to recompile. I guess with that being said is there any sort of solution that is the effectiveness of scripting that I'm looking for as described by JTippetts that works with XNA?
You can use Lua with C#. In fact a couple links on that search page point to an article here on gdnet
I was talking about using C# to make a tool to write scripts which would be exported into XNA, not scripting for a C# game. There is no real reason to write a tool in C# though, notepad works just fine I was just overthinking.

This topic is closed to new replies.

Advertisement