I am creating a game where users must log in and save results to a server. I would like to be able to store all of their data on the server so that anyone can perform an on-demand lookup of, say, the five people who have the highest level character or, the most advanced weapons or something. I want my game to run as an applet, but I know those are sandboxed and I don’t know which I/O methods will work. I was hoping that I could use serialization but that could pose a problem when more than one user tries to access, and also will serialization work? My website will be hosted on Freewebs (www.freewebs.com) and I’m not too sure how kindly they’d take to me trying to write to their server. How do I serialize an object and store it at a URL?
With an unsigned applet you can only communicate back to the originating server. So you can make requested back to that host but you’ll get security exceptions if you try to go outside of that.
Hope that helps.
-Matt Hicks
That did help. I was hoping anyway to store all of my players’ info on one serialized object at a specific URL. How would I go about writing a file to the Internet?
Well, a lot is determined by your host. If you have your own server I would suggest using a networking tool like JGN (sorry, but it just makes sense) http://javagamenetworking.dev.java.net, but if your server will not allow you to deploy your own server application then you could write something as a JSP, JSF, PHP, Perl, ASP, etc. that you could simple create a URLConnection to the URL where your script and include elements in the GET or POST that you want to send to the server and it could generate the file(s) accordingly. The same for pulling the information back. If you decide to go this route you might find some more extensive wrappers for URL requests like the ones in the Apache Commons useful.
-Matt Hicks
basicly, if you have your own server (payed for hosting) you can store data in a database or write it in a file with some scripts (php, perl…) … this is assuimng you can’t deply your app to do than on the server.
The JSP is a good idea but I’ve personally never gotten one to work on my computer. I’d forgotten about them because the one time I tried it it didn’t work. Are you supposed to compile them or something? (Don’t laugh, I’m dead serious.)