• 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

820 Good

About ifthen

  • Rank
  1. If you use the raw pointer solution SiCrane posted, don't forget to delete the pointer in the new bullet maker and after the end of the program so you won't leak memory!   E.g. ... Bullet * myBullet = 0; //nullptr instead of 0 if using C++11 while (!quit) { if (shootNew) { delete myBullet; //does nothing if myBullet is null myBullet = new Bullet(); } if (myBullet != 0) myBullet.doSomething(); } delete myBullet; ... If you don't, the old bullets are still in memory, so after pressing the fire button 2000 times, there are 2000 bullets in memory. Yuck.
  2. As has been said, use std::vector::back() or vec[vec.size()-1], but ALWAYS check if the vector is not empty. Using either of those without checking for non-emptiness results in undefined behaviour and it will most likely overwrite sizeof(vectype) bytes before the start of vector data, corrupting the memory or causing a segmentation fault.   vec.at(vec.size()-1) throws an exception if the vector is empty, but it sacrifices speed and does not solve the problem except for alerting you instead of corrupting memory.   Paradigm Shifter: You, sir, have made my day.
  3. It can be done quite easily. There are many uses of this technique, e.g. packets. When retrieving those data, bit AND them by the bits you want to retrieve and right shift them so the least significant bit you want is lowest in the retrieved value. Example: You want bits ...00xxxx00 in the int you have. You bit AND 00111100 (called the mask, this number is hex 0x3C) with your int and right shift it by 2 (the offset).     int result = (myInt & 0x3C) >> 2;     ("I grab only the bits that interest me and shift them so I get a number with values starting from zero.")   Setting the value is quite similar - you bit AND with the inverse of 0x3C (that means 0x3C EXCLUSIVE OR (^) 0), so the bits that interest us are zeroed (not needed when you know all of those bits are already zeroed), and then OR the left-shifted setValue. Note that having the value larger than your storage limit overwrites upper bits, so be wary of what you are doing!     int modified = ((0x3C ^ 0) & (myInt)) | (setValue << 2)     ("I decide which bits interest me, get the opposite (those that don't interest me) and leave only them, effectively zeroing the bits that interest me. Then I shift the setValue so I write it to right bits and add it to the modified number, effectively setting the bits that interest me and are 1 in the setValue.")   Also, you can compute the mask (0x3C) like this:       int mask = 0; for (int i = 0; i < numInterestingBits; i++) {   mask << 1;   mask += 1; } mask = mask << offset; //also written mask <<= offset; And that is it. Be sure to make your own functions for it so you don't rewrite it for every value retrieval!
  4. I personally use PSPad. Its behaviour in these situations is similar to Programmer's Notepad mentioned by Servant of the Lord.
  5. Will every projectile be different? I do not think so, we can say that every projectile behaves according to its type. Make every projectile have some kind of reference to its type (enum, pointer, reference, ID...). That is 8 bytes overhead at most, which is perfectly okay. You then modify the enemy using the projectile type and are okay.
  6. The way I have seen animation implemented in game engines has been quite the same everywhere: they define a class (let's say Animation) that has a method Update(timeFromLast) and a variable animationTime. Update adds timeFromLast to animationTime and finds the current frame (or interpolation of them). There is usually also an enum that specifies the behaviour at the beginning/end; without interpolation, loop and stop are probably the only reasonable behaviour.   Drawing an animated object is simple then: you usually take the current frame from Animation in draw() function of your model and make the magic there.
  7. Well... you could be rendering your objects with the Z axis set to zero (if you are rendering "fake 3D" orthogonal tilemaps and not true 3D ones). Make sure that you translate them properly to the screen. If you are using the old fixed-pipeline OpenGL, you can simply translate the object like this //in the drawing routine void drawSomeObject() { int Z = 5; // from 1 up, if you want to use 1 too, lower "near" to 0.5 or something so the object is not clipped due to floating errors glTranslate(0,0,Z); //draw it somehow, e.g. using glBegin()/glEnd() glTranslate(0,0,-Z); }   The objects with higher Z value (i.e. farther from you) will be obscured by the objects with lower Z value if you do this.
  8. Well... I am certainly not an oracle, so... Are you talking about 2D or 3D? Which programming language are you using and which graphics library/engine?
  9. glOrtho() takes six parameters: left clipping plane, right clipping plane, a top one and a bottom one, and values of "near" and "far", respectively. What do the last two values mean? Other than being clipping planes, too (making the viewport of glOrtho() look like a cube in which you look into from one side), they are essential for making the depth buffer work. The depth buffer stores the values not in the linear sense, but we can roughly say that they are inversed (as in 1/depth), so the precision is lost only far away from camera where we don't see it. However, this is only "roughly" - the actual equation is much more precise and depends greatly on relationship of "near" and "far" values.   Your problem is that near is 0 in your case, that means that the relationship of "near" and "far" is zero division; that means you lose all of your depth buffer precision. The solution? Set near (the second-last parameter to glOrtho()) to 1.0. It is maybe not the only cause of your depth buffer problem, but it is certainly one of them.
  10. Well, could you paste code which you have so far? We are not wizards and we have not seen your code, so we do not know what is wrong with it.
  11. Sniper Elite. The game specifically makes you very weak at close range, forcing you to shoot the enemies from the longer range.