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

parinho7

Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

213 Neutral

About parinho7

  • Rank
    Newbie
  1. It works perfectly, thank you. Thanks everyone for the replies, you were all very helpful. May I ask one last thing? Recommendations on book and links to study about FSM for games and also some advanced matters of C++. For example, I now know what this line does MainMenuState() : GameState() but I don't know what the syntax actually mean. Where can I find that? I was also unaware of the existence of "shared_ptr" where can I study about stuff I don't know they exist?!. Thanks again!!
  2. Ah, I see. No, it is illegal to modify "this", at least in C++. This means your design has failed, and you need to rethink it. Why do you need different classes for State_Main_Menu, State_Exit, etc...? Is an enum flag not enough? What are you trying to do, exactly? It looks like you are trying to implement a state machine for your GUI, but this is clearly not the right approach here, as the language is very clearly telling you "don't do this". It's my first try to use a finite state machine in my game (the point of the whole game was to learn how to write a FSM), to navigate through the menus. Apparently I need to find some other way to do this. But as I say to my original post I did almost an exact console application that worked this way. Here is the code void CStateManager::change_state(GameStates *cur_state, int next_state){ if (next_state != STATE_NULL) delete cur_state; switch (next_state){ case STATE_MAIN_MENU: cur_state = new State_Main_Menu(); break; case STATE_PLAYING: cur_state = new State_Playing(); break; case STATE_EXIT: cur_state = new State_Exit(); break; } } State_Main_Menu::State_Main_Menu(){ stateID = STATE_MAIN_MENU; nextState = STATE_NULL; } void State_Main_Menu::Event(){ cin >> nextState; } void State_Main_Menu::Update(){ CStateManager::change_state(this, nextState); } void State_Main_Menu::Render(){ cout << "MAIN MENU" << endl; cout << "Press '3' to play" << endl; cout << "Press '0' to continue in Main Menu" << endl; // system("cls"); } int main(int argc, char* argv[]){ GameStates *myState = new State_Main_Menu(); while (myState->Get_nextState() != STATE_EXIT){ myState->Event(); myState->Update(); myState->Render(); } return 0; } and it worked as intended, never get an exception by that code. All I was doing was somewhat copying that and adding the SDL stuff!
  3. I understand the problem now, thank you. The call to the function was this: CStateManager::change_state(this, nextState); How can I modify it so that "this" is passed by reference? (If it's possible at all)
  4. I hope this will help: I am not familiar with the debugger, I think that the State instance doesn't have a value. For some reason this doesn't work well void CStateManager::change_state(GameStates *cur_state, int next_state){ if (next_state != STATE_NULL) delete cur_state; switch (next_state) { case STATE_MAIN_MENU: cur_state = new State_Main_Menu(); break; case STATE_EXIT: cur_state = new State_Exit(); break; } } and it doesn't execute the cur_state = new State_Exit(); BUT, I have a cout at the constructor and I do get the output so the object is constructed.
  5. I do one thing it runs fine. I try it again, it crashes. what's happening? I am trying to use for the first time a finite state machine in my game. The whole reason of making the game is to use a FSM. So, I have two states, STATE_MAIN_MENU and STATE_EXIT. I have my abstract class, two derived classes for the two states and all. I have already done a similar console application and everything works fine, but here when I am getting from main menu to exit the game crashes, but not all the times. It runs fine for 2-3 times (deletes currentState instance of State_Main_Menu and then currentState = new State_Exit()). The thing is that I put a cout at the constructor of State_Exit and it does construct the class. But then when a function of class is about to run it crushes. I can't explain it any better, I am attaching the code if anyone could help me I'd appreciate it, because I am getting crazy here! Thanks in advance!
  6. I am completing some beginner projects with c++ and SDL and I've read most of the lazy foo and sdltutorials. Up until now I used "frame independent movement" (as one of the tutorials explains) in the games I've made. Searching around I saw that the code in many tutorials uses regulated frame rate (using SDL_Delay). I was thinking witch method is better? Since with "frame independent" the program can run in my pc at about 175 fps isn't it better to just leave it uncapped? I am in a learning process right now and I'd like to learn from people here on this matter. Thanks in advance!
  7. [quote name='deathwearer' timestamp='1355187221' post='5009258'] if your game is somewhat "TIck based" (like the original Snake) only allow one direction change per tick. There would be one draw by tick so you couldn't go from up to down without at least going left of right for a tick. [/quote] YES! thank you, problem solved!!!
  8. I am in the process of making a classic snake game but I have a problem with the movement. If the snake goes up it normally won't react if you press down. But if it goes up and then I hit right(or left) and then quickly hit down the program isn't able to render it but apparently it recognizes the change of direction so the snake goes down. Same goes for every other direction. What can I do to fix this? Here is my code help me please. Thanks in advance! [CODE] void CSnake::Event(SDL_Event &amp;event){ if (SDL_KEYDOWN) switch (event.key.keysym.sym){ case SDLK_UP: if (dir!=DOWN){ yVel = -20; xVel = 0; dir = UP; } break; case SDLK_DOWN: if (dir!=UP){ yVel = 20; xVel = 0; dir = DOWN; } break; case SDLK_LEFT: if (dir!=RIGHT){ xVel = -20; yVel = 0; dir=LEFT; } break; case SDLK_RIGHT: if (dir!=LEFT){ xVel = 20; yVel = 0; dir=RIGHT; } break; } } void CSnake::movement(){ if (t_MoveTime <= (SDL_GetTicks()-t_SnakeStarted)){ SDL_Rect front; iSnake = snake.begin(); front.x = (*iSnake).x + xVel; front.y = (*iSnake).y + yVel; snake.push_front(front); snake.pop_back(); t_SnakeStarted = SDL_GetTicks(); } } [/CODE]