• Content count

  • Joined

  • Last visited

Community Reputation

134 Neutral

About ForeverNoobie

  • Rank
  1. I know there must be something I'm doing wrong but for the life of me I don't see it. Heres a tiny excerpt from my code which is causing the problem. Alien[] aliens; aliens=new Alien[10]; aliens[0].setX(10); //<--- gives me a Null Pointer exception Seems simple enough. My Alien class has a println function in the constructor to let me know it was invoked but it never executes. If I change aliens from an array to a single variable and then set it equal to "new Alien();" then the Alien constructor is invoked and I don't get the exception. I know that isn't very much information but what could possibly make an attempt to make an array of objects not work, even when making a single one works just fine?
  2. Deferred lighting and instant radiosity

    I saw your name on the poll on the home page (Asking which user name is hardest to pronounce) and I decided to come check on your progress. I've been a fan of the concept of Infinity Online for a long time although the details are quite over my head. Good luck with the project. You are truly an inspiration to someone like me because I find it hard to stick with my big projects. I really hope you finish the game (and soon, I can't wait to beta test).
  3. Extra points if its a old and unique one that I could feasibly recreate.
  4. Hi. I'm thinking that it will be a good idea for me to do some game modding. I know how to program fairly well (I'd say I'm intermediate in c++), but I've never made any big projects. I figured modding will help me get some major accomplishments under my belt, with minimal work. Also I think I'd get a feel for what coding big projects is like (without actually having code any myself) So does anyone know of good books, or online resources for someone who wants to start modding? I'd be happy to get any tips, hints, or jewels of knowledge that can be spared as well. Thanks
  5. Sorry but this is going to be kinda long... So I'm making an application that takes a bitmap and compresses it into a .map file for one of my games. The map data basically consists only of walkable and non walkable area (which is represented by black and white in the bitmap). So I load in a black and white bitmap (which is still 24bpp by the way) and check if tiles of a certain area are white or black, then I bitwise 8 bool values into one byte. I keep going untill the entire thing is encoded. I'm starting with really tiny maps: 128 x 104 pixels.(the game is for cell phones) and each tile is 8x8 (16 tiles across and 13 down). I start with a bitmap thats 39kb and the result is a .map file that is 28 bytes. All of this worked fine untill I decompressed the data on my cell phone emulator and got unexpected results. I searched for the problem for ages but I didn't find it until I opened my .map files in a hex editor (admittedly I'm not great with hex but I figured It might help somehow). For some reason I find that the name of the file is encoded in the map data. For instance for (made from TestMap3.bmp) this is the hex: 00000000:10 0d 00 00 0c 00 00 00 ff ff ff ff 54 65 73 74 -> ........ÿÿÿÿTest 00000010:4d 61 70 33 2e 62 6d 70 00 00 00 00 ->Map3.bmp.... Since the file is only just big enough to store the map data, of course it must be obstructed by the name. I can't figure out for the life of me how the name got in my data. All my compression algorithm does is pack 8 bools into a byte depending on whether the tiles are black or white... By the way the file above is made from a bitmap that's totally black, so I expected something to the effect of: 00 00 00 00 00 00... ect. So heres my code. Its rushed and its really nothing fancy... All the cout<< statements are to check values to find errors. #include <iostream> #include <fstream> #include <string> using namespace std; int* GetBMPData(string,unsigned char**); int ShrinkData(unsigned char*, int, int, unsigned char**); void createMap(string, unsigned char* shrunkData, int); const string FILE_NAME="TestMap3"; const int TILE_DEMENSIONS = 8; const int WIDTH=0; const int HEIGHT=1; int numbytes; int main() { unsigned char* data; unsigned char* compressedData; int* demensions = GetBMPData(, &data); int shrankSize=ShrinkData(data, demensions[WIDTH], demensions[HEIGHT], &compressedData); createMap(FILE_NAME, compressedData, shrankSize); getchar(); } int* GetBMPData(string bmpFileName, unsigned char** data) { unsigned char offset[4]; //stores the offset to the RGB data unsigned char width[4]; //stores the width of the image unsigned char height[4]; //stores the height of the image bmpFileName+=".bmp"; ifstream bitstream(; //opens the file passed into the function bitstream.seekg(10); //seeks to the offset vale bitstream.get((char*)offset, 4); bitstream.seekg(18); //seek to the width bitstream.get((char*)width,4); bitstream.seekg(22); //seek to the height bitstream.get((char*)height,4); numbytes= (*((int*)width)) * (*((int*)height)) * 3; //numbytes equals the width times the height times three (the thre RGB compotents of a pixel) gotta love c++ right? if((*data)!=NULL) delete (*data);//(this is supposed to prevent memory leaks) *data=(unsigned char*) new char[numbytes]; //data equals a new array which is just the right size bitstream.seekg(*offset); //seek to the RGB data bitstream.get((char*)(*data), numbytes); bitstream.close(); //close the stream... best to be tidy right? cout<<"Offset: "<<*((int*)offset)<<"\nWidth: "<<*((int*)width)<<"\nHeight: " <<*((int*)height)<<"\n"; //check the values just in case int* returnVal = new int[2]; // return array for the width and height returnVal[WIDTH]=*((int*)width); //put width into first slot returnVal[HEIGHT]=*((int*)height); //and height into second return returnVal; } int ShrinkData(unsigned char* data, int width, int height, unsigned char** shrunk) { int numOfBlack=0; int numOfWhite=0; int numMapXTiles = width/TILE_DEMENSIONS; cout<<width/TILE_DEMENSIONS<<"\n"; cout<<height/TILE_DEMENSIONS<<"\n"; int numMapYTiles = height/TILE_DEMENSIONS; int eightcount=0; int shrunkSize=((numMapXTiles*numMapYTiles)/8) + 2; *shrunk = new unsigned char[shrunkSize]; int offset=2; //offsets the firs two initial values (*shrunk)[0]=numMapXTiles; (*shrunk)[1]=numMapYTiles; for(int i=0; i<numMapYTiles; i++) { for(int j=0; j<numMapXTiles; j++) { int bitPlace= eightcount%8; //this variable is how many places I shift the bits for compression int dataOffset=(i*numMapXTiles*TILE_DEMENSIONS*TILE_DEMENSIONS*3) + (j*TILE_DEMENSIONS*3); unsigned char* shrunkByte=((*shrunk)+(eightcount/8)+ offset); unsigned char bitWiser; unsigned char tileColor=*(data+dataOffset); if( tileColor == 255) { bitWiser=1; numOfWhite++; } else if( tileColor == 0) { bitWiser=0; numOfBlack++; } else { cout<<"Fatal Error: "<<"\n"; } //cout<<(i*16)+j<<": "<<(int)tileColor<<"\n"; //cout<<(i*16)+j<<": "<<(i*numMapXTiles*TILE_DEMENSIONS*TILE_DEMENSIONS*3) +(j*TILE_DEMENSIONS*3)<<"\n"; bitWiser<<bitPlace; *shrunkByte=(*shrunkByte) | bitWiser; eightcount++; } } cout<<"Number of white tiles: "<<numOfWhite<<"\nNumber of black tiles: "<<numOfBlack; //Note the white and black values are correct here but not after I decompress return shrunkSize; } void createMap(string fileName, unsigned char* shrankData, int shrankSize) { fileName+=".map"; ofstream mapFile(, ios::binary); mapFile.write((const char*)shrankData,shrankSize); mapFile.close(); } Sorry if thats hard to understand. Like I said its rushed. It was my goal to make the entire map system in one day. I thought it'd be simple enough. I did loads of debugging and cout-ing and I'm certain that all the data is correct when its loaded. The numOfBlack and numOfWhite variables are always right so I figure the compression is working well. For some reason though the .map file only contains the bitmap file name and a bit of useless data. In order for the code to work a white and black bitmap (24bpp) must be in the same path. Best to make it 128x104 if you run it yourself. I'm not sure how flexible it is. I should also tell you that when I used more white tiles (int the example near the top there were 0 white tiles) the name of file begins to get messed up in the hex file. For instance TestMap1 used half white tiles and half black and here's the hex: 00000000:10 0d 00 00 0d 01 00 00 ff ff ff ff 55 65 73 74 ........ÿÿÿÿUest 00000010:4d 61 70 31 2f 63 6d 70 01 01 00 00 Map1/cmp.... if anyone could help me with this I would greatly appreciate it. I'm really eager to get on with development. I'll elaborate on any part of the code that doesn't make sense to anyone. [Edited by - ForeverNoobie on December 26, 2008 6:38:40 PM]
  6. hmmm... Ooops... I must have misplaced some parentheses... Sorry for the rant...
  7. I'm trying to make a game in J2me and I'm trying to load a map in my own format. The problem is the map is super compressed and Java is giving me a hard time working with byte data. First of all there seems to be no way to convert a unsigned byte to int, which is a serious problem since Java wont let me do ANY bitwise operations on a byte. I mean wtf? Whats the point of having a byte type if you're going to intentionally make it damn near useless? Maybe I'm missing something. In c++ I can do just about any damn thing I want with data. Why is Java so restricted?
  8. My school just started a math club (which is composed mostly of calculus 1 students) and we are trying to think up a good first project. Making a game was suggested, which I liked because I'm a game programmer at heart, but no one else in the group is. I'm the only one with programming experience. So I decided to come up with a programming/game project that is so math based that we all can have equal parts in the project. I was thinking about suggesting a simple physics simulation... but I'm still considering other options. I need something that will take loads of math to make, and will be an exercise in, or show the importance of, math while playing. Any suggestions?
  9. Problem with reference variables

    Quote:Original post by antiquechrono ... in the event that you want to be a mad scientist... Hmmm... I should make that my new screen name MadComputerScientist ... maybe its a bit to long?
  10. Problem with reference variables

    Well, I guess I wanted the class to be able to be used for more things than just 2d and 3d boxes. I wanted the class to be able to possibly hold more than 6 elements and I figured being able to iterate through the elements would make certain algorithms easier. I wanted reference code names for a bit of simplicity in the case that the class was being used to represent a box. edit: Thx Crane for the answer and the warning. I'll watch this code carefully if I decide to use it.
  11. Problem with reference variables

    template<class T, int size> class GM_Set { public: T &x,&y,&width,&height,&z,&depth; T* data; GM_Set(): data(new T[size]), x(data[0]), y(data[1]), width(data[2]), height(data[3]), z(data[4]), depth(data[5]) {} } Thats a snippet from my class. What Im doing is basically making code names for the first six elements of data but for some reason its not working. It crashes when I try to access set.x but allows me to access data[0].
  12. The prize list looks a little bare this year... Just sayin.
  13. I'm about to buy a laptop. it will be more for work than games so I went easy on the power in favor of a low price, but out of curiosity I want to know exactly what kind of games I will be able to run. So heres the important hardware info: Model: Vostro 1500 Processor: Intel® Core™ 2 Duo T5270 (1.4GHz/800Mhz FSB/2MB cache) Memory: 2GB Shared Dual Channel DDR2 SDRAM at 667MHz, 2 DIMM Hard Drive: 160GB 5400RPM Hard Drive Video Card: 128MB NVIDIA® GeForce™ 8400M GS This comp would be good for playing games released in around what year?
  14. I believe an open source console situation led to a lot of horrible games and the crash of the gaming market. Of course this took place before I was born so I could be wrong (I saw it on Icons on G4). edit: Found a link: Yeah, Quality control is a good thing.
  15. File signatures

    Quote:Original post by taby You can generate an MD5 hash from the contents of the file. Then at run-time, re-verify that the hash of the file in question still matches. Ok but say the game has to modify the file. It would have to save the new hash to users comp so it would be easy for him/her to find right?