Jump to content

Davaris

Members
  • Posts

    285
  • Joined

  • Last visited

Everything posted by Davaris

  1. My chief concern is standards, so people can use libraries they have built up without having to maintain different versions for different engines. However if the speed difference is as great as claimed, then I'd think again. As for C++, I've been there and done that and now I prefer languages that are easier and more enjoyable to use. Case in point, if Python wasn't so slow, I'd be using that instead of C#.
  2. I just looked up XNA and Vector3 is struct there as well. Anyway as I said above, for fundamentals like Vector3, Point, string, etc, it might be an idea to see what the consensus is on the popular 3D engines using C#. As most programmers have built up libraries and game code, they won't want to maintain two versions if LWs C# is the odd man out. Not that I am saying LW C# is the odd man out. The only ones I have checked is DirectX, Unity and XNA. EDIT: I just found this. Perhaps it is an argument for keeping Vector3 as a class? http://dotnetperls.com/static-constructor
  3. I'm thinking more in terms of assumptions people make, when they're building their games. With pass by value, or pass by reference, you can make changes to pass by value, without altering the original value. But if its pass by reference, then you alter the source. So if there is one standard used by other engines and we are the only ones doing something different, then it can isolate us - if you get my drift. Anyway I don't know how much of a big deal it is, when it comes to doing conversions. I guess it depends on how complex the game part of your engine is.
  4. http://unity3d.com/support/documentation/Manual/Plugins.html This is supposed to be pro only, but I have been told there is a way to do it with the free version.
  5. Not in C#. See my quote about the difference between class and struct.
  6. But this is C# not C++. Also who are you referring to MS, or Unity? DirectX can be used in C++ or C#. Unity can be used in C++ and C#.
  7. There must be a reason why Unity and Microsoft chose structs over classes. I just checked C# 3.0 Pocket Reference: At any rate you may want to investigate why they chose structs over classes, because MS and Unity hire the best of the best, so I assume there is a very good reason for why they both made the same decision. Anyway its up to you guys. I just thought I'd point it out.
  8. I just wanted to ask why Vector3 a class instead of a struct? The other C# engines I have worked with (DirectX, Unity) make them structs.
  9. Davaris

    Net Wars

    I really like the grid lines thing you have there. Michael Betke has something similar in his asset demos and it reminds me of pen and paper RPGs.
  10. Have a look through the Tutorials Josh has made available. Look in the Support section just under the banner.
  11. As long as it works in XML, that's fine by me. I am using what I assume is ToString to save and Parse when I'm loading. This is how I'm using it: // Saving XElement entry_list = header.Element("Entries"); entry_list.Add(new XElement("Entry", new XElement("Key", entry.Key), new XElement("Value", entry.Value), new XElement("Type", entry.Value.GetType().Name))); // Loading XElement key = x.Element("Key"); XElement value = x.Element("Value"); XElement type = x.Element("Type"); switch (type.Value) { case "String": mCurrSD.Put<string>(key.Value, (string)value.Value); break; case "Boolean": mCurrSD.Put<bool>(key.Value, bool.Parse(value.Value)); break; case "Int32": mCurrSD.Put<int>(key.Value, int.Parse(value.Value)); break; case "Single": mCurrSD.Put<float>(key.Value, float.Parse(value.Value)); break; case "Vector3": mCurrSD.Put<Leadwerks.Vector3>(key.Value, Leadwerks.Vector3.Parse(value.Value)); break; }
  12. public override string ToString() { return string.Format("X:{0} Y:{1} Z:{2}", this.X, this.Y, this.Z); } public static Vector3 Parse(string value) { string[] values = value.Split(','); return new Vector3(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2])); } The Parse function above is looking for ',' which doesn't exist. Here is the fix: public static Vector3 Parse(string value) { char[] delimiterChars = { 'X', 'Y', 'Z', ':', ' ' }; string[] values = value.Value.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); return new Vector3(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2])); }
  13. I just noticed this function doesn't return null, if it fails to find a file. Is there another way to check if it succeeded or failed? public static Mesh Load(string path) { return new Mesh(Core.LoadMesh(path, Entity.NullPointer)); }
  14. From what I have read, you can mark parts of the code to be non compliant. I don't know if it can still be used with these collections though. http://www.devarticles.com/c/a/C-Sharp/Making-Your-Code-CLS-Compliant/
  15. I'm using Wintellect's Power Collections for .NET http://powercollections.codeplex.com/releases/view/6863 and am getting warning messages like: whenever I declare a Leadwerks type. I found the cause is this line in Wintellect's algorithms file: // Everything should be CLS compliant. [assembly: CLSCompliant(true)] Does anyone know what the problem is? Is it an issue with Leadwerks itself, or is it the C# wrapper?
  16. Davaris

    C# SVN

    Okay thanks. BTW I noticed you have Recast Navigation in there. Are you guys doing anything with that soon? Because I just found this: Best way to integrate with C#? http://groups.google.com/group/recastnavigation/browse_thread/thread/6ebeb56ecf20e66c Have a look at the third post for links. I haven't a clue if it is useful for Leadwerks or not, as it is for XNA.
  17. Davaris

    C# SVN

    I've followed all the instructions and can't get past one last error. It is asking for a file called app.config. Any ideas?
  18. I downloaded it and ran the zone and it worked fine using the executable, but after I ran the 2.3 updater on it (it downloaded a lot of files), I found the Zone crashes out when it is loading the MilitaryBarracks folder. It does not make any changes to the Engine.log file. EDIT: False alarm. I was using the old updater.
  19. I'm testing the LUA editor with the latest release and I am getting the above message when I press the play button on one of the sample scripts. The LUA script I am running, is in the directory: C:\Leadwerks Engine SDK Both Engine.exe and ScriptEditor.exe, are set to WinXP SP3 compatibility. I also set the paths in the ScriptEditor to: Exe, Debugger, Compiler C:\Leadwerks Engine SDK\Engine.exe C:\Leadwerks Engine SDK\Engine.debug.exe C:\Leadwerks Engine SDK\luac.exe Is there anything I have missed? EDIT: I got it working! I tried a right click and open with, but that didn't fix the problem either. However if I open the ScriptEditor.exe first and then use it to open a LUA file, it works.
  20. Davaris

    OnLive Lives

    You'll never get rid of people's desire to have something tangible, otherwise we'd all be sitting in empty rooms. Case in point, some of my most prized possessions, are my favorite games in mint condition boxes, from more than 10 years ago. In those days for a standard price, they made awesome manuals, cloth maps and sometimes put little toys in the boxes. It was all part of the gaming experience. Now days, you have to pay up to $200 for those extras. Fallout Box 1 Fallout Box 2 Hardcore fans love this stuff and will pay through the nose for it and the big devs know it. I do understand what you guys are saying though and while they may let people rent/buy games once the sales have tailed off, I don't think they will ever sell new games at those prices, for the reasons I posted above.
  21. Thank you Tyler, you are very generous. I'm sorry to hear the project didn't work out.
  22. Davaris

    OnLive Lives

    The problem is once they drop the price in one place, then people will demand it everywhere and the bottom will fall out of the market. Then it would be no longer be profitable to sell in the real world. Speaking for myself, I'd rather have less customers paying more, than more customers paying less, because support costs per customer, are the same. A truly crafty developer, would find a way to let their customers improve their games, while paying the developer for the privilege of doing so. In fact some communities have a better understanding of what makes a game a classic, than most devs do.
  23. I thought I'd post this here, because we are writing C# code and I don't want to keep bugging the C++ people with what we are doing. This is the original thread, if you want to see what we were talking about: http://leadwerks.com/werkspace/index.php?/topic/2150-component-propertyattribute-design/ What I am working on is similar to Rick's component idea but is also very different, in that you no longer have objects containing private data and the functions that operate on them. You have data as a separate entity and functions as separate entities. When the functions want to do something, they access the data pool. The other big idea, is you can stack data on top of each other, in a hierarchy to build up complexity and if you write a wrapper class (AKA Decorator) as described below, you can share a common pool of data with all your game entities. I took the idea from this excellent article. Read it to get an idea of what my code does: http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html You can write a wrapper class for it that provides a second parent pointer, so you can share all the parent data among your game entities base data. All it has to do is change StateCore's parent pointer to its own, before it performs an operation and then restore it when it is complete. As for permission, you are free to use this code in commercial or free projects, as long as you take full responsibility if it causes any damage. Also if you see a way to improve it, let me know as I am a C# newbie. TBH, it is probably safer to get the general idea and write your own. namespace Game { public class StateCore { // OrderedDictionary sorts as it inserts (bah!) // LinkedHashMap maintains insertion order, but you have to buy a decent one // and I don't know if it works on anything other than PC private OrderedDictionary<string, object> mList; private string mName; private StateCore mParent; public const string cBlank = "$_Blank_$"; private bool mIsReadOnly; public string Name { get { return mName; } set { mName = value; } } public OrderedDictionary<string, object> List { get { return mList; } } public StateCore Parent { get { return mParent; } set { mParent = value; } } public bool IsReadOnly { get { return mIsReadOnly; } set { mIsReadOnly = value; } } public StateCore(string name) { mName = name; mList = new OrderedDictionary<string, object>(); mParent = null; mIsReadOnly = false; } public bool Put<T>(string key, T val) { AssertIsReadOnly(); AssertTypeCompatibiltyAll<T>(key); if (PutPrivate<T>(key, val)) { DebugPrintKeyVal("Put", key); return true; } return false; } public bool Get<T>(string key, ref T ret_val) { object val; for (StateCore p = this; p != null; p = p.mParent) { if (p.mList.TryGetValue(key, out val)) { if (p.IsBlank(val)) return false;// not present p.AssertTypeCompatibiltyVal<T>(val); p.DebugPrintKeyVal("Get", key); ret_val = (T)val; return true; } } return false; // not present } public bool Has<T>(string key) { object val; for (StateCore p = this; p != null; p = p.mParent) { if (p.mList.TryGetValue(key, out val)) { if (p.IsBlank(val)) return false;// not present p.AssertTypeCompatibiltyVal<T>(val); p.DebugPrintKeyVal("Has", key); return true; } } return false;// not present } public bool Remove<T>(string key) { object val; AssertIsReadOnly(); if (mList.TryGetValue(key, out val)) { if (!IsBlank(val)) AssertTypeCompatibiltyAll<T>(key); DebugPrintKeyVal("Remove", key); mList.Remove(key); return true; } return true; } public bool SetIsBlank<T>(string key) { AssertIsReadOnly(); AssertTypeCompatibiltyAll<T>(key); if (PutPrivate(key, cBlank)) { DebugPrintKeyVal("SetIsBlank", key); return true; } return false; } public void PrintContents() { Console.WriteLine("****************************"); Console.WriteLine("PrintContents"); Console.WriteLine("****************************"); for (StateCore p = this; p != null; p = p.Parent) { Console.WriteLine(""); Console.WriteLine("CONT = {0}", p.Name); Console.WriteLine(""); foreach (KeyValuePair<string, object> entry in p.List) { if (entry.Value == null) Console.WriteLine("({0}, null) TYPE: null", entry.Key); else Console.WriteLine("({0}, {1}) TYPE: {2}", entry.Key, entry.Value, entry.Value.GetType()); Console.WriteLine(""); } } Console.WriteLine(""); } // ***************** private bool PutPrivate<T>(string key, T val) { object ret_val; // Cannot put null values if (val == null) throw new Exception("null values are not allowed"); // assert key type is allowed GameState.AssertObjectType(val.GetType()); if (mList.TryGetValue(key, out ret_val)) { if (!((T)val).Equals(ret_val)) // val will be changed { mList[key] = val; return true; } } else // new key { mList.Add(key, val); return true; } return false; // no change } private bool IsBlank(object val) { return val.GetType() == cBlank.GetType() && ((string)val) == cBlank; } private void AssertTypeCompatibiltyVal<T>(object val) { if (val.GetType() != typeof(T)) throw new Exception("Type is incompatible"); } private void AssertTypeCompatibiltyAll<T>(string key) { object val; for (StateCore p = this; p != null; p = p.mParent) { if (p.mList.TryGetValue(key, out val)) { p.AssertTypeCompatibiltyVal<T>(val); break; } } } private void DebugPrintKeyVal(string function, string key) { /* if (mList[key] == null) Console.WriteLine("{0}: ({1},null) TYPE: null, CONT: {2}", function, key, Name); else Console.WriteLine("{0}: ({1},{2}) TYPE: {3}, CONT: {4}", function, key, mList[key], mList[key].GetType(), Name); Console.WriteLine(""); */ } private void AssertIsReadOnly() { if (mIsReadOnly) throw new Exception(string.Format("{0} is read only and cannot be altered", Name)); } } }
×
×
  • Create New...