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

jpf91

Members
  • Content count

    0
  • Joined

  • Last visited

Community Reputation

122 Neutral

About jpf91

  • Rank
    Newbie
  1. I now tested what happens with exceptions in GLFW callbacks on linux to verify my claims and it also depends on the compiler:   DMD: program aborts GDC: exceptions propagate through C code   So with windows we now have 3 options: Exceptions might propagate The program may crash Exceptions might get ignored I guess I'd call that undefined behaviour ;-)
  2. Nice article! Some comments:   in the D code example, log.writefln should be _log.writefln     This is a little misleading. According to TDPL scope guards and finally statements can be skipped for errors and there are probably some more differences between Exception and Error. Of course in your case it does make sense to catch Errors but it's probably much safer to print a log message and call abort() ASAP.   glfwSetWindowCloseCallback should only accept nothrow functions for some additional safety.     I assume you tested this on windows? Do exceptions really not propagate through language boundaries on windows? On linux D exceptions often can propagate through C code (this depends on the exact compiler settings) but of course it usually messes up the internal state of those C libraries.
  3. It would need lots of string manipulation / appending and I think that's known to be slow so it might indeed not be feasible yet.   I hope at some time CTFE will be backed by something like LLVM JIT and a proper GC. Actually in many cases in CTFE a region allocator could already help a lot regarding memory usage: enum int x = ctfeFun(); allocate everything in ctfeFun in a region, free region when x has been calculated. As ctfe functions can't have side effects that should be simple.   But there are probably more important issues right now than these performance optimizations.  
  4. In that regard Germany is stuck in the stone age. Althought we don't have to pay any fees for college which is a big plus, I don't know of even one free online course. That's because of intellectual property crap, you can't even get the slides for a lecture if you don't attend it physically as it might contain copyrighted images. So what they usually do is password protect the slides and give out the password in the first lecture...   Kinda ironical how my experimental physics prof recommended watching Walter Lewins course (MIT).
  5. Here's a third solution: fooPtr = cast(typeof(fooPtr))getPtr(); and in bindFunc, "ref void* func" could be used instead of void**, that's a little nicer imho.   What would be really cool is if someone could come up with a compile-time only system which allows to write one binding and compile it to dynamic/static binding depending on a version statement:   //All done in ctfe string genCode() { Libarary lib = Library(); lib.addLib("linux", "libGL.so"); lib.addLib("linux", "libGL.so.1"); lib.useStaticVersion("DerelictGLStatic"); lib.aliasPrefix = "da_"; lib.setBindFunc(gl_Bind); //preferably pass by alias, not a string constant lib.addFunction(GLEnum, "glGetError"); lib.addFunction(void, "glGenVertexArrays", GLsizei, GLuint*); return lib.genCode(); } mixin(genCode());
  6. The only 'portable' way I know would be to write accessor functions in c, then add bindings to those. C: [CODE] int get_x(foo_t foo) { return foo.x; } [/CODE] D: [CODE] extern(C) int get_x(foo_t); struct foo_t { int flags; //to make sure the struct has the correct size int x() @property { return get_x(this); } int y() @property { ... } int z() @property { ... } } [/CODE]
  7. [CODE] alias int MyEnum; enum { ME_FOO, ME_BAR, ME_BAZ } [/CODE] One more problem with this is that it doesn't work with final switch. BTW: There's a better C<=>D type table on this page: [url="http://dlang.org/interfaceToC.html"]http://dlang.org/interfaceToC.html[/url] It's too bad we often have duplicate and outdated information on the D website.
  8. Well, there really should be some way to do exactly this without the alias, but I can't make it work. BTW: It's not that surprising that it works: The D part is just a data field/variable, it doesn't have any calling convention. extern(C) only affects it's name mangling, nothing else. Just like extern(C) char* test; and char* test; are exactly the same except for name mangling. The underlying type can still be everything, even a C function.
  9. The "--export-dynamic" flag was added when stack traces were implemented. IIRC without that flag stack traces only show function addresses, but no function names (Thinking about it: this seems like a hack to solve a huge bug. I guess all phobos code should actually be declared with 'export'). If I understood correctly, your issue is that the names of the derelict function pointers now clash with the original names. This is the way the function pointers are declared in derelict: [code] module test; extern(C) { int function(void* test) FT_Init_FreeType; }[/code] This means: I want a function pointer to a extern(C) function. But it also means: I want that function pointer to be extern(C) --> have C name mangling. The resulting symbol is the following: "00000000 B FT_Init_FreeType". The alternative is this: [code] module test; alias extern(C) int function(void* test) FTInitFunc; FTInitFunc FT_Init_FreeType;[/code] This doesn't declare the pointer itself as extern(C), the resulting symbol is: "00000000 B _D4test16FT_Init_FreeTypePUPvZi" . So it uses D name mangling and there shouldn't be clashes anymore. However, I can't find a way to declare this on one line / without an alias?