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

Jonatan Pieper

Members
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

102 Neutral

About Jonatan Pieper

  • Rank
    Newbie
  1. no i want it to update the score all the time im working on that and once you fail/complete the game the score gets saved so it would be a list obv. i will post an update of my code once i've worked a bit more on it i should be fully done in around 4-5 hours hopefully less ^^ and im planning on making it to a return value from each question so that one return points; or such will get "updated" after each question   ok so i dont understand how to make the return points into main i have tried a little which can be seen here: http://ideone.com/dk2IYx   anyone mind explaining to me how to get the return points into main so i only need to save into .txt once and in main only instead of everywhere?
  2. ok so i've done some major changes in my code and i hope this one is better i have loads of comments so that might make it difficult to read but here it is:   http://ideone.com/mKKxuy
  3. #include <iostream> #include <iomanip> #include <fstream> #include <string> using namespace std; struct highscore{ int svar; }; struct game{ int fraga; int val; }; int main(){ ofstream game; ofstream highscore; bool fail = true; int lost, fraga[10], svar = 0; // these are for the Start option int load ,loadh, loadg, tillbaka; // these are for the loading option string line, line2; // also loading option char val; game.open("game.txt", ios::app); if (!game){ cout << "file could not open"; exit (1); } do{ cout << " Menu" << endl; cout << " 1. Start" << endl; cout << " 2. Load" << endl; cout << " 3. Credits" << endl; cin >> val; switch(val){ case '1': highscore.open("Highscore.txt", ios::app); if (!highscore){ cout << "file could not open"; exit (1); } cout << "WELCOME TO THE CISCO QUIZ GOOD LUCK" << endl; cout << "how many layers are there in the OSI model?" << endl; cout << "1. 4" << endl; cout << "2. 5" << endl; cout << "3. 7" << endl; cin >> fraga; switch(fraga){ case 1: cout << "Game Over!" << endl; cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl; cin >> lost; if(lost == 2 ){ fail = false; } break; case 2: cout << "Game Over!" << endl; cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl; cin >> lost; if(lost == 2 ){ fail = false; } break; case 3: svar = svar + 5; break; default: cout << "error" << endl; } if(svar == 5){ cout << "what is the full name of OSPF?" << endl; cout << "1. Open Shortest Path First" << endl; cout << "2. Online Shooting Pro Fishing" << endl; cout << "3. On Short Path First" << endl; cin >> fraga; switch(fraga){ case 1: svar = svar + 5; break; case 2: cout << "Game Over!"<< endl; cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl; cin >> lost; if(lost == 2 ){ fail = false; } break; case 3: cout << "Game Over!" << endl; cout << "Do you wish to restart? (answer with 1 for yes, 2 for no)" << endl; cin >> lost; if(lost == 2 ){ fail = false; } } } if(svar == 10){ cout << "What does TTL mean?" << endl; cout << "1. Twin Twitched Life" << endl; cout << "2. Two Time Lives" << endl; cout << "3. Time To Live" << endl; cin >> fraga; switch(fraga){ case 1: cout << "Game Over!" << endl; cout << "Do you wish to restart? (answer with yes, YES or Yes)"<< endl; cin >> lost; if(lost == 2 ){ fail = false; } break; case 2: cout << "Game Over!" << endl; cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl; cin >> lost; if(lost == 2 ){ fail = false; } break; case 3: svar = svar + 10; break; } } if(svar == 20){ cout << "What is the first command you enter on a Cisco router?" << endl; cout << " 1. enable"<< endl; cout << " 2. disable" << endl; cout << " 3. enter" << endl; cin >> fraga; switch(fraga){ case 1: svar = svar + 5; break; case 2: cout << "Game Over!" << endl; cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl; cin >> lost; if(lost == 2 ){ fail = false; } break; case 3: cout << "Game Over!" << endl; cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl; cin >> lost; if(lost == 2 ){ fail = false; } break; } } if(svar == 25){ cout << "which protocol is the most prefered?" << endl; cout << " 1. RIP" << endl; cout << " 2. EGRP" << endl; cout << " 3. EIGRP" << endl; cin >> fraga; switch(fraga){ case 1: cout << "Game Over!" << endl; cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl; cin >> lost; if(lost == 2 ){ fail = false; } break; case 2: cout << "Game Over!"<< endl; cout << "Do you wish to restart? (answer with 1 for yes and 2 for no)" << endl; cin >> lost; if(lost == 2 ){ fail = false; } break; case 3: svar = svar + 15; cout << "You have completed the game press 1 to exit or if you wish to do it again or check highscores press 2" << endl; cin >> lost; if (lost != 1 ){ fail = false; } break; } } highscore <<"Score: " << svar << '\n'; highscore.close(); game << fraga << val; game.close(); cin.ignore(10,'\n'); cin.get(); case '2': cout << "type 1 to load game or type 2 to load highscores" << endl; cin >> load; if (load == 1){ ifstream loadg ("game.txt"); if (loadg.is_open()) { while ( loadg.good() ) { getline (loadg,line2); cout << line2 << endl; } cout << "do you wish to return to the menu press 1 else press any number" << endl; cin >> tillbaka; if (tillbaka != 1){ fail = false; } game.close(); } } else if(load == 2){ ifstream loadh ("highscore.txt"); if (loadh.is_open()) { while ( loadh.good() ) { getline (loadh,line); cout << line << endl; } cout << "do you wish to return to the menu press 1 else press any number" << endl; cin >> tillbaka; if (tillbaka != 1){ fail = false; } highscore.close(); } } cin.ignore(10,'\n'); cin.get(); break; } }while(fail); } so here's the code open to all suggestions   NOTE: have also tried to save the game.txt as a .dat didnt help much tho :S  
  4. ok so I have been on other forums, googled, read on most c++ websites and I can't understand how to get my code to save the data to a file which can be selected to loaded once in the game.   I have two ofstreams and ifstreams, one to save and load the highscore of the game the other supposed to save the progress and load it when you feel like it. The thing is I can't get the progress or game to save the data I believe I save it in wrong format and so on but I don't know how to fix that at the moment so I would be really gratefull if someone could help me out here.   I know some of the basics but not all still things I need to get explained but the major problem right now is to get it to save in any format except .txt (was thinking to save it as a .exe first but that didn't work out well so now I'm thinking of something like .dat or .dll or such) Once I get a hang of how to use return properly i will use that and "call" on the things I need to main and not write it all in there but for time being I have done that so it looks messy.   Am using switch-case and in those i have if-else with new switch-cases etc to make the game flow at the moment   Please help me thx   ooh by the way is there a way to remove this post or move it to the beginner c++ section in the for beginner? seems like i cant find the delete button for my topic sry wrong section :(