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

50_Cal

Members
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

116 Neutral

About 50_Cal

  • Rank
    Newbie
  1. Thanks man. The usage of const is a thing that should be considered and I missed it before For the last one, I just don't know why I did that yesterday. Just want to check if Customer is added?
  2. Is there a reply or @ function here?   Thanks for the advises, they are extremely helpful to me. One thing, imo, for the line 14-17. I thing it's fine to write a constructor in this way, it's just and other way to initial some member variables. It works on Visual Studio Thanks again, I'm going to redesign the thing 
  3. I recently finished some C++ practices from my teacher and he told me my answers got a classic issues. I'm pretty new and I really can't figure it out, so, give me a hand please. Thanks.   Here is the question: Describe the bad design of the following codes and redesign the classes. class Customer { public: int birthYear; bool isCurrentMember; int numberOfPurchases; Customer() { // Test data. birthYear = 1963; isCurrentMember = false; numberOfPurchases = 33; } void DisplayDetails() { printf( "Birth Year: %ld\r\n", birthYear ); printf( "Current Member: %s\r\n", isCurrentMember ? "Yes" : "No" ); printf( "Number Of Purchases: %ld\r\n\r\n", numberOfPurchases ); } }; class Salesman { private: Customer bestCustomer; Customer worstCustomer; public: int id; Salesman( int initialID ) { id = initialID; } Customer BestCustomer() { return bestCustomer; } Customer* WorstCustomer() { return &worstCustomer; } }; class SalesTeam { public: Salesman salesman1; Salesman salesman2; SalesTeam() : salesman1(1000), salesman2(1001) {} void DisplayTeam() { printf( "Salesman 1: %ld\r\n", salesman1.id ); printf( "Salesman 2: %ld\r\n", salesman2.id ); } }; void TestSalesmanCustomers() { SalesTeam ourTeam; int medianSales_1 = (ourTeam.salesman1.BestCustomer().numberOfPurchases + ourTeam.salesman1.WorstCustomer()->numberOfPurchases) / 2; int medianSales_2 = (ourTeam.salesman2.BestCustomer().numberOfPurchases + ourTeam.salesman2.WorstCustomer()->numberOfPurchases) / 2; printf( "Salesman median sales = %ld\r\n", medianSales_1); printf( "Salesman median sales = %ld\r\n", medianSales_2); }   And here is my answer Header: #ifndef _REDESIGN_H #define _REDESIGN_H #include <stdio.h> #include <list> // Customer class // *In the future this class should provide functions to set // m_birthYear, m_isCurrentMember and m_numberOfPurchases values // in case of changes. class Customer { public: Customer( int birthYear, bool isMember, int numOfPurchases ): m_birthYear(birthYear), m_isCurrentMember(isMember), m_numberOfPurhchases(numOfPurchases) {} ~Customer() {} // functions to get private member variables int getBirthYear() { return m_birthYear; } int getNumOfPurchases() { return m_numberOfPurhchases; } bool checkCurrentMember() { return m_isCurrentMember; } void displayDetails(); private: int m_birthYear; bool m_isCurrentMember; int m_numberOfPurhchases; }; // Salesman class // *In the future, function to search customers by their birthYear, NumberOfPurchases and // memberStats could be added. // *Comparison in function addCustomer() could be extended to consider more // situations include membership status. class Salesman { public: Salesman( int initialID ); ~Salesman() { m_customerList.clear(); } Customer* getBestCustomer() { return m_bestCustomer; } Customer* getWorstCustomer() { return m_worstCustomer; } bool addCustomer( Customer* cust ) int getID(); private: Customer* m_bestCustomer; Customer* m_worstCustomer; int m_id; // Container to store list of customer pointers std::list<Customer*> m_customerList; bool m_firstTime; }; // SalesTeam class // *Function to remove a salesman from saleteam by id could be implemented // in the future. // *Function to calculte particular salesman's median sales nunmber can be implemented class SalesTeam { public: SalesTeam() {} ~SalesTeam() { m_salesmanList.clear(); } bool addSalesman( Salesman* sales ); Salesman* getSalesman( int id ); void displayTeam(); private: // *Container to store list of salesman pointers. // *Makes the class more flexible and easier to // handle. std::list<Salesman*> m_salesmanList; }; #endif  CPP: #include "Redesign.h" //-------------------------------------------------------------------- // Customer class implementations void Customer::displayDetails() { printf( "Birth Year: %ld\r\n", m_birthYear ); printf( "Current Member: %s\r\n", m_isCurrentMember ? "Yes" : "No" ); printf( "Number Of Purchases: %ld\r\n\r\n", m_numberOfPurhchases ); } //------------------------------------------------------------------- // Salesman class implementations Salesman::Salesman( int initialID ) { m_id = initialID; m_firstTime = true; m_bestCustomer = 0; m_worstCustomer = 0; } int Salesman::getID() { return m_id; } bool Salesman::addCustomer( Customer* cust ) { // Finds out best and worst customer by comparing their // number of purchases if( cust ) { // First time initials if( m_firstTime ) { m_bestCustomer = cust; m_worstCustomer = cust; m_firstTime = false; } m_customerList.push_back( cust ); // comparison if( cust->getNumOfPurchases() >= m_bestCustomer->getNumOfPurchases() ) m_bestCustomer = cust; else if( cust->getNumOfPurchases() <= m_worstCustomer->getNumOfPurchases() ) m_worstCustomer = cust; return true; } else return false; } //------------------------------------------------------------------ // SalesTeam class implementation bool SalesTeam::addSalesman( Salesman* sales ) { // Check if pointer valid if( sales ) { m_salesmanList.push_back( sales ); return true; } else return false; } Salesman* SalesTeam::getSalesman( int id ) { auto it = m_salesmanList.begin(); while( it != m_salesmanList.end() ) { if( (*it)->getID() == id ) return (*it); ++it; } return 0; } void SalesTeam::displayTeam() { auto it = m_salesmanList.begin(); while( it != m_salesmanList.end() ) { printf( "Salesman: %ld\r\n", (*it)->getID() ); ++it; } }   Thank you guys
  4. [quote name='Hodgman' timestamp='1346390321' post='4975044'] You need to use the ModelViewProjection matrix, and divide by [font=courier new,courier,monospace]w[/font], not [font=courier new,courier,monospace]z[/font], to get it into screen space. [/quote] [quote name='BLM768' timestamp='1346390761' post='4975045'] To properly obtain the coordinates, I think that you need to multiply the vertex coordinates by the projection matrix and then divide the x/y values by -z. However, I'd recommend considering using the stencil buffer to mask out the non-mirror areas, render the reflection, then render the unreflected scene. It's a bit more complex than that, but that's the general idea. The advantage to this method is that you don't need an additional texture, and the stencil test prevents some of the unnecessary fragment processing from happening. [/quote] Thanks for your help, I will try these methods.
  5. Hello guys. I used FBO to render the reflected stuff to a texture, after that I was confusing how to compute the correct texture coordinate for the texture? Here is the main stuff I wrote in GLSL and it didnt give me the right thing: // VERTEX SHADER varying vec2 v; vec4 vertex = gl_ModelVIewMatrix * gl_Vertex; v.x = vertex.x/vertex.z; v.y = vertex.y/vertex.z; // FRAGMENT SHADER texture2D( reflectTex, vec2((v.x+1) * 0.5, (v.y+1) * 0.5) ); What is wrong with the calculation? or is there another way to achieve it?
  6. Thanks for your replies. Now I get the differences between them.
  7. As the title, im wondering whats the difference between them. Cuz vertex shader deals with every vertex the program transfers, and how can it deal with the pixels ?