   Simple High Score system
  Hi all!I have made a simple game and now I wish to add a high score feature.I would like to avoid using the standard File I/O in C++ as apparently OGRE doesn't really like that. So I am thinking of a simpler solution.What I want to do is (assuming the player does not exit the game) :1) in the game over state initialize highscore to 0 (first run)2) set highscore variable in game over state to the current player score3) player selects replay game and plays the game again4) player returns to the game over state5) compare the current player score with the highscoreThe problem I have is that highscore initializes to zero everything I enter game state since highscore=0; is called in GameOverState::Enter().Any idea how if this is somehow possible? If not, is there any other simple solution since what I basically want to do is store a integer throughout the game and changing it only when another integer value is larger than its current. This of course is assuming the player doesn't exit the game.Thanks.   
Quote:Original post by jonathancI would like to avoid using the standard File I/O in C++ as apparently OGRE doesn't really like that.What do you mean OGRE doesn't really like that?Quote:Original post by jonathancThe problem I have is that highscore initializes to zero everything I enter game state since highscore=0; is called in GameOverState::Enter().I'm not gonna lie, I have no idea what you just said (or were trying to say).   ;  meh sorry a lil tired from coding the whole day I guess.In short, is there a possible way to implement a high score system without the need to read and write to/from a file?   ;  The only things I can think of are:1) Use the registry (assuming you're on Windows) (but this pretty  much writes it to a file anyway... just not your normal file)2) Don't ever close the programBut really I have a hard time imagining Ogre has problems with you using files.   ;  There is, but it will only last until you turn off the program then all the data will be lost.You were saying the high score was getting reset in GameOverState::Enter(), I don't know the ogre engine at all but what you need to do is set your HighScore to 0 right when your game starts up, not when it enters the game over state.That will fix your issues.Also, if ogre doesnt like standard file i/o it must give you some interface to read/write files (im 100% sure it does... or that regular file i/o does work with ogre, there's no way ogre forces you to never read/write files).You should find out the answer to that one so you can use files   ;  Hmm, thanks for the suggestions. I can read from custom files using Ogre but I can't find much information about writing to a file.Someone suggested looking at TinyXML to export and import data using XML but I have no experience in XML at the moment.Also, I apologize if this question is posted in the wrong forum.Anyhow, I thank you all for the advice given!   ;  I think you are seriously misinformed about the situation. Can you give a link showing us why you can't use files?   ;Quote:Original post by jonathancHmm, thanks for the suggestions. I can read from custom files using Ogre but I can't find much information about writing to a file.You don't have to use Ogre to read from files.  I actually haven't used it so I don't know what the Ogre API gives you, but you really should be able to use a std::fstream without any problems.Quote:Original post by jonathancSomeone suggested looking at TinyXML to export and import data using XML but I have no experience in XML at the moment.Yeah, but that would require you to use a file.