Jump to content
  • Advertisement

g0dwyn

Member
  • Content Count

    14
  • Joined

  • Last visited

Community Reputation

122 Neutral

About g0dwyn

  • Rank
    Member
  1. Hey all, I'm using LuaInterface, and I have a system that allows for simple Lua-defined effects to be rendered onto the screen. Parameters are generated by a separate piece of Lua code in the form of a table. This table is passed to C#-based effect creation code as a LuaTable object, where it is used for an Effect class's Lua script. The abridge Lua script for a sample Effect is as follows: [SOURCE] duration = paramtable["duration"] period = paramtable["period"] --... [/SOURCE][/source][/source] The C# Effect class is as follows: public class Effect { //The Lua script that will be executed. private string script; //The Lua state private Lua luastate; //... public Effect(LuaTable parameters) { luastate["paramtable"] = parameters; luastate.DoString(script); } } [/SOURCE][/source][/source] By using the debugger, I can confirm that 'parameters' is an instantiated LuaTable, and accessing it through the Immediate Window confirms that the variables are properly mapped to their respective keys. However, I receive LuaExceptions from the Lua state which say that 'paramtable' on the Lua side is a nil value. What am I doing wrong that is causing this error? Thanks much in advance. EDIT: All other CLR classes are being sent back and forth without any trouble. Only LuaTables are messing up. [Edited by - g0dwyn on April 14, 2010 12:30:34 PM]
  2. @OP: You are not wrong to learn C++, not by a long shot - it's still a very useful language in the industry, and I'm sure it will be for at least a few more years. You ARE wrong, however, to learn ONLY C++, or any single language for that matter. I wouldn't dream of using C++ for most of my day-job tasks. Conversely, I wouldn't dream of using Python (the day-job language) for some of my hobby tasks, which usually require C and assembly. Structure and Interpretation of Computer Programs, a uni course, requires the nigh-unparalleled flexibility of Scheme in order to learn basic programming concepts. And, of course, C++ is used in a number of games, which is something you seem to be interested in. So bottom line: learn C++, as long as it's one of many languages you end up learning. A good programmer isn't necessarily one who knows a language's API front and back; it's better to know when to use which language, and knowing how to construct good algorithms regardless of its implementation.
  3. I think this would be pretty easily implementable in C++ (and it's been done in Bay 12 Games's Dwarf Fortress). Create an extensible container for each object which contains some form of mnemonic token. At some point during run-time, your program reads through the tokens and performs whichever actions you want on it. The details, especially when and how you want the program to check for tokens, depends on what you need your software to do.
  4. g0dwyn

    Parsing Lines into Python Lists

    and yay tshrimp, who got an answer in 3 mins before I did :)
  5. g0dwyn

    Parsing Lines into Python Lists

    Oh, wait, nevermind, figured out my own question. Yayy, split command.
  6. Hey everyone, So this isn't ENTIRELY applicable to game development, but I figured that someone would be able to help me out anyway :) Right now I'm trying to write a program that reads a line from a data table, extracts the entries in said line, and puts them in a list. Each entry in the line is separated by '|' symbols. So the program should, for example take a line: 'foo'|'bar' and output a list like so: ['foo','bar'] I can hack something together with regular expressions, but surely there's a more elegant way to do this. Does anyone know of such an elegant way? Let me know when you get a chance, thanks!
  7. g0dwyn

    Epic clashes of armies

    I think the more important question isn't so much how to do it at this stage, but why you want it. Can you describe for us how the epic battles will factor into your gameplay? Depending on the role these battles will play in your game, it might be possible to either turn them into simple window dressing in the background, or some other such reduction in complexity that'll really save your system. Also, in response to battles running on old hardware: Rome Total War (released in 2004) ran well enough on my 2002-era computer, and it ran great on technology that was released closer to that point. It wasn't the prettiest game, really, but it was a hell of a lot of fun. And after all, that's what matters, yes? :)
  8. g0dwyn

    3D engine design book

    I recommend "3D Game Engine Design" and "3D Game Engine Architecture" by David Eberly (publisher: Morgan-Kaufmann). They're very dense and math heavy, and quite frankly Eberly can be a bit snotty and pedantic, but they go into great depth about the concepts behind real-time graphics engines. They're also quite up to date, and discuss more modern techniques (like pixel shading) that aren't found in older books. "Design" is very theoretical and consists mostly of the mathematical formulae behind graphics techniques, and "Architecture" leans towards coding and implementation, but they both ship with sample CDs and contain a respectable mix of actual C++ and higher-level maths. Plus, you can usually get both - my university's libary had them side by side on the stacks.
  9. g0dwyn

    N-ary tree woes

    I'm doing this to chart a grammar's derivations over time. Certain classes will derive from other classes, etc. I'd put it in CNF, but honestly I've never really felt that it gives a true enough form of what's actually happening. Maybe I should've put that information in my first post, oops.
  10. g0dwyn

    N-ary tree woes

    Ah, thank you! Now, is it possible to store a copy of this data, rather than just pointing to it?
  11. Hi everyone, So I'm trying to create a n-ary data tree. The tree is composed of TreeNodes, which store some sort of data. Each TreeNode has a vector of children; this allows me to have any number of children coming from a tree. What I'm trying to do is allow every TreeNode to have a unique type of data. My biggest problem so far is that using templates forces me to define a data type, when I have no clue about what kind of data will be there. This is what I have so far, and naturally it's not working: //BEGIN TREENODE DEFINITION template<class T> class TreeNode{ TreeNode *parent; vector<TreeNode*> child; //Make a vector of children T data; public: template<class T> void TreeNode<T>(TreeNode &parent, vector<TreeNode*> &child) {//constructor this.parent = parent; this.child = child; } }; //END TREENODE DEFINITION //BEGIN TREEMAP DEFINITION class NTree { TreeNode<T> root = new TreeNode<T> (NULL, new vector<TreeNode* child); //HELP! What if I don't want to define a data type just yet? int size; public: void NTree(TreeNode<T> root){}; //add, etc. down here... }; So, my questions are: *Is there a way I can allow each node to have a unique data type? *Can I delay type assignment until later on? Thanks much in advance. Take care!
  • 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!