• 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

460 Neutral

About BlackMoons

  • Rank
  1. So where are better places to find artists?
  2. Awesome.  Yea its very likely none of my string literals contained ; to end a statement block, that may be why it never flagged any more errors?
  3. No, It does not give any other errors (Unless my code is somehow obscuring them). It does not appear to detect that "Hello" is not valid syntax if it did pick up the parsing wrong.   Even in a *very* large file, it gave no errors whatsoever except for 'non-terminated string literal' on a the very last string literal of the file. that is why I thought it was so odd. I would understand if the parser puked a few lines after the non-terminated string literal, but when it complains at the very last valid literal suggests that it something is going wrong in detection.   And yea, I didn't think that Angelscript supported multi-line string literals using ", I thought that only worked with """ Hence detecting a broken " string literal should be easy, Just look for a newline in the middle of a " and you know its wrong. I thought that is what the existing code did, but for some reason it kept going after the error and reported the error on the very last string literal to be parsed.
  4. Thank you for the very liberal licensing of Angelscript. Its really refreshing to be able to use the code however is needed without worry.
  5. With the following code: string foo = " string bar = "Hello"; string bar2 = "World"; Angelscript throws a compile error of "non-terminated string literal" line 3 char 21   When it really should be throwing the error on line 1 char 14.   In much larger more complex files, it seems to always throw the error on the very last string literal regardless where it happens in the file and does not complain about anything else. Makes it kinda hard to find out what string literal you messed up on.  
  6. Ah, So should I just register the =operator directly like this? r = scriptEngine->RegisterObjectMethod("ObjectPicker", "ObjectPicker & opAssign(const ObjectPicker &in)", asMETHOD(ObjectPicker,operator=), asCALL_THISCALL); assert( r >= 0 );
  7. Is the following assignment operator correct? I am mainly wondering about if rhs should be released? Since its a const object I can't, Or does the fact it is passed by ref instead of handle means the ref count was not incremented?   Is it better to take the rhs by handle to avoid the copy of the object? class ObjectPicker : public ScriptRef { public: std::vector<ObjectPick> mObjects; ObjectPicker & ScriptAssign(const ObjectPicker & rhs) { mObjects = rhs.mObjects; AddRef(); // because of returning object return *this; } }; (ObjectPicker is registered as asOBJ_REF) r = scriptEngine->RegisterObjectMethod("ObjectPicker", "ObjectPicker @ opAssign(const ObjectPicker &in)", asMETHOD(ObjectPicker,ScriptAssign), asCALL_THISCALL); assert( r >= 0 );
  8. "The delegates are objects" Yea I learned this one the hard way last week. Be warned that a delegate will not == another delegate that points to the same function and class unless it actually is the same delegate object. They also maintain a ref to the object.
  9. Yea, Not too sure what could make it smoother. Maybe moving asIObjectType * type = function->GetDelegateObjectType(); std::string weakRefDecl = std::string("weakref<") + type->GetName() + ">"; asIObjectType *weakRefType = engine->GetObjectTypeById(type->GetModule()->GetTypeIdByDecl(weakRefDecl.c_str())); inside the constructor of CScriptWeakRef Of course, that breaks existing code, but a new assert should at least alert people to the break. (Yea. I dislike breaking existing peoples code too so, bad idea I guess)   Another option might be some ability to set a CScriptWeakRef via function instead of just by constructor. CScriptWeakRef * foo = new CScriptWeakRef(); foo->SetRef(object,type); Of course that makes the interface a little weird as constructor and setting method no longer match in usage.     Another, cleaner option for delegates, might be to just have a new (C++ only?) class like WeakRefDelegate that has an assignment/copy operator for a asIScriptFunction* (And back again if passing back to the script engine is needed?). Ideally it would also be smart enough to handle non delegate functions transparently (Just leave the internal WeakRef set to null and set a bool to say the function can be called without a valid WeakRef)
  10. Ok updated to 2.28.2.   Now its crashing at // The given type should be the weakref template instance assert( strcmp(type->GetName(), "weakref") == 0 || strcmp(type->GetName(), "const_weakref") == 0 ); Thanks for that assert btw. So I assume I am passing the wrong type altogether. How do I get the type I want to construct a WeakRef?   <edit> Ahhhh. Found this http://www.gamedev.net/topic/647835-ownership-problem-of-funcdefs/ that also had the same problem and fixed it. Again, thanks for the assert it REALLY helped me figure this out!!! PS: GetObjectTypeByDecl still does not exist.   For anyone who was wondering or later finds this post with the same problem, the correct code was: void ObjectManager::AddPowerDraw(asIScriptFunction* function) { asIScriptEngine * engine = Engine::mScript->mScriptEngine; mPowerCallbacks.push_back(PowerCallback()); // Todo: Check for function->GetFuncType() == asFUNC_DELEGATE mPowerCallbacks.back().mFunction = function->GetDelegateFunction(); void * object = function->GetDelegateObject(); asIObjectType * type = function->GetDelegateObjectType(); std::string weakRefDecl = std::string("weakref<") + type->GetName() + ">"; asIObjectType *weakRefType = engine->GetObjectTypeById(type->GetModule()->GetTypeIdByDecl(weakRefDecl.c_str())); mPowerCallbacks.back().mRef = new CScriptWeakRef(object,weakRefType); function->Release(); }
  11. Hmmm, Run into a roadblock void ObjectManager::AddPowerDraw(asIScriptFunction* function) { mPowerCallbacks.push_back(PowerCallback()); mPowerCallbacks.back().mFunction = function->GetDelegateFunction(); void * object = function->GetDelegateObject(); asIObjectType * type = function->GetDelegateObjectType(); Engine::mScript->mScriptEngine->AddRefScriptObject(object, type); // Add ref to object, as CScriptWeakRef releases an object. mPowerCallbacks.back().mRef = new CScriptWeakRef(object,type); function->Release(); } It crashes when it calls 'mPowerCallbacks.back().mRef = new CScriptWeakRef(object,type);' Inside the constructor of CScriptWeakRef it crashes at: 'm_type->GetEngine()->ReleaseScriptObject(m_ref, m_type->GetSubType());' the crash in the ReleaseScriptObject function happens at if( objType->flags & asOBJ_REF )   Hence why I added the 'Engine::mScript->mScriptEngine->AddRefScriptObject(object, type);' line to my own code. but that does not seem to help.   Further debugging shows m_type->GetSubType() returns NULL as m_type is not a template type. What am I doing wrong in constructing the weakRef?   I think I will update Angelscript next as I seem to be using 2.27.1
  12. Oh, CScriptWeakRef has a private destructor. that is a new one for me. Guess I will be using new/Release() then.
  13. Ah thanks. Is making a new delegate object very expensive?   Hmm, Now I have the problem where my script classes destructor won't get called to free up any remaining callbacks since the callbacks hold a ref to the object. Hmmmm.   Now I have to decide between breaking up the delegate and not holding a ref to the object (potentially dangerous if a ref is not removed properly) or have a separate 'clean up' function to be called when a script object needs to be destroyed. (Technically I already have one I call from the destructor because mixins can't override the destructor, but I would rather not have to call a named function from C++ to cleanup a script class)   This does seem kind of like a task for weak references as I dislike making the scripting side more complex and would like to be able to report errors rather then crash.   Do I just (C++ side) CScriptWeakRef ref; asIScriptFunction *callback; void SetCallback(asIScriptFunction *cb) { ... callback = cb->GetDelegateFunction(); CScriptWeakRef ref(cb->GetDelegateObject(),cb->GetDelegateObjectType()); cb->Release() ... } void CallCallback() { void* object = ref.Get(); if (object == NULL) return; // Call callback with 'object' } And its all good? I know ref being a local object instead of being a pointer and using ->Release() is a bit naughty, but it should be OK as long as I never give ref back to the script engine right?
  14. PowerFunction @powerCallback; void Interact(User @ user) { if (mOwner.GetObject().mState > 0) { gObjects.RemovePowerDraw(powerCallback); mOwner.GetObject().mState = 0; } else { powerCallback = PowerFunction(this.UpdatePower); // Must pass same callback object to add and remove gObjects.AddPowerDraw(powerCallback); mOwner.GetObject().mState = 2; // Start with power off; } } Seems to have fixed it, but that seems kinda messy to have to store the callback in the object to remove it (And I add/remove callbacks elsewhere), is there any way to change my C++ code to compare the callback objects how I want?
  15. Hi. I have the following Angelscript code: class ElectricLightSource { void Interact(User @ user) { if (mOwner.GetObject().mState > 0) { gObjects.RemovePowerDraw(PowerFunction(this.UpdatePower)); mOwner.GetObject().mState = 0; } else { gObjects.AddPowerDraw(PowerFunction(this.UpdatePower)); mOwner.GetObject().mState = 2; // Start with power off; } } } And the C++ functions called are: ...     r = scriptEngine->RegisterFuncdef("void PowerFunction()"); assert( r >= 0 );     r = scriptEngine->RegisterObjectMethod("ObjectManager", "void AddPowerDraw(PowerFunction@)", asMETHOD(ObjectManager,AddPowerDraw), asCALL_THISCALL); assert( r >= 0 );     r = scriptEngine->RegisterObjectMethod("ObjectManager", "void RemovePowerDraw(PowerFunction@)", asMETHOD(ObjectManager,RemovePowerDraw), asCALL_THISCALL); assert( r >= 0 ); ... std::vector<asIScriptFunction*> mPowerCallbacks; ... void ObjectManager::AddPowerDraw(asIScriptFunction* function) { mPowerCallbacks.push_back(function); } void ObjectManager::RemovePowerDraw(asIScriptFunction* function) { std::vector<asIScriptFunction*>::iterator cur = mPowerCallbacks.begin(), end = mPowerCallbacks.end(); for (; cur != end; cur++) { if (*cur == function) { --end; if (cur != end) *cur = *end; mPowerCallbacks.pop_back(); return; } } } My problem is that the remove call, "if (*cur == function)" never passes. What am I doing wrong?