Archived

This topic is now archived and is closed to further replies.

TreizeSG

[java] Everyone's Favorite... FILE IO!!!

Recommended Posts

Ok, question concerning serialization etc... I made my first Java game and, quite eloquently, entitled it JavaBattle. It''s actually really dumb, simple, and unoriginal, but located at www.geocities.com/silver_klyph/JavaBattle.html for your reference. The purpose of the game was for me to play around with applets and other fun things. There are two ideas that I want to implement however. JavaBattle, as of right now, keeps track of nothing. You put in your name, and beat up on a computer player (unless you''re me, in which case the comp beats up on you!!). I was interested in being able to establish characters where people could select a Username and password, and the applet would keep track of wins/losses, username/password in a separate file. Once a user''s name and password has been manually written into the file, they are correctly identified. However, a person cannot create a character themselves, because the file doesn''t give "Permission" to write. How do I solve this? I''m working with Java 1.3 if it means anything. I''ll save the second idea (networking) for another fun post =). Thanks!!

Share this post


Link to post
Share on other sites
That's one of the downsides when using applets.

Applets file IO attempts to save files to a local computer. In order to do that, it needs to be a "trusted applet." I don't remember how to ask permission to do that.

Another option is to create an application on the net, have it store all info in a database, and have the applet connect to the application.

[edited by - nickwinters on July 28, 2003 12:08:15 PM]

Share this post


Link to post
Share on other sites
Could I make a client/server game and when I wanted to write data to a file for a new player, the server application could just write the data to a file? Or would I encounter the same problems?

[edited by - TreizeSG on July 28, 2003 3:22:47 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by nickwinters
As long as it's an application, and not an applet, it can read/write files.


Obviously, the OP is talking about applets since the link is to an applet. This is a REALLY big problem I've run into several times and never resolved; reading a data file from the same directory as an applet.

Does anyone have a clue on this?

[edited by - nonnus29 on July 29, 2003 2:30:06 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by TreizeSG
Could I make a client/server game and when I wanted to write data to a file for a new player, the server application could just write the data to a file? Or would I encounter the same problems?

[edited by - TreizeSG on July 28, 2003 3:22:47 PM]


You'll need to have an application running in the server with RW rights. You could make the client applet to POST the info through a cgi script in the server which will write the info.

[edited by - xaxa on July 28, 2003 12:26:31 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
When I try to write a file in hd I get a IOException. What things can you make to allow write files by an applet in the local disk? is sonething related to programing or system configuration.

Share this post


Link to post
Share on other sites