Giter VIP home page Giter VIP logo

omniengine.net's People

Contributors

aswinstha avatar chieling avatar winterleaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

omniengine.net's Issues

Proposed new SimObject class system.

Hey, I've been learning a bit more about C# and I have a new proposal for the SimObject system, to replace this syntax:

SimObject sim = 42;
sim["Fish"] = 2;
Console.WriteLine(sim["Fish"] + sim.mID);
SimObject sim = (dynamic)new TorqueID(42);
sim.Dynamics.Fish = 2;
Console.WriteLine(sim.Dynamics.Fish + sim.mID);

It's more verbose but I think it's clearer what happens. Also, this has the advantage of not having to create implicit converters for each of the inherited classes.

Using:

   class TorqueID : DynamicObject
   {
      private int mID;

      public TorqueID(int ID)
      {
         mID = ID;
      }

      public override bool TryConvert(ConvertBinder binder, out object result)
      {
         if (binder.Type.GetConstructor(new Type[] { typeof(int) }) != null)
         {
            result = Activator.CreateInstance(binder.Type, mID);
            return true;
         }
         result = null;
         return false;
      }
   }

Makes the TorqueID class implicitly convert to any class with a constructor of format: "public C(int id)" which it's fair to assume that each SimObject will have. Which means the boiler plate code for SimObject is nothing more than:

   class SimObject
   {
      public int mID;
      public dynamic Dynamics;

      public SimObject(int ID)
      {
         mID = ID;
         Dynamics = new DynamicVariables(mID);
      }
   }
   class DerivedSimObject : SimObject
   {
      public DerivedSimObject(int ID) 
         : base(ID)
      {
      }
   }

Ofc, this introduces dynamics which means types will be evaluated at run-time. But this makes sense when you consider that it's modelled to match TorqueScript. You can find a Gist of a minimal running example here.

I'm not completely done with rethinking the SimObjects, I'm gonna look at object instancing next.

Thoughts?

Licensing headers

Paul mentioned we should remember to put in the proper license headers in the files on the repo.

Remove SimpleNetObject from C++ SimObject Based Classes

SimpleNetObject is just an example object and should be removed from the SimObject based classes, as it creates issues in the SafeNativeMethods.cs file. This is probably because SimpleNetObject has it's class definition inside the .cpp file and not the .h file. It doesn't have any relevance to the actual game logic so it should just not be generated at all.

I can't change this, as it is a StaticCodeGenerator issue.

Partially solves #20.

ObjectCreator is uglyyyy.

I really wanna clean up object creation.

new A() { new B(){}; };

Is just syntactic sugar for:

new A() {};
new B() {};
A.add(B);

So instead of this:

            oc_Newobject4["#Newobject1"] = oc_Newobject1;

We could have this:

SimSet set = oc_Newobject4.create();
set.add(oc_Newobject1.create());

And we should use named parameters in the constructors so that instead of this:

ObjectCreator oc_Newobject4 = new ObjectCreator("GuiWindowCtrl", "ConsoleDlgWindow", typeof (ConsoleDlgWindow));
            oc_Newobject4["isContainer"] = "1";
            oc_Newobject4["AllowPopWindow"] = "1";

We should have:

// Have to have GuiWindowCtrl constructor in a seperate class to avoid boilerplate constructors in 
// classes derived from GuiWindowCtrl.
GuiWindowCtrl oc_Newobject4 = new GuiWindowCtrlInstance(name: "ConsoleDlgWindow", isContainer: true, AllowPopWindow: true);

// Alternately
GuiWindowCtrl oc_Newobject4 = (new GuiWindowCtrlInstance("ConsoleDlgWindow")
{
  isContainer = true,
  AllowPopWindow = true
}).create();

