Jump to content
  • Advertisement

markrodgers11

Member
  • Content Count

    29
  • Joined

  • Last visited

Everything posted by markrodgers11

  1. markrodgers11

    Quake

    I came across this picture online and was curious how all these games have been derived from Quake? Is there some sort of public license-free source code of quake that we can use to develop from? If so does anyone know if its even worth it and if so where you could acquire this source? Not to mention, if they are all available, which would be best to develop from? Quake 1,2,or 3 src? [spoiler] [/spoiler]
  2. markrodgers11

    Quake

    Damn, well that's still pretty cool. I wouldn't really use it for commercial anyways, just was curious if I could develop on their engine w/o paying for a license, thanks guys!
  3. markrodgers11

    directx10 sdk download?

    I'm having issues finding directx 10 sdk.. this is the link i found but im not sure whether it is dx10 or dx11.. I'm looking for 10. EDIT: Maybe this is dx10? http://www.microsoft.com/en-us/download/details.aspx?id=8109
  4. markrodgers11

    directx10 sdk download?

    Well don't I feel stupid... thanks man! So just double checking, if I download DirectX SDK, I will be able to develop in C++ using DX10?
  5. markrodgers11

    Struct vs Classes?

    What is the difference between structs and classes in C++?
  6. markrodgers11

    Struct vs Classes?

    Ahh I see. but what frob says brings up another question for me about structs/classes. so does this mean structs can not hold functions or is it just preferred to put functions in classes and plain data in structs?
  7. markrodgers11

    Struct vs Classes?

    getting back on topic of C++, so I suppose it is just personal preference since either can be used for same thing? Is their any that is more preferred by advanced C++ programmers, to get me into good habits?
  8. I am working on a text-based RPG and I defined a vector in my game.cpp file and now I am trying to access it from my inputSystem.cpp file, it shows that it is unknown? I am wondering how I can access this vector from this other .cpp files? -Thanks
  9. markrodgers11

    vector compile error?

    I'm trying to build my 2nd text based RPG but this time I wanna make it more flexible and have the code split up and everything. I will post my source code below and my compile error: Source Code: init.cpp #include <iostream> #include "game.h" #include "rooms.h" void main() { intro(); } game.cpp #include <iostream> #include <string> #include <vector> #include "rooms.h" using namespace std; void intro() { pRooms[9] = 10; checkRoom(); system("pause"); } game.h #include <string> #include <vector> using namespace std; // Prototypes // void intro(); rooms.cpp #include <iostream> #include <vector> #include "rooms.h" using namespace std; int checkRoom() { int cRoom = 0; int counter = 0; int x = 0; if (counter <= nRooms) { if (pRooms[x] = 1) { x = cRoom; cout << "cRoom = " << cRoom; } else { ++counter; ++x; cout << "Adding 1\nAdding 1 to x"; } } return cRoom; } rooms.h #include <iostream> #include <vector> using namespace std; // Prototypes // int checkRoom(); // Vectors // vector<int> pRooms(10,0); // Integers // int nRooms = pRooms.size(); Build Log 1>------ Build started: Project: textRPG, Configuration: Debug Win32 ------ 1> game.cpp 1> Generating Code... 1> Skipping... (no relevant changes detected) 1> rooms.cpp 1> init.cpp 1>init.obj : error LNK2005: "class std::vector<int,class std::allocator<int> > pRooms" (?pRooms@@3V?$vector@HV?$allocator@H@std@@@std@@A) already defined in game.obj 1>init.obj : error LNK2005: "int nRooms" (?nRooms@@3HA) already defined in game.obj 1>rooms.obj : error LNK2005: "class std::vector<int,class std::allocator<int> > pRooms" (?pRooms@@3V?$vector@HV?$allocator@H@std@@@std@@A) already defined in game.obj 1>rooms.obj : error LNK2005: "int nRooms" (?nRooms@@3HA) already defined in game.obj 1>H:\C++ extRPG\Debug extRPG.exe : fatal error LNK1169: one or more multiply defined symbols found ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  10. markrodgers11

    classes

    okay so recently ive been reading a book on C++ and i've learned quite a bit and i just wanted to see what it was like so i took a look at the cryengine 3 source code that they release with the SDK. and suprisingly i could KIND OF understand it xP although at the same time alot of the stuff they made was custom so there was a lot of things i was confused about but i realized when i look at source code everyone uses classes, but for some reason the book doesnt cover classes to towards the end of the book. So I was just wondering if someone could explain how classes work in C++ and how to use them and the syntax? Basically everything i should know about classes ;p
  11. markrodgers11

    classes

    yeah thats what i've heard and tahts why i wanna start learning how to use classes ;p ive been learning about vectors recently and those are pretty cool xP
  12. markrodgers11

    vector compile error?

    extern vector<int> pRooms(10,0); is that possible? I tried that ^^ and it still has a compile error. 1>------ Build started: Project: textRPG, Configuration: Debug Win32 ------ 1> game.cpp 1> Generating Code... 1> Compiling... 1> rooms.cpp 1> init.cpp 1> Generating Code... 1>init.obj : error LNK2005: "class std::vector<int,class std::allocator<int> > pRooms" (?pRooms@@3V?$vector@HV?$allocator@H@std@@@std@@A) already defined in game.obj 1>init.obj : error LNK2005: "int nRooms" (?nRooms@@3HA) already defined in game.obj 1>rooms.obj : error LNK2005: "class std::vector<int,class std::allocator<int> > pRooms" (?pRooms@@3V?$vector@HV?$allocator@H@std@@@std@@A) already defined in game.obj 1>rooms.obj : error LNK2005: "int nRooms" (?nRooms@@3HA) already defined in game.obj 1>H:\C++ extRPG\Debug extRPG.exe : fatal error LNK1169: one or more multiply defined symbols found ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  13. markrodgers11

    GFx Card Capabilities

    I've been wanting to start learning DirectX recently but my question is to learn dx10 or dx11. I just recently discovered my card DOES support dx11 but I'm wondering...say I made a basic little 3d games in C++ and DirectX and compiled it and distributed it. What if the user doesn't have a card that supports DirectX11? Will they be able to play, it'l just force the latest version of DirectX supported for their card? Will they not be able to play?
  14. markrodgers11

    classes

    okay thanks guys!
  15. markrodgers11

    First "game" in C++

    I've been reading a book on C++ and I decided it'd be good practice to code something from scratch instead of outside of the book. I decided it wouldn't be too hard to code a knock off of ZORK...I was wrong It's not that I find it HARD to code a knock off of ZORK but one thing after another keeps adding up and my main.cpp is getting so huge im started to get lost! ...I know, i know, its not THAT big, but for someone like me who is used to coding little things like calculators and other basic things, its pretty long ;p I know I've probably coded this in a stupid way so If anyone has some suggestions as to how I can split it into other files or reuse parts of code so I don't have to manually re-write things, etc. Maybe some new methods I could check into because idk if this is normal but I feel like I used if, if else, and else statements for practically everything! xD any advice / critic is appreciated. Thanks! #include <iostream> #include <windows.h> #include <string> using namespace std; //strings string name; string input; string output; string confirm; string currentArea; string area; bool confused; bool dark; //commands string about; string help; string n; string e; string s; string w; string look; string open; string close; //objects string door1 = "closed"; bool checkArea(string area) { if (area == "area1") { if (input == "n") { look = "There is a mountain range to the North."; cout << look; confused = false; } else if (input == "e") { look = "The door seems to be unlocked."; cout << look; confused = false; } else if (input == "s") { look = "*I watch the waves run up the shore.*"; cout << look; confused = false; } else if (input == "w") { look = "There seems to be what appears as a chain-link fence running from the coast to the mountain line. The fence has a gate but it looks as if it is locked."; cout << look; confused = false; } else { confused = true; } } if (area == "area2") { if (input == "n") { look = "There is a painting of a whealthy looking man with a mustache on this wall."; cout << look; confused = false; } else if (input == "e") { look = "It is dark inside but I see a desk..."; cout << look; confused = false; } else if (input == "s") { look = "Nothing here."; cout << look; confused = false; } else if (input == "w") { } else { confused = true; } } return false; } void checkInput() { cout << endl << "> "; cin >> input; if (input == "about") { output = "You are playing a text based RPG coded by Mark Rodgers."; cout << output << endl; checkInput(); } else if (input == "help") { output = "COMMAND LIST:\n help - welcome!\n about - info about the game\n look - describe surroundings\n name - reminds you of your name\n open_OBJECTNAME - opens specified object\n close_OBJECTNAME - closes specified object\n exit - close game (alternative: quit)\n\nMOVEMENT:\n n - Move North\n e - Move East\n s - Move South\n w - Move West"; cout << output << endl; checkInput(); } else if (input == "look") { cout << look << endl; checkInput(); } else if (input == "name") { output = name; cout << "My name is " << name << "." << endl; checkInput(); } else if (input == "open_door") { if (look == "The door seems to be unlocked.") { if (door1 == "closed") { output = "*I open the door*"; cout << output << endl; door1 = "opened"; checkInput(); } else if (door1 == "opened") { output = "The door is already open."; cout << output << endl; checkInput(); } } else { output = "There is nothing here to open."; cout << output << endl; checkInput(); } } else if (input == "close_door") { if (look == "The door seems to be unlocked.") { if (door1 == "opened") { output = "*I close the door*"; cout << output << endl; door1 = "closed"; checkInput(); } else if (door1 == "closed") { output = "The door is already closed."; cout << output << endl; checkInput(); } } else { output = "There is nothing here to open."; cout << output << endl; checkInput(); } } else if (input == "exit" || input == "quit") { cout << "Are you sure?(y/n)" << endl << endl << "> "; cin >> confirm; if (confirm == "yes" || confirm == "YES" || confirm == "Yes" || confirm == "y" || confirm == "Y") { return; } else if (confirm == "no" || confirm == "NO" || confirm == "No" || confirm == "n" || confirm == "N") { checkInput(); } else { output = "Invalid response."; cout << output << endl; checkInput(); } } else { checkArea(currentArea); if (confused = true) { output = "Huh?"; cout << output << endl; } checkInput(); } } void area2() { currentArea = "area2"; dark = true; look = "It is dark inside but I see a desk..."; cout << look << endl; checkInput(); } void area1() { currentArea = "area1"; look = "I am standing on the beach.\nThere is a small shack to the east."; cout << look << endl; checkInput(); } void main() { SetConsoleTitle( "ZORK" ); cout << "What is my name?" << endl << endl << "> "; cin >> name; area1(); }
  16. markrodgers11

    First "game" in C++

    wow thanks for the release in the source, once I find the time I will definitely setup a project and paste all your code it, study it, modify it to learn new things, etc! Love looking at other people's source code, I find it a good way to study it, unless you have no idea what any of it is then its just like trying to read Chinese ;p
  17. markrodgers11

    string::size_type

    One of the example programs in my C++ book ;) I'm not really understanding this completely... I kinda understand how it is working but there are a few things that are confusing me.. Such as string::size_type. The book said that it returns the size of something (derp) but i tried outputting the result and it was like a bunch of random number. I didn't count but it was probably around 8 random numbers, for example: 35694625. I don't understand how that gets returned if it says it gets the size of something? o.o #include <iostream> #include <string> using std::cin; using std::endl; using std::cout; using std::string; int main() { cout << "Please enter your first name: "; string name; cin >> name; const string greeting = "Hello, " + name + "!"; int pad; cout << "Enter the desired amount of padding: "; cin >> pad; const int rows = pad * 2 + 3; const string::size_type cols = greeting.size() + pad * 2 + 2; cout << endl; for (int r = 0; r != rows; ++r) { string::size_type c = 0; while (c != cols) { if (r == pad + 1 && c == pad + 1) { cout << greeting; c += greeting.size(); } else { if (r== 0 || r == rows - 1 || c == 0 || c == cols - 1) cout << "*"; else cout << " "; ++c; } } cout << endl; } system("pause"); return 0; }
  18. markrodgers11

    string::size_type

    ohokay well thanks for the useful responses, i read closer in my book and it was explained I just happened to miss it on the first read through of that section Thanks for helping out anyways!
  19. markrodgers11

    First "game" in C++

    hmm thank you, that might be the solution to one of the bugs i am having xP thanks for point that out!
  20. markrodgers11

    string::size_type

    Well the code is taken directly from the book I am reading on C++ and it compiles fine? The book was pretty highly recommended by people on lots of different forums so i'm sure the code is fine its just that I don't really understand what ::size_type is/does. :/
  21. markrodgers11

    First "game" in C++

    yes yes i'm quite familiar with Linux actually ;) was even reading a book on linux shell scripting and crap so i got pretty familiar with the basics of how things work in linux and knowing my way around the terminal ;)
  22. markrodgers11

    string vs string literals.

    I am currently reading a book called "[color=#b22222]Accelerated C++ Practical Programming by Example" by Andrew Koenig and Barbara E. Moo and am confused on the difference between a string and a string literal. Here is the excerpt from what I read: The second new idea is that we can use + to concatenate a string and a string literal--or, for that matter, two strings (but not two string literals). [/quote]
  23. markrodgers11

    string vs string literals.

    hmm. alright that was explained perfectly! Thanks!
  24. markrodgers11

    First "game" in C++

    Wow thanks guys. Some really great responses. Looks like I've got lots of new things to look into I don't know anything about classes atm or loading rooms via text files, etc. Thanks for all the great responses! EDIT: Today i scraped the old one and did it again from scratch (changed the dialogue alittle ;p) but it still seems as I am hard-coding it, which is what i was trying to avoid doing again xD I haven't yet looked into classes/vecters/arrays/etc, so I will take a look at those tonight and hopefully that will make my games less "hard-coded" ;p #include <iostream> #include <windows.h> #include <string> using namespace std; string charName, charRace, charClass; string input; string look; string activeRoom; string pos, north, east, south, west; string open_door, close_door; bool doorOpened; bool doorInRange; void checkInput() { cout << "> "; cin >> input; if (input == "help") { cout << endl << "COMMAND LIST:\n\n help - Welcome to ZORK ;]\n look - describe your surroundings\n exit - closes ZORK (alternative: quit)\n\nMOVEMENT:\n\n n - moves North\n e - moves East\n s - moves South\n w - moves West\n\nACTIONS:\n\n open_OBJECTNAME - opens object\n close_OBJECTNAME - closes object\n\n"; } else if (input == "exit" || input == "quit") { return; } else if (input == "look") { cout << endl << look; } else if (input == "n") { pos = north; look = pos; cout << endl << look; } else if (input == "e") { pos = east; look = pos; cout << endl << look; } else if (input == "s") { pos = south; look = pos; cout << endl << look; } else if (input == "w") { pos = west; look = pos; cout << endl << look; } else if (input == "open_door") { if (activeRoom == "room1") { if (look == north) { doorInRange = true; if (doorOpened = false) { cout << "Door opened.\n\n"; doorOpened = true; } else if (doorOpened = true) { cout << "Door is already open.\n\n"; } } else { doorInRange = false; cout << "No door is in range.\n\n"; } } } else if (input == "close_door") { if (doorOpened = true) { cout << "Door closed.\n\n"; doorOpened = false; } else if (doorOpened = false) { cout << "Door is already closed.\n\n"; } } else { cout << "huh?\n\n"; } checkInput(); } void room1() { activeRoom = "room1"; doorOpened = false; pos = north; north = "There is a small shack here. It appears as if it is unlocked.\n\n"; east = "A chain-linked fence blocks moving this direction.\n\n"; south = "There is an ocean here.\n\n"; west = "A mountain range blocks me from going here.\n\n"; cout << endl << north; look = north; checkInput(); } string pickName() { //name selection cout << "What is your name?\n\n" << "> "; cin >> charName; return charName; } string pickRace() { //race selection cout << endl << "What race do you want to be?\n Human\n Orc\n Elf\n\n" << "> "; cin >> charRace; if (charRace == "human" || charRace == "HUMAN" || charRace == "Human") { charRace = "human"; } else if (charRace == "orc" || charRace == "ORC" || charRace == "Orc") { charRace = "orc"; } else if (charRace == "elf" || charRace == "ELF" || charRace == "Elf") { charRace = "elf"; } else { cout << "Invalid Entry.\n Valid inputs are 'human', 'orc', or 'elf'\n\n"; pickRace(); } return charRace; } string pickClass() { //class selection cout << endl << "What race do you want to be?\n Assassin\n Hunter\n Wizard\n\n" << "> "; cin >> charClass; if (charClass == "assassin" || charClass == "ASSASSIN" || charClass == "Assassin") { charClass = "assassin"; } else if (charClass == "hunter" || charClass == "HUNTER" || charClass == "Hunter") { charClass = "hunter"; } else if (charClass == "wizard" || charClass == "WIZARD" || charClass == "Wizard") { charClass = "wizard"; } else { cout << "Invalid Entry.\n Valid inputs are 'assassin', 'hunter', or 'wizard'\n\n"; pickClass(); } return charClass; } void charVerify() { cout << "Welcome to ZORK " << charName << "! You are a " << charRace << " playing as a\\an " << charClass << ".\nAny last changes you want to make?\n\n1) Change Name\n2) Change Race\n3) Change Class\n4) Continue\n\n" << endl << "> "; cin >> input; if (input == "1") { pickName(); charVerify(); } else if (input == "2") { pickRace(); charVerify(); } else if (input == "3") { pickClass(); charVerify(); } else if (input == "4") { room1(); } else { cout << "Invalid Entry.\n Valid inputs are '1', '2', '3', or '4'\n\n"; charVerify(); } } void main() { SetConsoleTitle("Text-Based RPG"); pickName(); pickRace(); pickClass(); charVerify(); system("pause"); return; }
  25. markrodgers11

    GFx Card Capabilities

    i figured it'd be done somehow like that. So I think I'm going to stick with dx9 for now ;p
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!