Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm learning to create a game engine from scratch in XNA. I'm seeking examples of very small game engines, specifically the architecture and structure of source files, etc. It should include a scripting engine. Articles are also appreciated.

More specifically, I have a problem knowing how to connect the scripting engine to the rest of the game engine, like loading a models from the script.

share|improve this question

closed as not constructive by Byte56, Anko, bummzack, Josh Petrie, Tetrad May 27 '13 at 20:07

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Just out of interest, why do you need a scripting engine? C# itself already solves almost all of the problems a scripting engine is used to solve. And XNA is already a "very small game engine" that can load models. –  Andrew Russell Sep 5 '10 at 1:09
    
The guy who I'm working with said he wants a scripting engine so he doesn't have to recompile the game whenever something in the story changes. –  Shawn Mclean Sep 5 '10 at 2:27
    
Just so you know, there are pure C# solutions to that problem: stackoverflow.com/questions/1353456/… (the C# compiler is part of the runtime). –  Andrew Russell Sep 5 '10 at 3:21

2 Answers 2

up vote 1 down vote accepted

The Angel Engine is a very nice, small Open Source engine written in C++ and OpenGL. Plus it has a Python scripting interface. Although the engine is not written in C# it should give you a few pointers and ideas, and from the little I've played with it the code is very clean and easy to understand even if you're not totally up on C++.

share|improve this answer

I like the book Programming Role Playing Games with DirectX (2nd edition) for its scripting section; I haven't really seen a start-to-finish tutorial on making a scripting engine elsewhere. And of course, being a book, it will walk you through step-by-step creating the scripting part of the engine (and the whole rest of the game engine that he establishes throughout the book, of course). Unfortunately the source code isn't available online.

Once you have a scripting engine, I would keep separate the 3D models from the scripts. Scripts are typically in the logic side of things, while 3D models are most certainly the presentation/view side of things, and those shouldn't really be mixed. When a script commands a character to "walk to (3,5)", it doesn't need to say "load walking animation, set velocity to (-1,1), wait 3 seconds, set velocity to zero, load idle animation"; you'd typically just have a walkTo(x,y) function available to the script, and the intermediate code would take care of 3D models, animations, etc.

But hey, if you really need to, then define your own functions in your scripting interpreter which get 3D models and do whatever you need with them. I think you're thinking a bit too far ahead; worry first about writing a simple script interpreter, and then add the necessary functions to the interpreter as you're writing your scripts.

share|improve this answer
1  
+1 for the book. –  dierre Sep 5 '10 at 13:10

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