Jump to content
  • Advertisement

WoLfuluss

Member
  • Content Count

    24
  • Joined

  • Last visited

Community Reputation

118 Neutral

About WoLfuluss

  • Rank
    Member
  1. WoLfuluss

    Almirante Engine

    This is a game engine that I coded back in 2012 I think, and now I'm posting the whole source code to everybody! There's nothing "special" at all in the engine - its a collection of features that many times I missed on engines and are useful while creating a game.   Hopefully it will be useful for someone just like it was fun for me to code this whole project.   Source @ Github: https://github.com/WoLfulus/Almirante   Feedbacks please?  
  2. WoLfuluss

    AngelScript <-> C++ binder class.

    I'll try changing the pool to a dynamic one... but a little different from your way. About the function ID's... that's exactly why you must store the function "pointer" like this: Function<void(int, float)> cached_function = module->getFunction<void(int, float)>("name");[/quote] and avoid code like this: module->getFunction<void(int, float)>("name")(1234, 12.34f)[/quote] It will keep a reference to the engine (for getting the context from the pool) and it's own function id... avoiding the search each call you make. Edit ----- I've updated the context pool class, it's now dynamic, creating a new context each time there's none available for usage.
  3. WoLfuluss

    AngelScript <-> C++ binder class.

    Sure it helped. I'll write the context pool then. BTW, I'll need to thread-lock the instance being used by a call until its "release", right? --- EDIT --- Holy crap! I did 150.000 calls to calculate the "time" with the current algorithm and it took 300ms avg. Then I've implemented the context pool, and it took 15~20ms! Btw, you will be able to set the contextpool's object count into the engine I'll commit the changes right now!
  4. WoLfuluss

    AngelScript <-> C++ binder class.

    Alright, I've fixed some things on function import. Now I've managed to add a function "decomposition" too to find the functions by it's declaration, not only the name. So now you can import overloaded functions from script. Like this: Function<int(int,int)> sumi = module->getFunction<int(int,int)>("sum"); sumi(10, 20); // sum ints Function<float(float,float)> sumf = module->getFunction<float(float,float)>("sum"); sumf(10.4f, 14.3f); // sum floats [/quote] It's a possibility. I'll push that feature into the queue () since it needs some "investigation" Nice! I've been thinking of implementing a helper add-on for doing this myself for sometime. One thing you need to think about, is how this would work with shared asIScriptContext's. Ideally the application would only allocate one asIScriptContext for each script function that runs in parallel. If all script functions are executed in sequence then only one asIScriptContext should be used by all executions, otherwise you would be wasting resources if all function objects hold their own asIScriptContext, or have a performance impact if a new asIScriptContext is allocated for each execution. [/quote] What you mean? I'm currently creating a new context for each call and then releasing it with asIScriptContext::Release()... should I create only one context for each function? Now I'm confused on how to handle this.
  5. WoLfuluss

    Compatibility Issues with C4 Engine [Solved]

    this doesn't seems to be an issue with angelscript itself. have you tried removing angelscript includes? does it compiles?
  6. WoLfuluss

    AngelScript <-> C++ binder class.

    Updates! Script functions can be called now without any pain like this: /// Creates the engine Engine engine; /// Creates a module and compiles a script into it /// these modules doesn't needs to be released (it's automatic when Engine goes out of scope or gets destroyed Module* myModule = engine.createModule("MyModuleName"); myModule->compile("script.as"); // First way to call - not recommended myModule->getFunction<void()>("main")(); // Second way to call - holds the function "pointer" and can be called many times. Function<int(int,int)> sum = myModule->getFunction<int(int,int)>("sum")(); int a = sum(5, 10); // Returns 15 int b = sum(6, 13); // Returns 19 Suggestions? BTW, it isn't on SVN yet, since it still support only 2 arguments - I'm writing the code generator for that... I'll commit in some hours. I'll take a look into this. Can you provide me an example of what you're exactly talking about? I have an idea, but I need a working example.
  7. WoLfuluss

    AngelScript <-> C++ binder class.

    Some updates:Object members / offset detection being supported now via Class<MyClass>().member("life", &MyClass::_life);Object accessors are supported now via Class<MyClass>().property("name", &MyClass::getName, &MyClass::setName()); Let me know when templates are supported!! That's what I struggle with currently... [/quote] I think this will be the last thing I'll add Lets see
  8. WoLfuluss

    AngelScript <-> C++ binder class.

    Feedbacks are always welcome. Feel free You know It's not fully featured yet. But I'm on the way!
  9. WoLfuluss

    AngelScript <-> C++ binder class.

    Alright, here's the weekend changes Finished support for constructors / destructorsDummy constructors/destructors are supported by setting .ctor_dummy() or .dtor_dummy()Support for class methods exports (overload supported too)asOBJ_POD flag being detected (thanks SiCrane)Added support for AS namespaces I'll add support for properties now... It isn't on SVN yet, but I'll commit in some minutes. Initial/special flags are supported too: [color=#660066][font=CourierNew, monospace][size=2]Exporter[/font][color=#666600][font=CourierNew, monospace][size=2]::[/font][color=#660066][font=CourierNew, monospace][size=2]Export[/font][color=#666600][font=CourierNew, monospace][size=2]([/font][color=#000000][font=CourierNew, monospace][size=2]module[/font][color=#666600][font=CourierNew, monospace][size=2])[/font][color=#000000][font=CourierNew, monospace][size=2] [/font][color=#666600][font=CourierNew, monospace][size=2][[/font][color=#000000][font=CourierNew, monospace][size=2] [/font][color=#660066][font=CourierNew, monospace][size=2]Exporter[/font][color=#666600][font=CourierNew, monospace][size=2]::[/font][color=#660066][font=CourierNew, monospace][size=2]Class[/font][color=#666600][font=CourierNew, monospace][size=2]<[/font][color=#660066][font=CourierNew, monospace][size=2]MyClass[/font][color=#666600][font=CourierNew, monospace][size=2]>(asOBJ_NOHANDLE) // Here[/font][color=#000000][font=CourierNew, monospace][size=2] [/font][color=#666600][font=CourierNew, monospace][size=2].[/font][color=#000000][font=CourierNew, monospace][size=2]ctor_dummy[/font][color=#666600][font=CourierNew, monospace][size=2]()[/font][color=#000000][font=CourierNew, monospace][size=2] [/font][color=#666600][font=CourierNew, monospace][size=2].[/font][color=#000000][font=CourierNew, monospace][size=2]dtor_dummy[/font][color=#666600][font=CourierNew, monospace][size=2]()[/font][color=#000000][font=CourierNew, monospace][size=2] [/font][color=#666600][font=CourierNew, monospace][size=2]];[/font]
  10. WoLfuluss

    AngelScript <-> C++ binder class.

    Finally got the type exporter to work. + Type exporter + Constructor support + Constructor overload support + Destructor support + Dummy constructor/destructor support I'll implement methods and properties later. Btw... It sets the current type flags automatically (asOBJ_APP_CLASS_CONSTRUCTOR, asOBJ_APP_CLASS_DESTRUCTOR, ...) to avoid user errors. Syntax currently like this: class MyClass { private: int test; public: MyClass() : test(0) { } MyClass(int val) : test(val) { } ~MyClass() { } }; ... AB_TRANSLATE_TYPE(MyClass, "myclass") ... /// /// Exports your global classes to the script /// Exporter::Export(script) [ Exporter::Class<MyClass>() .ctor() .ctor<int>() .dtor() ]; Output [Script] Registering type 'myclass' [Script] Registering constructor for 'myclass' as 'void f()' [Script] Registering constructor for 'myclass' as 'void f(int)' [Script] Registering destructor for 'myclass' as 'void f()'
  11. WoLfuluss

    AngelScript <-> C++ binder class.

    good to know! thanks! I'll play with it a little before start using them.
  12. WoLfuluss

    AngelScript <-> C++ binder class.

    @WitchLord: I'm not using boost anymore. Everything is being coded without any external dependencies. About constructors... I already have an idea on how I'll implement it... I'll make some changes... lets see. @SiCrane: About the "metaprogramming" stuff... I'm trying to avoid macros, but sometimes they become handy. Take a look into the SVN project. I'll rework the struct export stuff right now... lets see how it goes. BTW, I've just updated the first post with a more "clear" information about it.
  13. WoLfuluss

    AngelScript <-> C++ binder class.

    I was looking on the docs, but I couldn't find anything talking about allowing types to be passed by value. Any tips on this? Anyways... I had updated the library... now it can exports POD types. constructors / destructors is still missing, but will be the next feature to add. The syntax for function exports is simplified now, and it detects the calling convention. Here's a sample: #include <iostream> #include <string> #include <AngelBinder.h> #include <scriptstdstring/scriptstdstring.h> /// /// Namespaces /// using namespace std; using namespace AngelBinder; /// /// Exported types /// typedef struct { int member1; unsigned int member2; } TestClass; /// /// Exported global functions /// int sum(int a, int b); int subtract(int a, int b); int multiply(int a, int b); int divide(int a, int b); void log(std::string message); /// /// Type translation /// AB_TRANSLATE_TYPE(TestClass, "test") AB_TRANSLATE_TYPE(std::string, "string") /// /// Message event handler /// void onScriptMessage(Script* script, std::string message) { cout << "[Script] " << message << endl; } /// /// Usage Example /// int main(int argc, char* argv[]) { /// Startup Script script("script"); script.messages() = &onScriptMessage; /// Custom settings RegisterStdString(&script.engine()); /// Exports the structure Exporter::Export(script) [ Exporter::Struct<TestClass>() .member("member1", &TestClass::member1) // registers as int on offset 0 .member("member2", &TestClass::member2) // registers as unsigned int on offset 4 ]; /// Exports the functions Exporter::Export(script) [ Exporter::Functions() .def("sum", &sum) .def("subtract", &subtract) .def("multiply", &multiply) .def("divide", &divide) ]; script.compileFile("AngelBinder.as"); return 0; } /// /// Implementations ///... The output: [Script] Registering type 'test' [Script] Registering member 'test::member1' as 'int' [Script] Registering member 'test::member2' as 'uint' [Script] Register function 'sum' as 'int sum(int, int)' [Script] Register function 'subtract' as 'int subtract(int, int)' [Script] Register function 'multiply' as 'int multiply(int, int)' [Script] Register function 'divide' as 'int divide(int, int)'[/quote] I was asking about passing by value because this function prototype for example, fails at runtime with the message saying that it can't be passed as value. TestClass init(int a, int b) It registers fine as "test (int, int)" but when compiling a script, the message pops up.
  14. WoLfuluss

    AngelScript <-> C++ binder class.

    WitchLord, can you provide me a list of prototype strings that angelscript parses and when it's used?? I mean something like this: int - by value const int - constant variable int@ - "pointer" int& - "reference"
  15. WoLfuluss

    AngelScript <-> C++ binder class.

    Alright guys! Big news... I've created the google code project, and the new syntax I have 100% sure you guys know... I tried to keep it simple to the max... also, if there's any suggestions, please let me know. here's the link: https://code.google.com/p/angelbinder/
  • 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!