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

Bill Door

Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

360 Neutral

About Bill Door

  • Rank
    Newbie
  1. A similar (but more in-depth) technique I have used is called "Runtime Polymorphism" or originally "Concept-based Polymorphism". This polymorphism is different than inheritance. The technique is described in "Better Code: Runtime Polymorphism" (PDF) and in the video "Value Semantics and Concepts-based Polymorphism" from C++ Now! 2012.
  2. Regarding casting -- #gonrogon advice is sound. To add a bit, whenever you use a cast, any of the cast's but especially C-style casts, you are saying that you are smarter than the compiler. That's a risk that I don't like to take unless I am very confident.    If I use a cast, it's because I tried without the cast and the compiler told me what I needed to do to get the cast that I wanted. The compiler is your friend.
  3. Your example works because the deleted object is the type with the virtual destructor.  e.g.        B *p = new AB;     delete p;   However,       A *p = new AB;     delete p;   I would expect that this would not call the destructor for AB or B.   In the first example, the object is of type B, which has a virtual destructor, which causes the virtual table to be used which calls the destructor for AB, which in turn destroys, A and B.   As an object of type A, the compiler has no idea that it should do anything except call the destructor for A. There is no virtual table to access, so only the destructor for A is called.
  4. Your ROOMCLASS is not properly copyable. A vector copies and owns each object as it is inserted into the vector. A new ROOMCLASS instance is created using the copy constructor and the old one is deleted. vector requires copyable classes. I expect that you wrote ROOMCLASS so that it properly destroys the texture when it is deleted. You need a system for copying the texture reference or creating a new texture reference in the new instance of ROOMCLASS. shared_ptr is often referred to for this purpose. I consider shared_ptr a crutch. Each class should learn to manage it's own resources. In this case, perhaps a management class for textures that uses shared_ptr would be useful. I would avoid using shared_ptr as a requirement for using HOUSECLASS.
  5. This is not the canonical method of erasing elements from a vector. Take a look at remove_if in algorithms. The typical problem is that the iterator is invalid after the erase. iterator it = remove_if(enemyVector.begin(), enemyVector.end(), YourPredicate); Then use this new iterator to visit the removed elements to delete them. I would then revisit to erase all in one block. for_each(it, enemyVector.end(), DeleteFunction); enemyVector.erase((it, enemyVector.end()); Three functions calls, two simple (inline) functions.
  6. The question would be why do you think STL has "overhead"? Each container has it's expected expectations and limitations. Understand the expectations and limitations to make your decisions. The c++2011 defines an unordered map (aka hashtable). If you're not using a C++-2011 installation, then you should be able to find something compatible (e.g. boost).
  7. I find it interesting how people seem to overstate how difficult it is to learn programming from C++. I teach high school students programming using Stroustrup's [url="http://www.stroustrup.com/Programming/"]Programming: Principles and Practice Using C++[/url]. This is a text book for an introductory course on computer programming. The students have found the book to be readable, engaging, and useful. There are practical exercise in learning to solve real problems in programming. The language choice is naturally C++. I find C++ to be fine as an introductory programming language.
  8. [quote name='fotogames' timestamp='1341563419' post='4956256'] Thanks for the responses! I'm trying to make some kind of state machine, and I wanted to be able to tell the machine which class the state machine had to make (sounds weird but my english vocab is not broad enough to explain it clearer than this [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img]) However I've been thinking and I don't think I need an infinite state machine, so I'm going to go with a finite state machine. Thanks for the help guys [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] [/quote] Take a look at [url="http://en.wikipedia.org/wiki/Design_Patterns"]Design Patterns[/url]. In particular the [url="http://en.wikipedia.org/wiki/State_pattern"]State[/url] and [url="http://en.wikipedia.org/wiki/Strategy_pattern"]Strategy[/url] pattern. This might help you to work out a solution. I often find the [url="http://en.wikipedia.org/wiki/Flyweight_pattern"]flyweight[/url] pattern useful for state machines.
  9. C++ is a fine language to learn. I teach C++ programming to high school students as a first language. You do not need to learn C first. In fact, learning C first can be a handicap. I introduce programming to the students using [url="http://www.stroustrup.com/Programming/"]Programming -- Principles and Practice Using C++[/url]. This book teaches programming, while using C++ as the example language. Learning the techniques of problem solving with programming is key to learning to program. C++ is the language of choice for this book. Good luck and Enjoy.
  10. [quote name='jlouts' timestamp='1315658349' post='4859961'] I believe you have to make the Render function in CMenueButton virtual as well to override CMenueElement's Render function. [/quote] In C++, once virtual always virtual. The declaration of virtual in the base class is sufficient. Overrides in other subclasses will also be virtual.