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

Zanman777

Members
  • Content count

    22
  • Joined

  • Last visited

Community Reputation

219 Neutral

About Zanman777

  • Rank
    Member
  1. I'm going slightly mad on this.   I've been trying to learn OpenGL. I've never learnt 3D programming / math (in a very solid way, anyway). I do know some basics about vectors, matrices, matrix multiplication, the identity matrix, how matrices store rotations, scaling and other transformations. I've read a couple hundred pages from 3D Math Primer for Graphics and Game Development, but that was at least a year ago. Furthermore, I guess there probably are some gaps in my 3D knowledge.   Lately, I tried to learn OpenGL through the Red Book. However, the book isn't very beginner-friendly. So after googling for a while I tried to learn from the arcsynthesis.com tutorials. I was doing very good until the perspective projection tutorial (http://www.arcsynthesis.org/gltut/Positioning/Tut04%20Perspective%20Projection.html). I don't get all that math on the "Camera perspective" section, tbh I think it's poorly explained (the rest of the tutorial is top-quality, though, gotta be fair).   From arcsynthesis I jumped to scratchapixel.com. The perspective projection matrix lesson (http://scratchapixel.com/lessons/3d-advanced-lessons/perspective-and-orthographic-projection-matrix/perspective-projection-matrix/) got me understanding things a bit better, but I'm starting to get really confused as scratchapixel.com and arcsynthesis.com seem to take slightly different approaches.   From what I understand, the homogeneous coordinates (as scratchapixel.com calls them) are acquired by dividing x,y and z by w. Those will then be the NDC (normalized device coordinates, as arcsynthesis calls them), right? Arcsynthesis seems to say that we "prepare" the perspective projection by setting the correct w coordinates for each vertex and letting the hardware do the rest:     However, the same Arcsynthesis states: ...then it proceeds to explain how to feed the clip space with already-processed vertex coordinates (in a way that gives the sense of perspective). I'm confused... Isn't that effect achieved by setting the correct w values for the perspective divide, which happens during the conversion from clip space to NDC???   Scratchapixel.com, on the other hand, defines the perspective divide as some sort of process of making w equal to z, so that dividing the coordinates by w will simultaneously make them homogeneous and fit into the z = 1 plane (which is considered the image plane in their example, or projection plane as arcsynthesis calls it).     So technically, the perspective projection occurs from the conversion from clip space into NDC, NOT before feeding the clip space coordinates (as arcsynthesis stated)! Am I right?   Things are starting to get really messy in my mind, and I'm wondering if I should just pick a textbook on this subject and learn it all the hard way. Subsequent concepts mentioned by scratchapixel.com like far view and near view are also unclear to me, though there are previous tutorials on scratchapixel.com that should enlighten me about those. The question is... should I keep on hopping from place to place to figure out stuff one thing at a time, or would I better grab a textbook? If so, which one?   Any help would be very appreciated. This is starting to harm my motivation to learn OpenGL. It really gives the sense of overwhelmingness (just made up a new word).
  2. Hi, Zero_Breaker. I feel exactly like you. And I understand why you feel so demotivated. The thing is, you're probably (subconsciously, anyway) thinking you'll be learning all this C++ again and forget it again soon. Other reason for your low morale is you don't get to see results of what you've learned. Finally, the third factor is probably you don't feel trully commited to the whole process of digging in, learning and doing.   Programming is a very, very demanding task. You have to learn C++ (considering your approach now). Then, you need to learn 2D/3D math. Then you need to learn how to use a graphics library (OpenGL, or SDL, or a 3D engine...). In the meantime you need to learn how a game is actually coded - the logic of the game loop, how to integrate several source and header files, how to organize the whole code... The list goes on and on.   Don't feel guilty because you're not getting to the finish line. It does take a long, long time. The important thing here is you like the journey, not just the final destination. I'm saying this but I'm on the same boat... I also keep getting lost on what to do next, what to learn next. Maybe we could learn together? I'm sure it would boost the heck of our morales, to share thoughts, maybe even programming stuff together?   If anyone else reading this is on the same boat, drop me a msg or reply to this topic, maybe we could gather a "beginners" group to keep everyone motivated and to help each other learning stuff.   That being said, and replying to your post, I'd say the book you chose (C++ Primer 5th Edition) is a very, very good choice. It's the book I chose too. It gets very deep into C++, and it may be tiring to finish it, but believe me, it will be worth it. It helps to really understand how C++ works. It will help you to avoid magical bugs and compiler warnings/errors popping out of nowhere because you will trully master the dirty details of it all. So be easy on yourself. You're going the right path, but it's also the hardest one. My approach to your problem (feeling demotivated, bored...) was this: taking notes on the details that will most probably be forgotten in a couple of days (because they're not used enough) but represent potential pitfalls when it comes to code. I made a kind of personal "cheat sheet" with some 15 pages of notes about everything I'll need to remind myself of when I want to code. The book itself has over 1000 pages iirc, so bringing it down to 15 pages is a major sense of accomplishment by itself. Heck, I'll share my cheat sheet with you if it helps you, no problem :)   Concerning the bookstore stuff, I can help you with that if you want. Send me PM if you're interested   Cheers ;) 
  3. I'd enjoy programming with other people while we learn, and/or share ideas and thoughts. [snip]   Who's interested? You can add me on skype, my email is [deleted]   I've tried posting this in the classifieds but didn't get replies, so I'm trying here now, [snip]
  4. My purpose was to draw buttons' borders. There is no way to specify the SDL_Rect border width, so I was trying the line approach. How can I draw a customisable button border, then?
  5. I can't find a way to set a line width for the SDL_RenderDrawLine function, but I can't believe there's no way to set it. That's just... basic. Is there really no way to do so? Are the lines always 1 pixel wide, or what?   EDIT: Found an extension library (SDL_GFX) that provides that feature. It's wierd native SDL doesn't have that, though...
  6. Oh, so with your code suggestion the SDL_Texture won't go out of scope? If so, it's piece of cake.   Yeah, it's working now, but getting rid of a member that only gets used on one member function would be a plus
  7. graphics.h class Graphics { public: void renderBMP(std::string path, int posX, int posY); private: // the textures container. The strings will be the file paths map<string, SDL_Texture*> textures; SDL_Texture *textureToLoad; // temporary texture holder for the loading function. The workaround. }; graphics.cpp /*  Search for this BMP's path on the textures container. *   If it doesn't exist, load it to the container. *   If it already exists, retrieve the texture from the container. */ void Graphics::renderBMP(std::string path, int posX, int posY) { if (textures.find(path) == textures.end()) // If this texture isn't loaded yet { SDL_Surface *tempSurface = SDL_LoadBMP(path.c_str()); textureToLoad = SDL_CreateTextureFromSurface(renderer, tempSurface); SDL_FreeSurface(tempSurface); textures[path] = textureToLoad; } else { textureToLoad = textures[path]; } // the rest doesn't matter } This is how I have it, after a little workaround.   I was trying to avoid the need of a class member (in this case, textureToLoad) to hold the new SDL_Texture after the renderBMP() function has gone out of scope.   What I was trying was this: void Graphics::renderBMP(std::string path, int posX, int posY) { if (textures.find(path) == textures.end()) // If this texture isn't loaded yet { SDL_Surface *tempSurface = SDL_LoadBMP(path.c_str()); textures[path] = new SDL_Texture(SDL_CreateTextureFromSurface(renderer, tempSurface)); SDL_FreeSurface(tempSurface); } // blablabla I was getting the error again this way.   In the meantime I found out that SDL isn't prepared to be used in such a way that means creating SDL_Textures directly (without the pointer interface). Quoting a site I found http://stackoverflow.com/questions/18897076/sdl-texture-incomplete-type):   This I why I decided to use the workaround.
  8. Yes, SDL uses pointers to SDL_Textures. I tried to make a map of strings to SDL_Textures pointers instead. The problem is solved...temporarily. When a member function of that class tries to access/create/assign/whatever and so dereferences one of the pointers on the map, the problem pops up again - error: 'std::pair<_T1, _T2>::second' has incomplete type... So instead of getting an error on the map template instantiation, I get an error when using the map...
  9. I want to define a class with a member map container that maps strings to SDL_Textures. The purpose is to hold loaded textures for reusage. class A { map<std::string, SDL_Texture> textures; }; When I try this, I get this error: error: 'std::pair<_T1, _T2>::second' has incomplete type How do I enforce the definition of SDL_Texture before the declaration of the textures map, to stop this error?
  10. I thought I had understood it. But now this site is confusing me... http://www.informit.com/articles/article.aspx?p=1852519 class C { int x=7; //class member initializer The way I understood it, this shouldn't be a class member initializer. It should be an assignment instead....     And how can these two be similar? That's exactly what I was trying in the first place!   class C { string s("abc"); C() : s("abc")
  11. OH, now I get it!! (And now I realize I was being very "duh"... But hey, I'm a newbie... Thanks for the patience)   So a class can take an assignment like this: class Foo { private: int bar = 0; }; But no initializations can happen outside the class initializer itself. Member initializations must happen in the class initialization too. Hence only this is valid: class Foo { public: Foo() : bar(0) {} private: int bar; } So... class Foo { private: int bar = 0; /* This ALWAYS works as an assignment operator, never as an initializer, even if no initializer is * provided for this member in the class initializer list / body. */ }; If I'm thinking wrong just tell me, please     So, what way would you use to turn around this? Personally I'd rather have an initializer together with the definition, so if I want to add new buttons later on, I don't have to add a definition in one place and an initializer in another. Would it be advisable to define & initialize the buttons in file scope instead (to be able to have them in one code line)? Just asking for a little tip from the pros here..     So there is a way to initialize on the member list with C++11? Or were you talking about the initialization list (with the ":", etc)? BTW I took the advice on avoiding using namespace std. Thanks for that one
  12.   But if I do that, I need to have a bStart class (as far as I can tell, in your example Game's constructor is being delegated to a bStart's constructor)... Right? Or am I seeing it wrong?   Maybe it's obvious, but I'm a novice programmer, I'm really not understanding this... Thanks for the replies so far!
  13. Like that? Like what? Can you please elaborate? I didn't get what you mean...   I can initialize integers this way, but not strings (at least not using a string literal directly). By "this way" I mean: SomeDefinedClass Object(value1, value2, value3); Yes, I did #include <string> and using namespace std; on the header file
  14. Hello there.   I've been trying to make my very first game . Right now I'm at the menubuilding stage.   I'm trying to have a button class that can be initialized with its caption, X and Y relative coordinates, width and height. However, when I try to create an instance and initialize its caption, I get a compiler error: error: expected identifier before string constant Here's the code that matters (I'll point out with a comment the line where the error occurs).   GUI.h class Button { public: Button(string c, int pX, int pY, int w, int h) : caption(c), percX(pX), percY(pY), width(w), height(h) {} private: int width; int height; // The percentage of X and Y displacement relative to total screen width/height. // Counting from the left/up. int percX; int percY; string caption; }; game.h: class Game { public: // blablabla private: // more blablabla // GUI elements Button bSstart( "StartGame", 50, 20, 50, 5); // --> ERROR OCCURS HERE Button bOptions( "GameOptions", 50, 25, 50, 5); Button bHighScores( "HighScores", 50, 30, 50, 5); Button bAbout( "About", 50, 35, 50, 5); Button bExitAll( "ExitGame", 50, 40, 50, 5); I can't figure out what's wrong... I'm passing a string literal to initialize a string (the button's caption). Why would I need an identifier?