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

thebigbossman

Members
  • Content count

    75
  • Joined

  • Last visited

Community Reputation

181 Neutral

About thebigbossman

  • Rank
    Member
  1. If you love lambdas, I advice you to learn a truly functional language, like Scheme or Haskell. Of course, that is not game development related, but you would learn a whole new world of programming that you've not come across before and it will improve and sharpen your programming and problem solving skills.
  2. Unity

    This is a good concept (to document your progress). I would suggest a white colour scheme with full-width of the browser used because it's easier to read code that way.
  3. [quote name='Hodgman' timestamp='1319460474' post='4876285'] bad code [/quote] While I agree, in principle (and it is easy to be theoritical)... In actual coding practice however, there are many situations where the most [b]elegant[/b] and [b]readable[/b] solution is probably using a global variable or object. Sometimes having to pass around a lot of data in functions belonging to different classes it just makes more sense to store certain program-wide information not belonging to any particular class (such situations do arise!) in globals. They should be minimized, but they exist for a purpose and that purpose may arise in some situations. Not saying it is recommended as a general practice. But it has its uses.
  4. Pacman is a tough challenge for any beginner. But it would teach you all about: 1. 2D graphics. 2. Moving, animating sprites and sprite collision detection. 3. Game loops. 4. User interaction/input control. 5. Level building or creating. 6. Simple Pathfinding for AI (ghosts). 7. Game logic and game states (e.g. when you've eaten a power pill you can eat ghosts instead of ghosts killing you). Enough to get you started with.
  5. Speed depends on your code also to some extent. SDL (from my experience) is good enough for handling fast-paced 2D graphics without choking and remember, SDL itself is written in C and pygame is only a wrapper to the C graphics library. Even commercial games are written in SDL. If you handle your game logic properly, there should be no speed problems with using Python. If, of course, you are going to crunch a ENORMOUSLY HUGE lot of numbers or data in your game, C or C++ might be better suited. Otherwise, Python will be just fine for arcade type 2D shooters.
  6. Python would work perfectly for 2D shooters using a library like SFML (python-sfml) or SDL (pygame). Could you describe a bit more of what kind of shooter you wish to make?
  7. Yes, you could use the function's parameters of each function to pass around the data. Of course, those data that are already members of the same class (e.g. Player) will not need to be passed around as each of the member functions can access it directly thus reducing the list of parameters. You would pass around only the extra information necessary which is not part of the class itself or when you're calling a member function of another class that does not otherwise have access to the data. ( Note: for the parameters that need to be affected/modified by the function that has been called, you would probably pass by reference. )
  8. Oh, yes, I can see how that can become a really huge mess of confusing switches. I suggest putting each of those combat options in a separate function that will evaluate the result and return it to the main Combat() function or simply just perform that combat operation and affect the necessary data within it. For example you could have an Attack () function that is called by the "A" option and which asks for the user to swing or thrust, and which calls in turn, the Swing () function or a Thrust () function from within it. [font="Courier New"][code] "A" | Attack () | ------------------------ | | "S" "T" | | Swing() Thrust() [/code] [/font]That will make the whole thing more manageable and easier to modify/maintain in the long run.
  9. I've not written a C++ program in ages and thought that a simple TicTacToe game would be fun to cook up. Mind you, I've never written a TicTacToe game before (at least not one that you play against the computer) so this is a first for me. I realize that the most optimal AI uses the Minimax algorithm, but I wanted to try out my own AI after reading the "rules" of the game on Wikipedia. Nothing really special this code, particularly, but I have a sense of achievement in writing C++ code after such a long [source lang="cpp"]// Simple command line TicTacToe game // (C) 2011 V.Harishankar // Released under the GNU GPL v3 #include <iostream> #include <cstdlib> #include <ctime> class TicTacToeGame { protected: enum Turn { PLAYER = 0, AI = 1 }; // Represents the current turn Turn current_turn; // Character (O or X for player) char player_char, ai_char; // Represents the board char board[3][3]; // Clear the board void initialize_board (); // Display the board void print_board (); // Chekc if all slots are filled bool all_slots_filled (); // Find a winning position for given player (O or X) and fill the // row and column parameter void find_winning_position (char noughtorcross, int &row, int &col); // Check if the specified player has won (O or X) bool check_if_won (char ch); // Human player move void player_move (); // Computer player move void ai_move (); // Game loop void play_game (); public: // Constructor TicTacToeGame () { // Note that these values are flipped when the game is initialized // for the first time current_turn = PLAYER; player_char = 'X'; ai_char = 'O'; main_menu (); } // Main game menu loop void main_menu (); }; void TicTacToeGame::player_move () { int row, col; // Get the row and column from human player while (1) { std::cout << "Enter row for " << player_char << " [1..3]: "; std::cin >> row; std::cout << "Enter col for " << player_char << " [1..3]: "; std::cin >> col; row -= 1; col -= 1; // Row and column must be valid if ((row >= 3 || row < 0) || (col >= 3 || col < 0)) std::cout << "Invalid row/column.\n"; else { // if it is a blank this is a valid move if (board[row][col] == ' ') break; else std::cout << "Cell is occupied.\n"; } } // Set the player move board[row][col] = player_char; } void TicTacToeGame::find_winning_position (char noughtorcross, int &row, int &col) { // check if specified character (nought or cross) can win along any row int i, j, chcount, emptycol, emptyrow; // Loop through rows for (i = 0; i < 3; i ++) { // Chcount -number of either O or X along the row chcount = 0; emptycol = -1; // Loop through columns for (j = 0; j < 3; j ++) { // If the specified player is occupying the cell, add to chcount if (board[i][j] == noughtorcross) chcount ++; // If specified cell is blank mark the column as empty else if (board[i][j] == ' ') emptycol = j; } // If there are two of the specified player in the row and there is an // empty cell, then the empty cell is the winning position if (chcount == 2 && emptycol != -1) { row = i; col = emptycol; return; } } // The same logic as above applies for columns // check if specified character can win along any column for (j = 0; j < 3; j ++) { chcount = 0; emptyrow = -1; for (i = 0; i < 3; i ++) { if (board[i][j] == noughtorcross) chcount ++; else if (board[i][j] == ' ') emptyrow = i; } if (chcount == 2 && emptyrow != -1) { row = emptyrow; col = j; return; } } // Check if specified character can win along diagonal top-left to bottom-right chcount = 0; emptyrow = -1; emptycol = -1; // Loop through the diagonal for (i = 0; i < 3; i ++) { if (board[i][i] == noughtorcross) chcount ++; else if (board[i][i] == ' ') emptyrow = emptycol = i; } if (chcount == 2 && emptyrow != -1 && emptycol != -1) { row = emptyrow; col = emptycol; return; } // Check if specified character can win along diagonal top-right to bottom-left chcount = 0; emptyrow = -1; emptycol = -1; // Loop through the diagonal for (i = 0; i < 3; i ++) { if (board[i][2-i] == noughtorcross) chcount ++; else if (board[i][2-i] == ' ') { emptyrow = i; emptycol = 2 - i; } } if (chcount == 2 && emptyrow != -1 && emptycol != -1) { row = emptyrow; col = emptycol; return; } } void TicTacToeGame::ai_move () { // Check if AI can win in this move int row=-1, col=-1; // See if AI can win in this move find_winning_position (ai_char, row, col); // if AI can win, play the winning move if (row != -1 && col != -1) { board[row][col] = ai_char; return; } row = col = -1; // see if player can win next move and block // if possible find_winning_position (player_char, row, col); if (row != -1 && col != -1) { board[row][col] = ai_char; return; } // check if the centre can be played if (board[1][1] == ' ') { board[1][1] = ai_char; return; } // Corner positions int corners[4][2] = {{0, 0}, {0, 2}, {2, 0}, {2, 2}}; // If any one or more corners are blank if (board[0][0] == ' ' || board[0][2] == ' ' || board[2][0] == ' ' || board[2][2] == ' ') { // randomly select corner while (1) { int corner = rand () % 4; row = corners[corner][0]; col = corners[corner][1]; if (board[row][col] == ' ') { board[row][col] = ai_char; return; } } } // Edge positions int edges[4][2] = {{0, 1}, {1, 0}, {1, 2}, {2, 1}}; // if any one or more edges are blank if (board[0][1] == ' ' || board[1][0] == ' ' || board[1][2] == ' ' || board[2][1] == ' ') { // randomly select edge while (1) { int edge = rand () % 4; row = edges[edge][0]; col = edges[edge][1]; if (board[row][col] == ' ') { board[row][col] = ai_char; return; } } } } bool TicTacToeGame::check_if_won (char ch) { bool win = false; // Check across int i; for (i = 0; i < 3; i ++) if (board[i][0] == ch && board[i][1] == ch && board[i][2] == ch) { win = true; break; } // Check down for (i = 0; i < 3; i ++) if (board[0][i] == ch && board[1][i] == ch && board[2][i] == ch) { win = true; break; } // check diagonals if (board[0][0] == ch && board[1][1] == ch && board[2][2] == ch) win = true; if (board[0][2] == ch && board[1][1] == ch && board[2][0] == ch) win = true; return win; } bool TicTacToeGame::all_slots_filled () { bool filled = true; for (int i=0; i < 3; i++) { for (int j=0; j < 3; j++) if (board[i][j] == ' ') filled = false; if (filled == false) break; } return filled; } void TicTacToeGame::print_board () { std::cout << "\n"; for (int i=0; i < 3; i ++) { for (int j=0; j < 3; j++) { std::cout << board[i][j] << "\t"; if (j < 2) std::cout << "|\t"; } if (i < 2) std::cout << "\n---------------------------------\n"; } std::cout << "\n"; } void TicTacToeGame::play_game () { // Initialize the board first initialize_board (); // If player char was X then make it O if (player_char == 'X') { player_char = 'O'; ai_char = 'X'; current_turn = AI; } else { ai_char = 'O'; player_char = 'X'; current_turn = PLAYER; } // So long as gameover is false, keep playing bool gameover = false; while (! gameover) { print_board (); // if turn is that of the player if (current_turn == PLAYER) { player_move (); current_turn = AI; } else { std::cout << "\nComputer played: \n"; ai_move (); current_turn = PLAYER; } // check for winner nought if (check_if_won ('O')) { print_board (); std::cout << "\nNoughts won! Game over...\n"; break; } else if (check_if_won ('X')) { print_board (); std::cout << "\nCrosses won! Game over...\n"; break; } else if (all_slots_filled ()) { print_board (); std::cout << "\nGame drawn.\n"; break; } } } void TicTacToeGame::initialize_board () { for (int i = 0; i < 3; i++) for (int j=0; j < 3; j++) board[i][j] = ' '; } void TicTacToeGame::main_menu () { while (1) { std::cout << "\n -------------------------"; std::cout << "\n Welcome to TicTacToe game"; std::cout << "\n -------------------------"; std::cout << "\n 1. Play"; std::cout << "\n 2. Exit"; char ch; std::cout << "\n Your choice: "; std::cin >> ch; switch (ch) { case '1': play_game (); break; case '2': return; } } } int main () { // initialize randomizer srand (time (NULL)); TicTacToeGame game; return 0; }[/source] I made this deliberately verbose and preferred to use the "rules" of the game, rather than a technique like the Minimax algorithm (which I confess, I don't fully grasp except in a theoritical sense). Any comments? I am not sure whether this is unbeatable or not. Could any of you try this out and see if you can beat the "AI"?
  10. [quote]I wanted to put forth effort,[/quote] So far as the evidence in this thread goes you've not even tried to debug the code yourself leave alone try to understand it. What exactly is meant by "effort"? And by the way, if I were you I would show some gratitude to the people who've actually bothered to take your code and worked with it to try and get the jumping code working whether the code works or not. They've spent their valuable time and effort for no material benefit. If you cannot do so, at least avoid insulting or belittling them. Your approach is wrong. Please understand that respect works wonders. Respecting the people who're trying to help will get you far.
  11. Thanks. Copyright is incredibly complex and so context-sensitive. Imagine a simple scenario. two photography enthusiasts visit a lovely location and for convenience sake, share the same camera. Each takes a picture one after the other of the same scene, a particularly beautiful one (from approximately the same angle and with the same camera but maybe with their own settings). One photo comes out underexposed and the other properly exposed. Later on, each claims that the properly exposed photo belongs to him. How does a court of law determine this question, particularly if there is no evidence as to who clicked the camera first? Also who owns the copyright of the actual "picture"? Both being similar pictures, how do you determine who "owns" the actual picture? Also remember, copying comic characters might be both a copyright and trademark violation depending on the circumstances. Trademarks is applicable in commercial contexts, while copyright applies both in commercial and non-commercial contexts. To avoid all this, of course, people simply advise against using any existing material as a base for your own creations.
  12. This question ideally should be answered only by a lawyer from a specific jurisdiction where you want advise as regards copyright law. Contrary to what musicians and artists state, copyright is nowhere near as strong as they think it is. However the fear of expensive litigation drives away a lot of people. A lot of people, for example, aren't even aware of fair use rights. So to answer specifically, if your final product is [b][i]substantially[/i][/b] different from the original even if you used the original as a "base" to build upon, then of course the final product cannot be said reasonably to belong to the other party and you own its copyright. If it is a mere derivative with few changes or additions and is identifiable with its original form, then it is a copyright infringement, most likely. What constitutes a derivative work is up to a court of law to decide. See, most of the "original" works are actually built upon pre-existing ideas or models. Copyright does not extend to ideas or designs, even. There are other IPR laws to deal with inventions (patents), designs (Designs Laws), and trademarks (Trademark Laws) and so on. Most people follow the maxim: if in doubt, don't! in regards to copyright law. Again, copyright is a very grey area and a lot of circumstances might make a particular thing a violation or not. Take it from me (I am a qualified lawyer). I am posting this just to clear some confusion. The statute book more often only talks about specifics and case laws (court decisions) build on the actual law of property rights. Again, each country has its own laws and interpretations of the value of intellectual property.
  13. Look at string padding functions to create fixed width fields for on-screen text display. [url="http://msdn.microsoft.com/en-us/library/66f6d830%28v=VS.110%29.aspx"]http://msdn.microsof...=VS.110%29.aspx[/url] To create a padded string you need something like this (pseudo code): fixed_lengthstr = varlength_str.PadRight (10); (Where 10 is the total length of the string to pad. For example, if your string is 4 characters, the above will add 6 characters to the end of the string to make it a total of 10 characters. In such a case you need to limit the maximum number of chars you accept to 10). Also as an exercise, try to limit your character name to a certain number of maximum chars when asking for input. Anything less than that would be acceptable, but more than that, return an error or truncate it to 10 characters. Hint: Look at String.Length () functions.
  14. There is no "cheating" involved. If that were the mentality, people would still be programming using assembly language or even machine language (0s and 1s) Tools to make it easier were created for a purpose. To free you from the tasks that are considered routine and to free up your creativity. A long time ago when I thought along similar lines as yours, I discovered GameMaker and even managed to create a fairly decent sidescroller. So there is no doubt in my mind. Stop breaking your head about programming if that's not really your interest area. [quote] To me, it seems like this. If I loved movies, and wanted to make my own movies, [i]simply [/i]put, I buy a camera, and shoot.[/quote] Not quite. What about the "incidental" things, like getting a script, writing the screenplay, getting suitable actors for the parts, rehearsals, planning shoots, locations, actual shooting, camera work (panorama, closeups etc), lighting, props, putting together edits, sound editing, music work, post-production and so on? With a video camera you just shoot a video, not a full movie. To get a full movie, you need multiple skills. In some ways it's tougher than game programming because of the sheer range of skills required and no one man can do it all.
  15. Man I think he missed my post about using tools like game maker etc. There you can learn to design games in principle without having to get your hands dirty with low-level code. I think that might be the best idea for now, until one develops a taste for programming and coding for its own sake.