| | |
Need suggestions: Update Checking, Score keeping, and Submitting scores online.
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: May 2008
Posts: 122
Reputation:
Solved Threads: 5
1.) Update Checking.
2.) Score/Record keeping.
3.) Submitting score online.
Update Checking:
Currently, my program connects to a URL and checks if a new version is available. If one is, it simply opens up a dialog saying a new version is out and to go download it...
Is there a way to have it automatically open the path to the newest version in the users browser? Or if it's not too confusing, have it auto download the latest update?
Score/Record keeping:
I can make it save high scores during the single gaming session, but once the game exits and the user opens it back up, all the scores start at 0 again... I'm thinking the easiest way to do this is to have the highest score write to a .txt before exiting and on next run, retrieve the highest score from that .txt file again, that way it's never lost.
My concern with this, is someone cheating and just editing the value in the .txt file and bragging that they finished the game in 3 seconds. Is there a better way to do this?
Submitting scores online:
I know how to retrieve text from a URL, but how can you write to a URL if you don't have write permissions? I know a lot of websites have a "Submit" button which obvious takes in what people fill in and saves it. How can I take that same idea to log players high scores to my website?
Any ideas?
2.) Score/Record keeping.
3.) Submitting score online.
Update Checking:
Currently, my program connects to a URL and checks if a new version is available. If one is, it simply opens up a dialog saying a new version is out and to go download it...
Is there a way to have it automatically open the path to the newest version in the users browser? Or if it's not too confusing, have it auto download the latest update?
Score/Record keeping:
I can make it save high scores during the single gaming session, but once the game exits and the user opens it back up, all the scores start at 0 again... I'm thinking the easiest way to do this is to have the highest score write to a .txt before exiting and on next run, retrieve the highest score from that .txt file again, that way it's never lost.
My concern with this, is someone cheating and just editing the value in the .txt file and bragging that they finished the game in 3 seconds. Is there a better way to do this?
Submitting scores online:
I know how to retrieve text from a URL, but how can you write to a URL if you don't have write permissions? I know a lot of websites have a "Submit" button which obvious takes in what people fill in and saves it. How can I take that same idea to log players high scores to my website?
Any ideas?
Re: Need suggestions: Update Checking, Score keeping, and Submitting scores online.
0
#2 Jun 3rd, 2008
•
•
•
•
Update Checking:
Currently, my program connects to a URL and checks if a new version is available. If one is, it simply opens up a dialog saying a new version is out and to go download it...
Is there a way to have it automatically open the path to the newest version in the users browser? Or if it's not too confusing, have it auto download the latest update?
•
•
•
•
Score/Record keeping:
I can make it save high scores during the single gaming session, but once the game exits and the user opens it back up, all the scores start at 0 again... I'm thinking the easiest way to do this is to have the highest score write to a .txt before exiting and on next run, retrieve the highest score from that .txt file again, that way it's never lost.
My concern with this, is someone cheating and just editing the value in the .txt file and bragging that they finished the game in 3 seconds. Is there a better way to do this?
•
•
•
•
Submitting scores online:
I know how to retrieve text from a URL, but how can you write to a URL if you don't have write permissions? I know a lot of websites have a "Submit" button which obvious takes in what people fill in and saves it. How can I take that same idea to log players high scores to my website?
•
•
Join Date: May 2008
Posts: 122
Reputation:
Solved Threads: 5
Re: Need suggestions: Update Checking, Score keeping, and Submitting scores online.
0
#3 Jun 3rd, 2008
Thanks Ezzaral.. Awesome advice like always 
I was hoping for an easier way to do the updater...
I ended up finding the following source code which opens the default browser and specified URL.... Since I already have it set up to check if a new version is available, I can have it point to the main webpage instead so they can download it manually... works perfect..
Here it is if anyone else is interested:

I was hoping for an easier way to do the updater...
I ended up finding the following source code which opens the default browser and specified URL.... Since I already have it set up to check if a new version is available, I can have it point to the main webpage instead so they can download it manually... works perfect..

Here it is if anyone else is interested:
Java Syntax (Toggle Plain Text)
public void openURL(String url) { String osName = System.getProperty("os.name"); try { if (osName.startsWith("Mac OS")) { Class fileMgr = Class.forName("com.apple.eio.FileManager"); Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class}); openURL.invoke(null, new Object[] {url}); } else if (osName.startsWith("Windows")) Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); else { //assume Unix or Linux String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" }; String browser = null; for (int count = 0; count < browsers.length && browser == null; count++) if (Runtime.getRuntime().exec( new String[] {"which", browsers[count]}).waitFor() == 0) browser = browsers[count]; if (browser == null) throw new Exception("Could not find web browser"); else Runtime.getRuntime().exec(new String[] {browser, url}); } } catch (Exception e) { JOptionPane.showMessageDialog(null, errMsg + ":\n" + e.getLocalizedMessage()); } }
![]() |
Other Threads in the Java Forum
- Previous Thread: When would one ever use the Method class?
- Next Thread: Java Random Access File... Help
| Thread Tools | Search this Thread |
3d @param affinetransform android api applet application arc arguments array arrays automation binary bluetooth byte capture chat class classes click client code color compare component count database design detection eclipse eclipsedevelopment encryption error event exception fractal game givemetehcodez graphics gridlayout gui guitesting helpwithhomework html ide if_statement image input integer j2me java java.xls javaprojects jni jpanel julia keytool keyword linux list loop macintosh map method methods mobile netbeans newbie object os pong print problem producer program programming project projectideas read recursion replaysolutions rim scanner screen server set size sms sort sql string swing terminal threads time transforms tree ui web windows