Template: Empty(C#) doesn't work

Using the package manager to create a new project based on Empty (C#), then compiling the engine and compiling the C# gives 9 errors:

Error   1809    'WinterLeaf.Engine.Classes.Interopt.pInvokes.UtilObject' does not contain a definition for 'closeSplashWindow' and no extension method 'closeSplashWindow' accepting a first argument of type 'WinterLeaf.Engine.Classes.Interopt.pInvokes.UtilObject' could be found (are you missing a using directive or an assembly reference?) E:\GitHub\OmniEngine.Net\My Projects\TestProject\Winterleaf.Demo.Full\Models.User\GameCode\Main.cs  198 31  Winterleaf.Demo.Full
Error   1811    The best overloaded method match for 'WinterLeaf.Engine.Omni.fnTCPObject_listen(string, int)' has some invalid arguments    E:\GitHub\OmniEngine.Net\My Projects\TestProject\Winterleaf.Demo.Full\Models.Base\TCPObject_Base.cs 208 1   Winterleaf.Demo.Full
Error   1812    Argument 2: cannot convert from 'uint' to 'int' E:\GitHub\OmniEngine.Net\My Projects\TestProject\Winterleaf.Demo.Full\Models.Base\TCPObject_Base.cs 208 39  Winterleaf.Demo.Full
Error   1821    'WinterLeaf.Engine.Omni' does not contain a definition for 'fnAIPlayer_checkInFoV' and no extension method 'fnAIPlayer_checkInFoV' accepting a first argument of type 'WinterLeaf.Engine.Omni' could be found (are you missing a using directive or an assembly reference?) E:\GitHub\OmniEngine.Net\My Projects\TestProject\Winterleaf.Demo.Full\Models.Base\AIPlayer_Base.cs  324 22  Winterleaf.Demo.Full
Error   1822    'WinterLeaf.Engine.Omni' does not contain a definition for 'fnAIPlayer_checkInLos' and no extension method 'fnAIPlayer_checkInLos' accepting a first argument of type 'WinterLeaf.Engine.Omni' could be found (are you missing a using directive or an assembly reference?) E:\GitHub\OmniEngine.Net\My Projects\TestProject\Winterleaf.Demo.Full\Models.Base\AIPlayer_Base.cs  337 22  Winterleaf.Demo.Full
Error   1827    'WinterLeaf.Engine.Omni' does not contain a definition for 'fnGuiCanvas_hideWindow' and no extension method 'fnGuiCanvas_hideWindow' accepting a first argument of type 'WinterLeaf.Engine.Omni' could be found (are you missing a using directive or an assembly reference?)   E:\GitHub\OmniEngine.Net\My Projects\TestProject\Winterleaf.Demo.Full\Models.Base\GuiCanvas_Base.cs 510 15  Winterleaf.Demo.Full
Error   1828    No overload for method 'fn_TerrainEditor_autoMaterialLayer' takes 6 arguments   E:\GitHub\OmniEngine.Net\My Projects\TestProject\Winterleaf.Demo.Full\Models.Base\TerrainEditor_Base.cs 513 1   Winterleaf.Demo.Full
Error   1832    'WinterLeaf.Engine.Omni' does not contain a definition for 'fnGuiCanvas_showWindow' and no extension method 'fnGuiCanvas_showWindow' accepting a first argument of type 'WinterLeaf.Engine.Omni' could be found (are you missing a using directive or an assembly reference?)   E:\GitHub\OmniEngine.Net\My Projects\TestProject\Winterleaf.Demo.Full\Models.Base\GuiCanvas_Base.cs 683 15  Winterleaf.Demo.Full
Error   1839    Metadata file 'E:\GitHub\OmniEngine.Net\My Projects\TestProject\game\Winterleaf.Demo.Full.dll' could not be found   E:\GitHub\OmniEngine.Net\My Projects\TestProject\Winterleaf.Game\CSC    Winterleaf.Game

I'll try running the static code generator and see if it fixes things.

Edit:

  • Win8.1x64
  • Built was x86

Create Template - FPS

There is a basic FPS Template (either the Full or Empty) but it needs to be updated for a more FPS specific scenarios

Isolate game-specific code from engine-specific code.

Why is the Models.Base folder in the game code project? Surely, this folder reflects the engine structure, and therefore it should be in the Winterleaf.Engine project.

Also whats the purpose of the "Extendable" folder, it seems like it isn't meant to be fiddled with just like the Models.Base folder, so whats its purpose? What does it add that you couldn't just get from the Models.Base classes to begin with? Edit: Nvm, I see it's for inheritance

Winterleaf.Demo.Full should just have "CustomObjects" and "GameCode".

Endless loop on quit

If you call this function then the engine will go into endless-loop if you haven't defined the function in C#. Should it be:

Winterleaf_EngineCallback::mWLE_gIsFunction("Quit")

? If I do that, it seems like the engine wont shut down.

Omni.self vs. pInvokes

Whats the difference between Omni.self and private static readonly pInvokes omni = new pInvokes(); ? Why do we have both? Can we possibly remove one of them so there's a single interface for interacting with the engine?

2 versions of AsUint

There's both "AsUInt" and "AsUint", whats the difference? Seems like "AsUInt" is simply a newer version of "AsUint".

Replace graphics

get rid of all the "T3D" UI graphics that are in the Project Manager AND the TS builds. There should be good and working examples in the C# builds

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.