Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (527)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (594)
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  
  Storing data for a pokemon like game  (Read 642 times)
0 Members and 1 Guest are viewing this topic.
Offline Fr0zen

Junior Newbie





« Posted 2013-04-14 17:42:08 »



The game I'm developing is close to Pokemon. How should I store the data? I am currently thinking of text files where I save the map and have a corresponding textfile for the trainers and their teams on the "current" screen. However this leaves me with a LOT of textfiles.

At the moment I'm thinking of something like this, however I haven't coded this yet so I can still easily change this.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
@Trainer;5;
@Pokemon;12;1;3;4;6;
@Pokemon;13;1;2;5;
@Pokemon;13;1;4;5;
@Pokemon;11;1;3;5;
@Pokemon;16;1;2;7;
@Trainer;3
@Pokemon;13;1;4;5;
@Pokemon;11;1;3;5;
@Pokemon;16;1;2;7;


Where the first column is the "type" of the entry. If the first is Trainer the second is his number of Pokemon. If the first is Pokemon the second is the level, the third the type, the fourth/fifth/sixth the IDs of his attacks. (How should I store the attacks? A seperate textfile where I just store the attacks?)

I am currently finding myself with having such a huge amount of data that I'm starting to wonder wether I should be using a Database instead?

Using Java(LWJGL).

Additionally:
Posted this on stackexchange already, though wanted more expert opinions on this! Smiley
Offline kutucuk

Senior Devvie


Medals: 5
Exp: 3 years



« Reply #1 - Posted 2013-04-14 18:18:38 »

I am no expert, but is your game suitable for serialization?

You could create a class that holds everything about your characters, then pass your data to it, store using that class objects, and save to a file. Then you could build some retriever methods like getPokemonAttackCount() etc. So when you open the file, you just read the object, extract the data then send to the relevant classes/methods.

I think I made it sound complex, but it is not that hard.
Offline Fr0zen

Junior Newbie





« Reply #2 - Posted 2013-04-14 18:21:10 »

I am no expert, but is your game suitable for serialization?

You could create a class that holds everything about your characters, then pass your data to it, store using that class objects, and save to a file. Then you could build some retriever methods like getPokemonAttackCount() etc. So when you open the file, you just read the object, extract the data then send to the relevant classes/methods.

I think I made it sound complex, but it is not that hard.
It's very similar to Pokemon.
The problem is not saving my current game state, the problem is storing things that are set(the environment). For example where a trainer is positioned and what his pokemon are, what the attacks of his pokemon are, etc.
I am unsure wether to use a Database(SQLite?) or text files. Or maybe there is another very different approach?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline tyeeeee1
« Reply #3 - Posted 2013-04-14 19:18:23 »

I'd probably just go with text files for most of the information, they're easy to use.
Offline Fr0zen

Junior Newbie





« Reply #4 - Posted 2013-04-14 19:20:32 »

I'd probably just go with text files for most of the information, they're easy to use.

True, however I would still need to encrypt them somehow otherwise users would be able to edit them and make the game easier. Probably just binary or something.
Offline blaa_vogn

Junior Devvie


Projects: 2



« Reply #5 - Posted 2013-04-14 19:31:01 »

Quote
True, however I would still need to encrypt them somehow otherwise users would be able to edit them and make the game easier. Probably just binary or something.

Unless you are going for a big game, with high score/multi-player as an important feature, I wouldn't care.

If anybody liked my game enough to mod, and play with it, I would be super happy.

But if you have a boner for encryption then go for it Wink
Offline RobinB

JGO Ninja


Medals: 44
Projects: 1
Exp: 3 years


Spacegame in progress


« Reply #6 - Posted 2013-04-14 19:51:49 »

I think you shoud give trainers / pokemon their own id, and cleate an data file for each entity for data storage.
Then in your map you could just add an entry for npcxxx / pkmnxxxx or something.
Many datafiles does not seem like an problem, since you only have to refrence the id ths way and gives a lot of flexibility.

If you want to block people from editing files, online storage is your ONLY solution.
Everything whats send (and later decoded) by the client can be changed (because you need to include decription code, what could easly be found in your code).
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.

PocketCrafter7 (14 views)
2014-11-28 16:25:35

PocketCrafter7 (9 views)
2014-11-28 16:25:09

PocketCrafter7 (10 views)
2014-11-28 16:24:29

toopeicgaming1999 (76 views)
2014-11-26 15:22:04

toopeicgaming1999 (67 views)
2014-11-26 15:20:36

toopeicgaming1999 (16 views)
2014-11-26 15:20:08

SHC (30 views)
2014-11-25 12:00:59

SHC (28 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (28 views)
2014-11-24 19:59:16
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!