Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Libgdx,save Game Data... can i use .properties or should i use JSON?  (Read 2043 times)
0 Members and 1 Guest are viewing this topic.
Offline Andre Lopes
« Posted 2013-10-02 18:06:41 »

Libgdx,save Game Data... can i use .properties or should i use JSON?
I plan to play the game in desktop/android.

Offline Andre Lopes
« Reply #1 - Posted 2013-10-02 18:46:00 »

IM just wondering if this : http://www.mkyong.com/java/java-properties-file-examples/

Will work under android
Offline Grunnt

JGO Wizard


Medals: 64
Projects: 8
Exp: 5 years


Complex != complicated


« Reply #2 - Posted 2013-10-02 18:55:59 »

Java .properties is really only useful if you have a very simple game state (e.g. level #). If it's anything more complex you want to save JSON is an option, but you could also simply just use an ObjectOutputStream which works just fine. Each of these methods works under android.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Andre Lopes
« Reply #3 - Posted 2013-10-02 18:59:31 »

Java .properties is really only useful if you have a very simple game state (e.g. level #). If it's anything more complex you want to save JSON is an option, but you could also simply just use an ObjectOutputStream which works just fine. Each of these methods works under android.

Oh ok, but when i load the ,properties, do i need to use GDx.files.internal or i can simply use the java file loader?
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #4 - Posted 2013-10-02 19:16:54 »

Read this, it'll help. I would always use LibGDXs way though, why mix and match?
http://code.google.com/p/libgdx/wiki/FileHandling

Offline Jeremy
« Reply #5 - Posted 2013-10-02 19:32:10 »

Java .properties is really only useful if you have a very simple game state (e.g. level #). If it's anything more complex you want to save JSON is an option, but you could also simply just use an ObjectOutputStream which works just fine. Each of these methods works under android.

Keeping in mind that ObjectOutputStream usually creates very deep call stacks, and that Android usually has a smaller stack allocated for applications than your typical desktop PC.

It isn't a problem unless you go crazy with object serialization, but I've seen the problem posted before.

Just an FYI if you get stackoverflow when serializing objects on android.

JevaEngine, Latest Playthrough (This demo is networked with a centralized server model)

http://www.youtube.com/watch?v=rWA8bajpVXg
Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Reply #6 - Posted 2013-10-02 23:22:45 »

if using libgdx and don't want to use those
I would suggest Preferences

Can be pretty useful for most things, and works great in PC and Android


http://www.java-gaming.org/topics/how-to-load-player-save-data/30618/msg/282944/view.html#msg282944


Best of all, its ridiculously easy to do!
For more complex things, I usually have something that embeds the data into some strings or whatever

"Experience is what you get when you did not get what you wanted"
Offline Andre Lopes
« Reply #7 - Posted 2013-10-03 06:06:48 »

if using libgdx and don't want to use those
I would suggest Preferences

Can be pretty useful for most things, and works great in PC and Android


http://www.java-gaming.org/topics/how-to-load-player-save-data/30618/msg/282944/view.html#msg282944


Best of all, its ridiculously easy to do!
For more complex things, I usually have something that embeds the data into some strings or whatever

Alright, i will try that!
Im just worried that i  cant properly control where the file is hosted in pc....
it seems its hosted in /%username/bla bla bla Huh??
Offline namrog84

JGO Ninja


Medals: 46
Projects: 4


Keep programming!


« Reply #8 - Posted 2013-10-03 08:10:07 »

Yeah preferences default to that location, for me its
C:\Users\namro_000\.prefs\

But on other systems, I'd sure it'd default somewhere.


It goes to an appropriate place for windows for that current user, why does it matter that you can't save it somewhere else?


"Experience is what you get when you did not get what you wanted"
Offline Andre Lopes
« Reply #9 - Posted 2013-10-10 06:21:11 »

Yeah preferences default to that location, for me its
C:\Users\namro_000\.prefs\

But on other systems, I'd sure it'd default somewhere.


It goes to an appropriate place for windows for that current user, why does it matter that you can't save it somewhere else?



I did that and worked perfectly! Loved it!!!!!!!!!!

Thanks guys, the issue is solved! For now Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline mbabuskov

Senior Member


Medals: 5
Projects: 1


Bigosaur.com


« Reply #10 - Posted 2013-10-11 17:37:10 »

Yeah preferences default to that location, for me its
C:\Users\namro_000\.prefs\

But on other systems, I'd sure it'd default somewhere.

On Linux, it goes into ~/.prefs

BTW, I wonder if users can edit this file on Android using some file manager? I'm storing the hiscore there, and I wouldn't like users to be able to mess with it easily.

Milan Babuskov
bigosaur.com
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #11 - Posted 2013-10-11 18:55:28 »

For game data like highscores, I'd recommend just using json and encrypting it.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (12 views)
2014-07-24 01:59:36

Riven (10 views)
2014-07-23 21:16:32

Riven (11 views)
2014-07-23 21:07:15

Riven (12 views)
2014-07-23 20:56:16

ctomni231 (42 views)
2014-07-18 06:55:21

Zero Volt (38 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (34 views)
2014-07-16 23:30:00

Cero (50 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!