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

Youbar

Members
  • Content count

    23
  • Joined

  • Last visited

Community Reputation

122 Neutral

About Youbar

  • Rank
    Member
  1. How would those lines work? map[(y * 5) + x] = ... seems like y is pointing to 5, which would just slow things down by the looks of it. And: for (int i=0; i<25; ++i) std::cout << i[*map] << " \n"[i%5]; How does i[*map] work? i points to map?
  2. Thanks. 1+ rep for you again.
  3. Oh, I understand now, thanks. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] [b]EDIT:[/b] I'm getting an error in this code: [CODE] #include <iostream> using namespace std; int map[5][5] = { 1, 1, 3, 1, 1, 1, 0, 0, 0, 1, 1, 0, 2, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 }; int column = 0; int row = 0; int x = 2; int y = 2; char dir = 'x'; bool game_ended = false; void stop() { cout << endl; system("PAUSE"); } void cls() { system("CLS"); } void print_map() { for (row = 0; row < 5; ++row) { for (column = 0; column < 5; ++column) { cout << map[row][column] << ' '; } cout << endl; } } void redraw() { cls(); print_map(); } int main() { print_map(); cout << "What direction would you like to go in?" << endl; cin >> dir; while (game_ended != true) { if (dir == 'w') { map[x][y] = 0; x--; map[x][y] = 2; redraw(); } } stop(); } [/CODE] I get an error that says: [b]Unhandled exception at 0x00411ced in Turn-based RPG.exe: 0xC0000005: Access violation writing location 0x0041aff4.[/b] I am guessing this is due to the array. How would I fix this?
  4. What I mean, is how does that print out all of the array? It looks as if it would just print out the array like this: 1 0 2 0 1
  5. By the looks of it, the code would print the array diagonally. Can you please explain how that loop would work?
  6. That's to keep the loop going on. It's broken when Column and Column2 are both equal to 5. [CODE]if (column && column2 == 5) { break; }[/CODE]
  7. [CODE] int map[5][5] = { 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 2, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 }; int column = 0; int column2 = 0; ()void print_map() void print_map() { for (column = 0; column < 6; column++) { cout << map[column][column2]; if (column == 5) { column2++; column = 0; cout << endl; } if (column && column2 == 5) { break; } } } [/CODE] This is my code for printing out a 2d array. What happens in the output though, is unexpected. It produces: 111110 00010 02010 00010 11110 1 Instead of: 11111 10001 10201 10001 11111 1. How can I fix this problem? 2. Can you call the an [b]if[/b] command an exception? 3. Please don't post the fixed code. Just give me hints, unless the code is beyond fixing.
  8. Oh, I see now. Thanks for clearing that up for me.
  9. How does this not have any views at all?
  10. [CODE]// more pointers #include <iostream> using namespace std; int main () { int firstvalue = 5, secondvalue = 15; int * p1, * p2; p1 = &firstvalue; // p1 = address of firstvalue p2 = &secondvalue; // p2 = address of secondvalue *p1 = 10; // value pointed by p1 = 10 *p2 = *p1; // value pointed by p2 = value pointed by p1 p1 = p2; // p1 = p2 (value of pointer is copied) *p1 = 20; // value pointed by p1 = 20 cout << "firstvalue is " << firstvalue << endl; cout << "secondvalue is " << secondvalue << endl; return 0; }[/CODE] I understand all but this line of the script, which I don't see any reason for: [CODE]p1 = p2; // p1 = p2 (value of pointer is copied)[/CODE] I can see that it says it was copied, but I thought that already happened in the line above that? [CODE]*p2 = *p1; // value pointed by p2 = value pointed by p1[/CODE]
  11. [CODE]int wait(int x) { Sleep(1000 * x); return (x); }[/CODE] Code fixed by doing this, just in case someone happens to be reading this in the future.
  12. Ah, thanks. That solved the problem. But now it's saying I have to return a value... error C4716: 'wait' : must return a value
  13. I have another problem, now. int wait(int x) { Sleep(1000) * x; } returns: error C2296: '*' : illegal, left operand has type 'void'
  14. [s]Gosh, never realised this. Could I perhaps use Notepad++ over all the other options? I tried to find if Visual Studio was free, but all I got was trials. If someone could perhaps give me a link to the free version (not for Windows 8), it'd be appreciated. How do I register for a free product key?[/s] Nevermind.
  15. [CODE]#include <sstream> //declare it somewhere std::stringstream ss; //internal string empty at beginning //usage ss << "You, along with your " << numFriends << " friends, set up camp..."; //append this to the internal string std::string setUpCampLabel = ss.str(); //get a copy of stringbuilder internal string ss.clear(); //clear the internal string ss << "You were eaten by a bear!"; std::cout << setUpCampLabel << std::endl <<ss.str(); //it is possible to print the internal string directly[/CODE] How is this any more efficient than just putting: [CODE]cout << "You, along with your " << numFriends << " friends, set up camp..." << endl << "You were eaten by a bear!"[/CODE] I'm also using DevC++, not Visual Studio. So, in short, you simply can't declare a string and put an integer variable within it? You have to do that?