• 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.


  • Content count

  • Joined

  • Last visited

Community Reputation

293 Neutral

About vdaras

  • Rank
  1.   That's really interestering.  Could you give an example or two where another engine is that much faster than Unity or UE4?     Fox engine seems superior to both Unity and UE4 performance wise.
  2.   As you saying, don't store lambdas in std::function unless you need to (i.e. passing a lambda into a function that takes std::function as a parameter), or are you saying never use std::function to store a lambda?   I store lambdas in std::function all the time. Ofcourse if the lambda doesn't need to be stored for later calling, I just use auto, but since I still use std::function alot, I'd like to know if there's a problem with that that I'm not aware of.   Are you saying that std::function's member vars takes a few extra bytes to hold the object, which requires a separate allocation (definitely worth pointing out), or are you warning about something more dangerous?      You are right I didn't put that correctly. It's totally fine storing them in std::function objects if there is no alternative to the task at hand.   The problem with std::function is that its the same size for every kind of function it could store, so it does extra allocations if its memory is not enough to store bookkeeping information about the lambda.   Imagine having a game with tons of those small allocations each frame because you just define and store some lambdas. It could hinder performance.
  3. Also, it's advisable not to store lambdas in std::function objects. It might cost extra memory allocation.   The type of each different lambda is known only to the compiler, so use auto instead.
  4. A good reading people often recommend is Game Coding Complete by Mike McShaffry. I've read it myself too and I suggest that it is a great one! It covers a lot of introductory topics on game development and game code architecture as well as some advanced ones. It has some great advice on how you can decouple your game's subsystems.   Another good one is Game Engine Archtecture by Jason Gregory. It covers a lot of ground on game engines but in a more abstract manner than the previous one.
  5. On a side note, if an integer can't be divided by 2 then it also can't be divided by any other even number, so you can try 2 and then only try odd numbers from 3 to sqrt(x), where x the integer that you check for primality.
  6. [quote name='6677' timestamp='1354557291' post='5006692'] With their native code push I don't think its entirely infeasible to suggest that the "XNA Replacement" on the next gen console could well support native code with a few restrictions, maybe still requiring the indie license and using the same distribution methods, if this is the case it would also be theoretically possible for a monogame port I guess. I wonder if monogame on WP8 is possible [/quote] Monogame is definitely possible on WP8. As is Microsoft's XNA. The problem with XNA is that, from what we know so far, it won't be supported anymore..so no new WP8 features for XNA apps.
  7. My bet is that sooner123 doesn't understand the pointer concept very well. sooner123, [source lang="cpp"]Node* sentinel = new Node;[/source] This line of code creates a new object of the [b]Node[/b] class on the free store and makes the sentinel pointer reference that object. So in order to make your pointer reference the pre-existing [b]Node [/b]object, which you wanted to do in the first place, you just need this [source lang="cpp"]Node* sentinel = list;[/source] Sorry for stating the obvious to the vast majority of you, but from what I got from sooner123's responses, the op probably didn't understand why allocating the new node was unnecessary.
  8. You ask for someone to leave his/her country, move to a foreign country where English is needed but English is not the native speaking language. Then you need him/her to move to an expensive city as Barcelona, where paying the rent would effectively diminish the 800E salary to 1/3 and probably more. Otherwise, if he/she chooses to leave in a suburban area of Barcelona, much more money will be paid on transport every month. Sorry but you need much better arguments than 'I have super project idea' that no one knows anything about and ' I'm a badass programmer' in order to convice someone to do that.
  9. [quote name='WitchLord' timestamp='1311130867' post='4837766'] As you execute the script the context holds on to a reference, until the context is released or you prepare it for a new execution. That is likely the 3rd reference you're seeing. [/quote] Aha, ok, I'll try releasing the context before the script object and see if the reference count drops by one. Thanks [quote name='WitchLord' timestamp='1311130867' post='4837766'] [color="#000000"]Irrelevant to the reference counting question, may I suggest you remove the context as a member of the ScriptLogic class? Instead keep a single context in the [/color][color="#660066"][color="#000000"]ScriptManager class. Since all your scripts executes and returns immediately, there is no need for multiple contexts. It will just waste a lot of memory as each context keep quite a bit of memory to hold local variables on the call stack for an execution. [/quote][/color][/color] [color="#660066"] [/color] [color="#660066"][color="#000000"]It was design choice, we thought that having multiple contexts would later allow us to integrate concurrent script execution more easily. As for now, it's indeed a waste of space to have a context for each script object.[/color][/color] [color="#660066"] [/color] [color="#660066"][color="#000000"][quote name='WitchLord' timestamp='1311130867' post='4837766'][/color][/color] [color="#000000"]Also, you should cache the function id's so you do not have to call the GetMethodIdByDecl() method for every execution. This is a quite slow method, as it needs to parse the declaration and then compare it against all of the compiled methods in order to determine which you want. Regards, Andreas[/color] [/quote] Thanks for the tip. [img]http://public.gamedev.net/public/style_emoticons/default/biggrin.gif[/img] Regards, Vassilis
  10. [quote name='WitchLord' timestamp='1311122847' post='4837726'] You must only call Release() for the references you own. From what you're saying you're doing the following: [code] asIScriptObject *obj = something(); while( obj->Release() > 0 ); [/code] I hope that is not the case. While it may have worked in some cases, it will inevitably crash the application at one point or another. [/quote] Unfortunately that is the case, thanks for the clarification. [quote name='WitchLord' timestamp='1311122847' post='4837726'] A script object may be garbage collected, even though you create it yourself outside of the scripts. This depends on the members of the class. If for example the class has a handle as member, it will be garbage collected as there is no way of predicting at compile time whether the object will ever be involved in a circular reference or not. If you want to be sure a script object is actually destroyed, you should call Release() for each reference you own. If the last call to Release() still indicate more references, then call engine->GarbageCollect([size="2"]asGC_FULL_CYCLE[/size]); to make sure the garbage collector frees it's own references to the object. [/quote] The asIScriptObject I create is wrapped inside a class that handles its lifetime and executing its methods. Here is the class' interface [code] class ScriptLogic : public AbstractLogic, public NonCopyable { private: asIScriptObject *m_script; asIObjectType *m_scriptObjectType; asIScriptContext *m_ctx; public: /** * Constrcutor initializes this logic by getting the script object * that handles the behavior of this Entity. * * @param object - the script object managed by the script logic. */ ScriptLogic(asIScriptObject *object); virtual ~ScriptLogic(); /** * Clones this script logic. * * @return a replicate of ths Script Logic component. (deep copy) */ ScriptLogic* Clone(); /** * Executes the Initialize method of the script object. */ void ExecuteInitialize(); /** * Executes the Update method of the script object. */ void ExecuteUpdate(); /** * Executes the Update method of the script object. */ void ExecuteOnTileCollision(std::string* tile, Math::Vector2F& contactNormal); /** * Executes the Update method of the script object. */ void ExecuteOnEntityCollision(Entity* collided, Math::Vector2F& contactNormal); /** * Executes the OnKeyButtonUp method of the script object. * * @param info for the released key */ void ExecuteOnKeyButtonUp(KeyboardEventInfo *info); /** * Executes the OnKeyButtonDown method of the script object. * * @param info for the pressed key */ void ExecuteOnKeyButtonDown(KeyboardEventInfo *info); /** * Execute the OnDeath method of the script object. */ void ExecuteOnDeath(); /** * Sets the Entity that this script logic controls. * * @param parent */ virtual void SetParent(Entity *parent); /** * Returns the name of this script's class. */ const char *getName(); }; [/code] Here is the constructor's, the destructor's, Clone method and a sample script object's method execution implementations. [code] ScriptLogic::ScriptLogic(asIScriptObject *object) { ScriptManager *scriptManager = ScriptManager::GetInstance(); //get the type of the script m_scriptObjectType = object->GetObjectType(); //create an object of the given type m_script = object; //give a context to this script logic m_ctx = scriptManager->CreateContext(); } ScriptLogic::~ScriptLogic() { m_script->Release(); m_scriptObjectType->Release(); m_ctx->Release(); } ScriptLogic* ScriptLogic::Clone() { ScriptManager *scriptManager = ScriptManager::GetInstance(); asIScriptEngine *engine = scriptManager->GetEngine(); //create a copy of the script object asIScriptObject *replicate = (asIScriptObject *) engine->CreateScriptObjectCopy(m_script, m_scriptObjectType->GetTypeId()); return new ScriptLogic(replicate); } void ScriptLogic::ExecuteUpdate() { //get the method 'Update' ID int methodID = m_scriptObjectType->GetMethodIdByDecl("void Update()", true); //prepare the method for execution m_ctx->Prepare(methodID); //pass the script logic's script object as the object which calls the method m_ctx->SetObject(m_script); //execute the method m_ctx->Execute(); } [/code] Here is the creation of the asIScriptObject object. [code] //create the object int typeID = entityModule->GetTypeIdByDecl(scriptObjectType.c_str()); asIScriptObject *scriptObject = (asIScriptObject *) engine->CreateScriptObject(typeID); [irrelevant code omitted] //add the script object to the prototype entity cacheEntity->AddScriptLogic(scriptObject); //this creates a ScriptLogic object, with the asIScriptObject as an argument [/code] The asIScriptObject objects in ScriptLogic object are not accessed by any other part of the engine's code. Based on this code, I can only count 1 reference added during creation and 1 reference held by the garbage collector. So.. there is extra reference that I can't justify. [img]http://public.gamedev.net/public/style_emoticons/default/sad.gif[/img]
  11. Hello, Got another question regarding memory management. I explicitly create asIScriptOjbect s in C++ code, which are only manipulated by the C++ engine and angelscript code doesn't use them. When I try to deallocate them by calling asIScriptObject::Release I see that there are 3 references to each one of them and I call this method in a do-while loop until the object's references reach 0. Will these objects be deallocated by the garbage collector? If not, what can I do to deallocate them explicitly? I don't want to mess with angelscript's code and mark asIScriptObject destructor as public, I don't think it would be safe either. Regards, Vassilis
  12. Thank you for your fast response Andreas, you really helped a lot [img]http://public.gamedev.net/public/style_emoticons/default/smile.gif[/img]
  13. Hello, I need to disable angelscript's garbage collector. The lifetime of the objects that the scripts manipulate is managed by C++ code, thus my only need is to pass non-refcounted handles to the scripts. Also, if I manage to disable garbage collection, is there a way to prevent the instantiation of reference types in scripts in order to avoid memory leaks? Thank you in advance.
  14. Use std::vector and you are golden.
  15. Using [b]malloc[/b] doesn't construct any object in the array, it only allocates the requested memory. Why do you need to use [b]malloc[/b] instead of [b]new[][/b]?