levijgraham

Member
  • Content count

    42
  • Joined

  • Last visited

Community Reputation

100 Neutral

About levijgraham

  • Rank
    Member
  1. Saving File Help

    amazing thank u i couldnt figure that out for the life of me
  2. Hello im trying to save the chuncks of my map in in the folder called level each chunk is supposed to be represented by a diffrent file but i cant seem to figure out how to get what number my loop is on to save in with my file name so i end up getting files called all sorts of names that i dont want. [code] void Map::Save() { for(int loop = 0; loop < Map::AmountOfChuncks;loop++) { for(int loop2 = 0; loop2 < Map::AmountOfChuncks;loop2++) { ofstream file( "Level/Chunck"+loop+"_"+loop2".Data" ); Map::GenerateChunck(); for(int loop3 = 0; loop3 < Map::AmountOfChuncks;loop3++) { for(int loop4 = 0; loop4 < Map::AmountOfChuncks;loop4++) { file << Map::Data[loop3][loop4]; } } file.close(); } }} [/code]
  3. Project Dark Ages

    Project Dark Ages is a medieval sim game In Development [color="#0000ee"][u][url="http://projectdarkages.weebly.com/"]My link[/url] [/u][/color]
  4. i have attached a picture of the error i get it when i send my map between the server and the client. theres my main [code]#include <iostream> #include <string> #include "GameState.h" #include "Socket.h" #include "Level.h" using namespace std; GameState CurrentGameState; const int STRLEN = 256; const int MAPLENGTH = 250; Level CurrentLevel; int main() { CurrentLevel.init(); int port = 666; char *ipAddress = "127.0.0.1"; char recMessage[STRLEN]; char sendMessage[STRLEN]; bool run = true; while (true) { int a = CurrentGameState.run(); if(a == 1) { bool run2 = true; ServerSocket sockServer; cout << "HOSTING..."<<endl; sockServer.StartHosting(port); sockServer.Listen(); while (run2) { char sendMap[MAPLENGTH]; CurrentLevel.draw(); CurrentLevel.Edit(true); int id = 0; for(int y = 0;y < 10;y++) { for(int x = 0;x < 25;x++) { sendMap[id] = CurrentLevel.map[x][y]; id++; } } sockServer.SendData( sendMap ); sockServer.ReceiveData(sendMap,MAPLENGTH); id = 0; for(int y = 0;y < 10;y++) { for(int x = 0;x < 25;x++) { CurrentLevel.map[x][y] = sendMap[id]; id++; } } if (strcmp(recMessage,"end") == 0 || strcmp(sendMessage,"end") == 0) { run2 = false; } } } else if(a == 2) { ClientSocket sockClient; cout << "ATTEMPTING TO CONNECT" << endl; sockClient.ConnectToServer(ipAddress,port); bool run2 = true; while (run2) { char sendMap[MAPLENGTH]; CurrentLevel.draw(); sockClient.ReceiveData(sendMap,MAPLENGTH); int id = 0; for(int y = 0;y < 10;y++) { for(int x = 0;x < 25;x++) { CurrentLevel.map[x][y] = sendMap[id]; id++; } } CurrentLevel.Edit(false); id = 0; for(int y = 0;y < 10;y++) { for(int x = 0;x < 25;x++) { sendMap[id] = CurrentLevel.map[x][y]; id++; } } sockClient.SendData( sendMap ); if (strcmp(recMessage,"end") == 0 || strcmp(sendMessage,"end") == 0) { run2 = false; } } sockClient.CloseConnection(); } else if(a == 3) { exit(0); } } return 0;}[/code]
  5. trying to use winsock2

    Thanks
  6. Hey i am trying to run a simple chat program in c++ and a keep getting this error. Can anyone tell me how to fix it? 1>------ Build started: Project: RTS, Configuration: Debug Win32 ------ 1>Build started 8/8/2011 5:43:59 PM. 1>InitializeBuildStatus: 1> Touching "Debug\RTS.unsuccessfulbuild". 1>ClCompile: 1> main.cpp 1> Socket.cpp 1>c:\users\levi\desktop\game\testfolder\rts\socket.cpp(19): warning C4551: function call missing argument list 1> Generating Code... 1>Socket.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "public: __thiscall Socket::Socket(void)" (??0Socket@@QAE@XZ) 1>Socket.obj : error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function "public: __thiscall Socket::Socket(void)" (??0Socket@@QAE@XZ) 1>Socket.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "public: __thiscall Socket::Socket(void)" (??0Socket@@QAE@XZ) 1>Socket.obj : error LNK2019: unresolved external symbol __imp__send@16 referenced in function "public: bool __thiscall Socket::SendData(char *)" (?SendData@Socket@@QAE_NPAD@Z) 1>Socket.obj : error LNK2019: unresolved external symbol __imp__recv@16 referenced in function "public: bool __thiscall Socket::ReceiveData(char *,int)" (?ReceiveData@Socket@@QAE_NPADH@Z) 1>Socket.obj : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "public: void __thiscall Socket::CloseConnection(void)" (?CloseConnection@Socket@@QAEXXZ) 1>Socket.obj : error LNK2019: unresolved external symbol __imp__accept@12 referenced in function "public: void __thiscall ServerSocket::Listen(void)" (?Listen@ServerSocket@@QAEXXZ) 1>Socket.obj : error LNK2019: unresolved external symbol __imp__listen@8 referenced in function "public: void __thiscall ServerSocket::StartHosting(int)" (?StartHosting@ServerSocket@@QAEXH@Z) 1>Socket.obj : error LNK2019: unresolved external symbol __imp__connect@12 referenced in function "public: void __thiscall ServerSocket::StartHosting(int)" (?StartHosting@ServerSocket@@QAEXH@Z) 1>Socket.obj : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function "public: void __thiscall ServerSocket::StartHosting(int)" (?StartHosting@ServerSocket@@QAEXH@Z) 1>Socket.obj : error LNK2019: unresolved external symbol __imp__inet_addr@4 referenced in function "public: void __thiscall ServerSocket::StartHosting(int)" (?StartHosting@ServerSocket@@QAEXH@Z) 1>C:\Users\levi\Desktop\Game\TestFolder\RTS\Debug\RTS.exe : fatal error LNK1120: 11 unresolved externals 1> 1>Build FAILED. 1> 1>Time Elapsed 00:00:03.97 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  7. fstream loading text file into char array

    i just cant get the text file to go into a char array
  8. Hello I am trying to get a text file to load up through this bit of code here and get put into a char array but it wont let me, It says my array is corrupt ... any ideas? [code]int MenuRead(string SaveFileNameInfo) { char FILE[255]; char acTemp; ifstream in(SaveFileNameInfo, ios::in | ios::binary); if(!in) { cout << "can't open file! " << SaveFileNameInfo << endl; return 1; } while(in) { in.get(acTemp); if(in) cout << acTemp; FILE[255] = acTemp; } in.close(); cout << FILE; return 0;}[/code]
  9. How to begin StarCraft editor?

    I have the same problem, every tutorial i found sucked
  10. fstream help

    Hello i'm having a problem with fstream im trying to make it read whats on the mainmenu file i have it all loading into line but i want to be able to read sections. If anyone could help that would be great <My mainmenu.txt file> MenuTitle: MainMenu MenuSaveFileName: MainMenu.txt MenuID: 1 SubMenus: 1 MenuItems: 2 MenuItem0: NewGame <SubMenu>NewGame.txt MenuItem1: LoadGame <SubMenu>LoadGame.txt MenuItem2: Quit <SubMenu>Quit.txt [code]#include <iostream> #include <fstream> #include <string> #include "Menus.h" using namespace std; int MenuDraw(string SaveFileNameDraw) { string line; //the variable of type ifstream: ifstream myfile (SaveFileNameDraw); //check to see if the file is opened: if (myfile.is_open()) { //while there are still lines in the //file, keep reading: while (! myfile.eof() ) { //place the line from myfile into the //line variable: getline (myfile,line); //display the line we gathered: cout << line << endl; } //close the stream: myfile.close(); } else cout << "Unable to open file"; return 0; } int MenuSave(string MenuTitle,int MenuItems,bool SubMenus,int MenuID,string SaveFileName) { cout << "Saving MenuFile " << SaveFileName << "\n\n"; ofstream file; file.open(SaveFileName); file << "MenuTitle: " << MenuTitle << "\n\n"; file << "MenuSaveFileName: " << SaveFileName << "\n\n"; file << "MenuID: " << MenuID << "\n\n"; file << "SubMenus: " << SubMenus << "\n\n"; file << "MenuItems: " << MenuItems << "\n\n"; int counter; for (counter = 0; counter <= MenuItems; counter++) { cout << "What do you want to call menu item " << counter << "\n"; string sName; cin >> sName; file << "MenuItem" << counter << ": " << sName; if (SubMenus == true) { cout << "Type in File name of menu you want it to be linked to\n"; string sFileName; cin >> sFileName; file << " <SubMenu>" << sFileName << "\n"; } else { file << "\n"; } } file.close(); return 0;}[/code]
  11. substitute for win32 for windows mac and linux

    yeah i know opengl will have to be used
  12. hello i need a substitute for win32 on windows mac and Linux operating systems that i can implement in direct X does anyone know of any?
  13. Could you give me feedback on my first game?

    very good game gj!
  14. pathfinding

    i did the tutorials i found were horrible
  15. pathfinding

    can someone tell me were there are some good pathfinding tutorials?