I calculate the score by ordering the die in my game, but how can I do to keep it (persistent). I think the easiest is a TXT file.
So I would need writeFile () and readFile () in addition to openFIle () and closeFIle () I suppose that also sizeFIle ()
Any Suggestions?
How to save score of my game?
- EricB
- Bronze Sponsor
- Posts: 360
- Joined: Fri Apr 09, 2010 5:28 am
- Location: Florida
- x 213
- Contact:
Re: How to save score of my game?
Not really a question related to Ogre, but I would do it in something like XML. Specially if you're already using dotscene system (thus already have an xml lib included in your project.)
Benefits of XML over text file is organization. You could have high scores for different profiles as well as total high scores in an easily readable format.
Benefits of XML over text file is organization. You could have high scores for different profiles as well as total high scores in an easily readable format.
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 168
Re: How to save score of my game?
I have used XML but now I use sqlite, but I store many many many things, if you only plan to store a single score or a few values a think txt is ok
edit: yes! my vote is for json, haven't use it much but seems really nice and files are very readeable
edit: yes! my vote is for json, haven't use it much but seems really nice and files are very readeable
Last edited by xrgo on Wed Feb 01, 2017 1:53 pm, edited 1 time in total.
-
- OGRE Expert User
- Posts: 1227
- Joined: Thu Dec 11, 2008 7:56 pm
- Location: Bristol, UK
- x 157
Re: How to save score of my game?
any form of database would be overkill I think, as for file format I dont think it matters, XML, JSON.... whatever, as long as you use a standard as there are plenty of parsers around. Dont role your own, it will quickly get annoying!
- EricB
- Bronze Sponsor
- Posts: 360
- Joined: Fri Apr 09, 2010 5:28 am
- Location: Florida
- x 213
- Contact:
Re: How to save score of my game?
In GearCity I use SQLite, it's amazing. However the difference is, GC's save games get up into 100mb and over. I highly doubt i7strelok's highscore system is going get that large. (If it's networked, then maybe)xrgo wrote:I have used XML but now I use sqlite, but I store many many many things, if you only plan to store a single score or a few values a think txt is ok
edit: yes! my vote is for json, haven't use it much but seems really nice and files are very readeable
So I will have to lean with al2950 on this one. Formatted texted system is the way to go. As I recommended XML. JSON is another option, although personally I don't touch anything with the words "java" in it with a stick. (Yes, I know java and javascript are two different things. They both are horrible though. )
-
- Orc Shaman
- Posts: 737
- Joined: Fri May 31, 2013 2:28 am
- x 65
Re: How to save score of my game?
for such a small task this might be sufficient http://www.ogre3d.org/tikiwiki/All-purp ... ipt+parserAny Suggestions?
i'm actually using a xml library i wrote 10 years ago, its not that easy to write as one might assume,there are still some bugs , lessoned learned- always use the most popular and most supported framework libraries, never roll your ownDont role your own, it will quickly get annoying!
you want extra performance...just wait for hardware to get faster
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..
coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..
coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos