Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (534)
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  
  External Data Files  (Read 705 times)
0 Members and 1 Guest are viewing this topic.
Offline Black Drazon

Junior Newbie





« Posted 2006-04-19 06:41:00 »

I'm back with the strategy game again, and another question that's been bugging me for a while.

I want to represent the raw data of maps and units in external datafiles, possibly XML.  The trouble is, I dunno if it's possible to encript stuff like that, is there a way?  I suppose in this precise situation I'd be better off not encrypting but for the sake of my long-term curiosity and if I ever want to make save files, I'd like to know the answer anyways.  I've been curious about external files ever since I first tried to hack a game's save.  Are they encrypted?  Do they use special characters that look like garbage to text editors and not to the game?  How do they communicate anything whatsoever to the game?  These things puzzle me to no end.

Also, just so it's clear, I realise that the save files of my past were not written in XML, lol.
Offline Ask_Hjorth_Larsen

Junior Member




Java games rock!


« Reply #1 - Posted 2006-04-19 20:00:26 »

Check out java.util.Properties, it has a method which stores in XML through an OutputStream. Perhaps you can use that with a javax.crypto.CipherOutputStream. I haven't used that stuff yet, but it seems pretty straight forward.
Offline Jeff

JGO Coder




Got any cats?


« Reply #2 - Posted 2006-04-20 06:40:31 »

Are they encrypted?  Do they use special characters that look like garbage to text editors and not to the game?

No they are generally just binary data files.  Ther eason they look like garbage to you in your text editor is becasue they are binaries, not text.

Binary data is much faster and easier for the computer to read and write but is not human redable.

Quote
  How do they communicate anything whatsoever to the game?  These things puzzle me to no end.

See DataInputStream and DataOutputStream in the Javadoc.  Basically, the game knwos the order in which the data was written into the file and reads it out in the same order. 

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Black Drazon

Junior Newbie





« Reply #3 - Posted 2006-04-21 03:26:48 »

So, the save files are just binary versions of "HP = 45 [divider] Loc=23,45,64" or something?
Offline Jeff

JGO Coder




Got any cats?


« Reply #4 - Posted 2006-04-22 01:16:11 »

Actually the data file is usually the binary form of "45,23,45,64..."

You know the meaning by the position in the file.

All these tags are one of the reasons XMl bloats data files.  (The other reason is that "255" takes 1 byte in binary but 3 bytes in ascii, or 6 bytes in unicode.)

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
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 (35 views)
2014-07-24 01:59:36

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

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

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

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

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

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

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

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

Riven (56 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!