• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Wipe

Members
  • Content count

    17
  • Joined

  • Last visited

Community Reputation

381 Neutral

About Wipe

  • Rank
    Member
  1. Yeah, plus a small tweak; with config like below game will be built only when user wants to, and totally ignored if all he wants is a library.
  2. It's a small detail really, but "game" should be available for top-level CMakeLists if AS is added there via add_subdirectory(). Speaking of using AngelScript as subproject, can you recommend any git mirror which is frequently updated and have zero modifications? I keep finding ones which sooner or later are abandoned or start changing stuff.
  3. Attached a tiny suggestion to change building samples/game/ optional [off by default] and rename it to "angelscript-game"; don't think AS should steal such a perfect name
  4. I know why i would. Not long ago i got a weird crash when loading bytecode containing funcdef array with extra comma. Nothing tried to access last element, couldn't reproduce it, happens only on linux version of application... I'd enable it just to make sure other scripters don't screwup anything - finding single comma in big codebase is not fun at all :]
  5. You may want to take a look at preprocessor written years ago by Anthony Casteel. Can't see the anything linking to it on the page itself, but fast googling shows that it's still around. Other than #define and friends, you'll also get #include and skeleton for #pragma what should be enough even for bigger scripts.
  6. tests/test_feature/source/test_stdvector.cpp still tries to use PrintException() which has been replaced in r1971 Obviously whole thing does not compile now
  7. I have this small piece of code #include "utils.h" const bool fail = true; /*/ global funcdef var (setter) + imports /*/ const char* funcdef_import_assert_as = "import void bar() from \"somewhere\";" "void test1(){ @foo = test2; }" "void test2(){ @foo = bar; }"; // the problem void set_funcdef_var(asIScriptFunction*) {} bool funcdef_import_assert() { COutStream cout; asIScriptEngine* engine = asCreateScriptEngine( ANGELSCRIPT_VERSION ); engine->SetMessageCallback( asMETHOD(COutStream,Callback), &cout, asCALL_THISCALL ); engine->RegisterFuncdef( "void MyVoid()" ); engine->RegisterGlobalFunction( "void set_foo(MyVoid@)", asFUNCTION(set_funcdef_var), asCALL_CDECL ); int r; asIScriptModule* module = engine->GetModule( "script", asGM_ALWAYS_CREATE ); module->AddScriptSection( "script", funcdef_import_assert_as ); if( module->Build() < 0 ) // assert (-DNDEBUG not present) { PRINTF( "script1 Build fail\n" ); return( fail ); } CBytecodeStream bytecode(""); if( module->SaveByteCode( &bytecode ) < 0 ) { PRINTF( "bytecode save fail\n" ); return( fail ); } asIScriptModule* module_bytecode = engine->GetModule( "script_bytecode", asGM_ALWAYS_CREATE ); if( module_bytecode->LoadByteCode( &bytecode ) < 0 ) // error (-DNDEBUG present) { PRINTF( "bytecode load fail\n" ); return( fail ); } engine->Release(); return( !fail ); } Angelscript compiled with NDEBUG (my setup) (0, 0) : Error   : LoadByteCode failed. The bytecode is invalid. Number of bytes read from stream: 187Angelscript compiled without NDEBUG testgnuc: ../../source/as_scriptfunction.cpp:468: virtual int asCScriptFunction::AddRef() const: Assertion `funcType != asFUNC_IMPORTED' failed.------------------------------------------------------- And related question: Is such code the correct way of handling global funcdefs with configuration as above? I have a feeling that blindly calling Release() without AddRef() will lead me into trouble some sunny day (yet i need it or garbare collector will complain when releasing engine).   vector<asUINT> Script::Config::runFunctions; /// called when changing script function used for loop(), draw(), etc. void Script::Config::ChangeRunFunction( asUINT type, asIScriptFunction* func ) { asIScriptContext* ctx = asGetActiveContext(); if( !ctx ) return; asIScriptEngine* engine = ctx->GetEngine(); if( !engine ) return; asUINT oldFuncId = runFunctions[type]; asIScriptFunction* oldFunc = engine->GetFunctionById( oldFuncId ); if( oldFunc ) oldFunc->Release(); int funcId = 0; if( func ) funcId = func->GetId(); runFunctions[type] = funcId; } /// called before releasing engine void Script::Config::Finish( asIScriptEngine* engine ) { for( auto funcId : runFunctions ) { if( !funcId ) continue; asIScriptFunction* func = engine->GetFunctionById( funcId ); if( func ) func->Release(); } }
  8. Thanks, definitely will be useful
  9. Is there a way to get rid of function added via asIScriptEngine::RegisterGlobalFunction()? I fail to find anything like that in docs or tests.  
  10. Another dark secrets of funcdefs found, sorry! ;) We call start() function and expect to reach end().   Let's start from crash in cfuncdef1_1::crashme(). [spoiler]  funcdef void funcdef1( ifuncdef1_1& i ); shared interface ifuncdef1_1 {     ifuncdef1_2@ events { get; set; }     void crashme(); } shared interface ifuncdef1_2 {     funcdef1@ f { get; set; } } class cfuncdef1_1 : ifuncdef1_1 {     ifuncdef1_2@ _events_;     cfuncdef1_1() { @this._events_ = cfuncdef1_2(); }     ifuncdef1_2@ get_events() { return( this._events_ ); }     void set_events( ifuncdef1_2@ events ) { @this._events_ = events; }     void crashme()     {          if( @this._events_ != null && @this._events_.f != null )             this.events.f( this );     } } class cfuncdef1_2 : ifuncdef1_2 {     funcdef1@ ff;     cfuncdef1_2() { @ff = null; }     funcdef1@ get_f() { return( @this.ff ); }     void set_f( funcdef1@ _f ) { @this.ff = _f; } } void start() {     ifuncdef1_1@ i = cfuncdef1_1();     i.events.f = end;     i.crashme(); } void end( ifuncdef1_1& i  ) {     Log( "you win!" ); } [/spoiler]   If we change crashme() a bit, everything looks like it works without any problems (we can reach end()), but generated bytecode cannot be loaded (LoadByteCode() returns -1).      void crashme()     {         if( @this._events_ != null && @this._events_.f != null )         {             funcdef1@ crash = this.events.f;             crash( this );         }     }  And finally, different edit makes "GC cannot free an object of type '_builtin_function_', it is kept alive by the application." error show up.cfuncdef1_1() { @this._events_ = null; }
  11. Two modules with same code; both need to be loaded from bytecode or error won't show up. funcdef void fdef(); shared interface iface { fdef@ dummy(); }
  12. Hm, looks like there are still problems when loading from bytecode (shared type doesn't match the original declaration).
  13. Default argument ignored(?) when imported function is using it. In case of int, no matter what value was given in function declaration, it's always 0.// module 1 import void test2( bool dummy, int x = -1 ) from "test2"; void test( bool dummy, int x = -1 ) { Log( "x = "+x ); } void check() { Log( "TEST" ); test( true ); test( true, -2 ); test( true, 2 ); Log( "TEST2" ); test2( false ); test2( false, -2 ); test2( false, 2 ); } // module 2 void test2( bool dummy, int x = -1 ) { Log( "x = "+x ); } Output is: TEST x = -1 x = -2 x = 2 TEST2 x = 0 x = 0 x = 0 Code above may refuse to compile for some reason. I got or crashes, or infinite loop (or maybe it just looks like this for me) on scripts loading (with both loading from source or bytecode), or no problems at all. Tested with r1558 and r1563.
  14. 1st thing-- // module 1 funcdef void Func(); shared interface ielement {     Func@ f { get; set; } } // module 2 funcdef void Func(); shared interface ielement {     Func@ f { get; set; } } class celement : ielement { Func@ fdef;     Func@ get_f() { return( this.fdef ); }     void set_f( Func@ newF ) { @this.fdef = newF; } } Used that way, makes  "Missing implementation of ..." error for both, getter and setter. So i tried to use "normal" functions.   // module 1   funcdef void Func(); shared interface ielement {     Func@ fGet(); void fSet( Func@ ); } // module 2 funcdef void Func(); shared interface ielement {    Func@ fGet(); void fSet( Func@ ); } class celement : ielement { Func@ fdef;     Func@ fGet() { return( this.fdef ); }     void fSet( Func@ newF ) { @this.fdef = newF; } } Error changed to " Shared type 'ielement' doesn't match the original declaration in other module"   ---- 2nd thing-- shared interface ielement { void dummy1(); } shared interface isprite : ielement { void dummy2(); } class celement : ielement { void dummy1() {} } class csprite : celement, isprite { csprite() { super(); } void dummy2() {} } Makes warning "The interface 'ielement' is already implemented" - is that possible to make this warning go away? EDIT: everything was tested with r1563
  15. shared interface ielement {     void func1(); } shared interface iscreen : ielement {     void func2(); } mixin class celementbase {     void func1()     {     } } class cscreen : celementbase, iscreen {     void func2()     {     } } void stuff( iscreen@ scr ) {     scr.func1(); } "No matching signatures to 'iscreen::func1()'". rev1558