Nietsnie

Member
  • Content count

    306
  • Joined

  • Last visited

Community Reputation

270 Neutral

About Nietsnie

  • Rank
    Member
  1. So here is the scenario: I have a game that is played on a web page. At every move I would like the current game state to be saved. I would like to save the current game state on the web server in a simple text file, and when the player logs back in load that text file and have them continue playing where they left off. The game is written in javascript. I have been been doing a lot of reading but have been getting quite lost. I understand I could use PHP to load the game from a text file and feed it to a javascript function to restart the game, but how would I save the current game state to a file? AJAX seems a little overkill, and I can't use PHP unless I reload the page (which I do not want to do). Any suggestions/ideas? Need any clarifications? Thanks for the help!
  2. j-locke: That is a sample of what printPhrases() returns. The program is currently set to show phrases of length 4. The full text of "small.txt" (the source file) is: Esperanza feels lost, alone, and confused. She believes that the only ones who can understand her feelings are trees. The trees are skinny and pointy. The city had planted them in concrete, which naturally is not the best nor the healthiest place for trees to grow. Esperanza sees the trees as a reflection of herself [skinny and angular]. In spite of their location, the trees seem to survive in a way. This idea of persevering parallels back to Esperanza. She struggles to be successful even though she is in a harsh environment. Her description of the setting leads me to think that she is poor. Therefore, she has limitations due to class. Is this why she feels that she can only confide in trees? For Esperanza, the trees seem to be like a support network for her. She would talk to them when she felt lonely. It was almost as if the trees were her family members. The trees were not only a support network and a reflection of Esperanza. They inspired Esperanza. When Esperanza was ready to give up, she looked at the trees, and they told her to keep, keep, keep, keep. The trees taught Esperanza perseverance, which would definitely help her achieve success. Bibliography Four Skinny Trees Words: 207
  3. Hey all, I'm writing a program that find all the phrases of a certain length in a file. So it runs through the file from start to end finding every phrase and stores them in a vector of strings. It works almost perfectly, except it sometimes deletes one character in the same place every time a new phrase is found. Esperanza feels lost, alone, feels lost, alone, and lost, alone, and confused. alone, and confused. She and onfused. She believes onfused. he believes that he elieves that the elieves hat the only hat he only ones he nly ones who nly nes who can As you can see above, starting on the fifth line, the second word in the phrase loses its first letter. The relevant class code for generating the above is below: void Doc::findPhrases() { string curPhrase; string buffer; fstream file("small.txt"); int curLoc; while(true) { curPhrase = ""; if (file.eof()) return; file >> curPhrase; curLoc = file.tellg(); for (int i=0; i<phraseLength-1; i++) { if (file.eof()) return; file >> buffer; curPhrase = curPhrase + " " + buffer; } phrases.push_back(curPhrase); file.seekg(curLoc); } file.close(); } void Doc::printPhrases() { for (int i=0; i<50; i++) { cout << phrases[i] << endl; } } I think it has to something to do with how I read in the first buffer word (the second letter in the phrase)... but I'm not sure what exactly is wrong. Any ideas? Thanks for the help!
  4. Hey, Is there a way to bitwise AND two different ararys together? Say I have: char array1[100]; char array2[100]; Then the two arrays are filled with values somehow. If I try to do something like: if (array1 & array2) doSomething(); (basically checking for overlap in the arrays) the compile throws out an error. Any ideas? Thanks!
  5. Ah solved it somehow! In some of the paint functions I was selecting a new brush/pen but then never resetting back to the default brush. Threw some SelectObjects in and everything is working now.
  6. I investigated WM_PAINT and the error only occurs when I'm passing off the handles to the DC, brush and pens. case WM_PAINT: PAINTSTRUCT ps; BeginPaint(hwnd, &ps); BitBlt (hdcBackBuffer, 0, 0, cxClient, cyClient, 0,0,0, WHITENESS); oldBrush = (HBRUSH)SelectObject(hdcBackBuffer, greyBrush); oldPen = (HPEN)SelectObject(hdcBackBuffer, greyPen); game.paint(hdcBackBuffer, oldBrush, oldPen); SelectObject(hdcBackBuffer, oldPen); SelectObject(hdcBackBuffer, oldBrush); BitBlt(ps.hdc, 0, 0, cxClient, cyClient, hdcBackBuffer, 0, 0, SRCCOPY); EndPaint(hwnd, &ps); break; And all game.paint() does right now (I reduced it so just this one line causes an error) is the following: void Game::paint(HDC hdc, HBRUSH hbrush, HPEN hpen) { Ellipse(hdc, 50, 50, 100, 100); } I can't see how that simply statement is causing all this to mess up, but somehow it is haha. Do I need to release the brushes and pens or the device context after I use them when I pass them, or something like that?
  7. Hey all, So I have basic game set-up using the Win32 GDI API, and it is working almost fine. In the WinMain function I have a section where I check if I'm ready for the next frame (this is done using a timer), and if so I updated my game and refresh the screen: if(timer.readyForNextFrame()) { game.run(); InvalidateRect(hwnd, NULL, TRUE); UpdateWindow(hwnd); } I've narrowed the problem down to InvalidateRect. After a certain amount of time (always the same), the objects in the window will turn to outlines, and sometimes the window attempts to go full screen and general mayhem ensues... even if I prevent all game variables from changing, this still occurs at the same time into the program (about 30 seconds or so...) Does anyone have any idea why this happens? If I comment out InvalidateRect everything is dandy, but of course the window is no longer properly updated. Thanks for any help!
  8. I don't think that's the one... One thing I do remember is the book had little boxes with arrows to describe how cons and append and other various functions are different. Weird thing to remember, but for some reason it was memorable.
  9. Hey all, A few years ago I remember reading a book (or a set of tutorials) online for either Common Lisp or Scheme. I remember it being referred to as the 'bible' for Common Lisp/Scheme, and for some reason I think its called the Red Book or the Blue Book or something along those lines. It was extremely helpful, and went quite in-depth on the 'behind-the-scenes' part of Common Lisp/Scheme. I tried searching the forums for it but had no success. Is anyone familiar with the book I am talking about? Do you know where I can find it? Thanks for any help!
  10. Three Worlds Finger Puppets???

    We don't do that here. You are teh dumb.
  11. Trying to find a song which goes WOAAAAAAAAAH

    I know just the song: "Black Betty by Ram Jam". Basically goes: good intro music, WOOOAAAHHHH BLACK BETTY! then the rest of an amazing song.
  12. Need a new mouse.

    I have the Click Plus. I used to use it for gaming but after switching to a MX518 there is noticable lag between when you move the mouse and when the cursor moves. Very critical for gaming... if you want gaming go MX518 or the new G series by Logitech.
  13. O thank god. There is something where you just click where on the map you want to go and your there. No more godamn silt-riders or running from town to town :D
  14. software for taking calc notes on a laptop

    Microsoft Word comes free with an equation editor (Insert->Object->Microsoft Equaion Editor 3.0), which can do all math stuff, albeit it seems like it is still not complete as there are numerous bugs.
  15. So nobody has taken a look at WinFS beta 1 then?

    A review here on the boards three threads down.