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

Hardguy

Members
  • Content count

    279
  • Joined

  • Last visited

Community Reputation

244 Neutral

About Hardguy

  • Rank
    Member
  1. [quote name='Andreas Jonsson' timestamp='1337090424' post='4940409'] Should someone like to implement the feature for me I'd gladly add it to the library though. [/quote] Oh, you so sneaky ;) Do you mean implement in a something like script_builder? Or directly in the lib? If in script_builder I could give that a go, but not sure how to go about., so any pointers might persuade me to do it
  2. I am wondering if there is anyway to do something like: [code]class cMyClass { int mlCount=0; } [/code] or if that is not possible, some way at least let all the basic types (float, int, etc) be 0 from start? The only way I can think of now is to iterate all of the member vars upon creating a class object and then zeroing them. Is there any simpler way to achieve this or even better to do something like the sample code above. When scripting, it is often very convenient to declare member variables near the method where they are used, and thus it can be cumbersome to always go to the construct to init them. For instance: [code]class cMyClass { .... int mlNumOfSlugAttacks=0; SlugAttacksPlayer() { mlNumOfSlugAttacks++; if(mlNumOfSlugAttacks>3) DoSomething(); } ... }[/code] Any ideas on ways to achieve this would be very helpful! Perhaps I am missing some feature that is already in the language?
  3. What kind of sorcery is this! Classes in Amnesia Script! More seriously, Amnesia use AngelScript very simplistically and we never used classes when creating the game. Now I got kind of curious on what you are using it for, care to share? [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  4. Late reply [quote name='Andreas Jonsson' timestamp='1326489145' post='4902453'] Are you by any chance copying the ref counter too? That mustn't be done as it would screw up the memory management. [/quote] Ah yes! That was the problem! Thanks!
  5. Note that that code does not make any sense to use, and it was just me setting "shared" where it was not really needed. Still it might be something worth looking into, as it is still a bug? Or perhaps something that the compiler should report as invalid?
  6. I made a bunch of testing now and found out my code example was wrong! Here is how to reproduce: [code]shared class iTest_Interface { void HelpFunc(){} int mlBaseData; } //----------------------------------- class cTest : iTest_Interface { cTest() { } void DoSomething() { Print(" Inside DoSomething 1\n"); } }[/code]
  7. And that test produces a memory leak.
  8. I only use [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left]asOBJ_REF as flag.[/left][/size][/font][/color] [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left]Here are the factories:[/left][/size][/font][/color] [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][code][/left][/size][/font][/color]RegisterFactory("", Factory_cBoundingVolume_Default); RegisterFactory("const cVector3f &in avMin, const cVector3f &in avMax", Factory_cBoundingVolume_MinMax); RegisterFactory("const cVector3f &in avSize", Factory_cBoundingVolume_Size);[/code] Here is the script: [code]void main() { cBoundingVolume @pBV = GetBV(); cBoundingVolume copyBV = pBV; Print("Done!\n"); }[/code] Here is the bytecode output: [code]void main() Temps: 2, 10 Variables: 001: cBoundingVolume@ pBV 003: cBoundingVolume copyBV 002: cBoundingVolume {noname} 010: tString {noname} 0 0 * PUSH 10 - 3,2 - 1 10 * SUSPEND 2 10 * VarDecl 0 2 10 * CALLSYS 4125 (cBoundingVolume@ GetBV()) 4 10 * STOREOBJ v2 5 10 * PshVPtr v2 6 11 * PSF v1 7 12 * REFCPY 0x3dc6598 9 11 * FREE v2, 64775576 11 11 * POP 1 - 4,2 - 12 10 * SUSPEND 13 10 * VarDecl 1 13 10 * ChkNullV v1 14 10 * VAR v1 15 11 * CALLSYS 218 (cBoundingVolume@ _beh_2_()) 17 11 * STOREOBJ v3 18 11 * PshVPtr v3 19 12 * GETOBJREF 1 20 12 * CALLSYS 227 (cBoundingVolume& cBoundingVolume::opAssign(const cBoundingVolume&in)) - 6,2 - 22 10 * SUSPEND 23 10 * STR 0 (l:6 s:"Done! ") 24 12 * PSF v10 25 13 * CALLSYS 351 (tString _string_factory_(const int, const uint8&)) 27 10 * ObjInfo v10, 1 27 10 * PSF v10 28 11 * CALLSYS 4123 (void Print(tString&in)) 30 10 * PSF v10 31 11 * CALLSYS 343 (void tString::_beh_1_()) - 7,2 - 33 10 * ObjInfo v10, 0 33 10 * SUSPEND 34 10 * FREE v3, 64775576 36 10 * FREE v1, 64775576 38 10 * 0: 38 10 * RET 0[/code]
  9. When using the shared keyword for an interface a class uses, I can not longer reload it properly. Script code is something like [code]shared interface iMyInterface { void MyFunc(); } class cMyClass : iMyInterface { void MyFunc() { //Do stuff } }[/code] If I reload this script then calling MyFunc() from C++ code no longer works. The way I reload is to use DiscardModule() in script engine and then create it from scratch (just like I did the first time it was created). If I remove "shared" from iMyInterface declaration, all works fine.
  10. Quickly summarized, the problem is that when I assign a value from a c++ created object (handle) to a script created one, memory is not freed properly. The code looks like this: [code]cBoundingVolume@ pCharBV = GetBoundingVolume(); cBoundingVolume bvCopy = pCharBV;[/code] This does not release the memory of cBoundingVolume (I am not sure of the exact script place the memory allocation takes place but can try and find out if needed) and I get a memory leak. However,this code works just fine: [code]cBoundingVolume@ pCharBV = GetBoundingVolume(); cBoundingVolume bvCopy;[/code] GetBoundingVolume is a c++ function and has this declartion: [code]cBoundingVolume@+ GetBoundingVolume()[/code] I am guessing that the problem might be that I am not declaring the copy operator correctly? Currently it looks like this: [code]RegisterOperator("cBoundingVolume &opAssign(const cBoundingVolume &in)", asMETHODPR(cBoundingVolume, operator =, (const cBoundingVolume &), cBoundingVolume &) );[/code] Do I need to do something different for it to work? (as in increasing a user count in cBoundingVolume?) I was not sure exactly what code is needed, so just say if you need to see more in order to locate the problem!
  11. (Late answer, got no e-mail notification that I got a reply...must check settings) So what I do is simply: [code]shared class cMyClass {}[/code] and [code]shared interface cMyClass {}[/code] for anything that will be used by several modules?
  12. I have gotten a exception when using an enum across several modules. Here is the setup (in simplified form): [b]interface.code:[/b] [code] enum eMyEnum { eFirst, //.... } interface iMyInterface { void SomeKindOfAction(eMyEnum aData); }[/code] [b]implemented.code:[/b] [code]#include "interface.code" class cMyClass : iMyInterface { void SomeKindOfAction(eMyEnum aData) { ///... } }[/code] [b]main.code:[/b] [code]#include "interface.code" void DoSomething() { //GetMyClass is implemented in C++ and returns cMyClass as implemented in "implemented.code" iMyInterface @pData = GetMyClass(); pData.SomeKindOfAction(eFirst); } [/code] One module is built from "implemented.code" and one from "main.code". When running DoSomething() the script returns that an exception has occured when calling the line: pData.SomeKindOfAction(eFirst); If I change to eMyEnum to int all works fine and there is no exception. Am I doing something wrong here or might this be a bug, or just a limitation of the script? Bonus questions: 1) If this is an error, does this apply to classes aswell? (Do I need to use interfaces as params?) 2) If enums cannot be shared across modules, is it possible to do: [code]int x=0; eMyEnum e = x;[/code] Some how?
  13. Is it possible to call a method in an object by passing a string, like is done with ExecuteString in scripthelper.cpp? I check the code and from what I can see it is not possible to extend to include object methods as that requires knowledge of the actual object pointer (which [url="http://www.angelcode.com/angelscript/sdk/docs/manual/classas_i_script_module.html#1258d7cfeed965f36ba312beeb49e81c"]CompileFunction[/url] does not). So is this possible in some other way? And if so, how do I go about? Reason for wanting this, is because it is a more secure way for script to call methods in other modules.
  14. Is it possible to call a method in an object by passing a string, like is done with ExecuteString in scripthelper.cpp? I check the code and from what I can see it is not possible to extend to include object methods as that requires knowledge of the actual object pointer (which [url="http://www.angelcode.com/angelscript/sdk/docs/manual/classas_i_script_module.html#1258d7cfeed965f36ba312beeb49e81c"]CompileFunction[/url] does not). So is this possible in some other way? And if so, how do I go about? Reason for wanting this, is because it is a more secure way for script to call methods in other modules.
  15. Another thing I found. Need to add: [code] //Skip any white spaces in case meta data follows: t = engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len); while(t == asTC_COMMENT || t == asTC_WHITESPACE) { pos += len; t = engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len); } [/code] At the end of the section that checks handles the start of class, ie the one that starts with: [code]if( modifiedScript.substr(pos,len) == "class" ) {[/code] Sorry for spamming changes, but seemed so small that was not worth to upload the entire code.