Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (562)
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  
  How to update the files of my game  (Read 2727 times)
0 Members and 1 Guest are viewing this topic.
Offline error777

Senior Newbie





« Posted 2009-09-08 11:32:03 »

Hello folks,

i have a question about How could I update the files of my game or any other software if the version changes?
That is to general that is why i'm going to explain what i have thaught of:

My Software/Game downloads a file called versionNew.txt If the content of the VersionNew.txt is not the same as the content of VersionOld.txt then:

1. the content of VersionOld.txt should be the same as the content of VersionNew.txt
2. VersionNew.txt should be deleted.
3. The UpdatePrograme should download a Folder e.g. "NewFiles"
4. Old Files&Folders should be deleted
5. New Files&Folders should be copied into the root directory of the software.

Now I have 2 Problems.

1. How should I do this?
2. Is there another way to do it easier?

P.S.: It is for Updating Events or changes for my RPG that I am currently working on.

Realy need your help.
Thanks,
error777
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #1 - Posted 2009-09-08 15:10:13 »

yes, infact there is an easier way Wink.

webstart/applet is the answer.

if you dont like them having to run formt eh saite. then just give them the jnlp file.
Offline elias4444

Junior Member





« Reply #2 - Posted 2009-09-09 14:53:10 »

I did this very thing with Martians Vs. Robots. But rather than deleting, moving, copying, whatever, I just have the app download over the current stuff and then dynamically load the jars.

I should warn you however, Windows Vista won't let you do this unless your application is installed somewhere under the current user's home directory. If you try to do it somewhere else, it'll act like it's working, but then fail miserably (Vista automatically redirects the downloads to some obscure user directory). Webstart still ends up being the best bet for autoupdates because of this... too bad it's so ugly.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cylab

JGO Ninja


Medals: 49



« Reply #3 - Posted 2009-09-09 15:55:27 »

I should warn you however, Windows Vista won't let you do this unless your application is installed somewhere under the current user's home directory. If you try to do it somewhere else, it'll act like it's working, but then fail miserably (Vista automatically redirects the downloads to some obscure user directory). Webstart still ends up being the best bet for autoupdates because of this... too bad it's so ugly.

Don't download the updated jars to the application directory, but to a dedicated "updates" directory somewhere under FileSystemView.getFileSystemView().getDefaultDirectory() like
1  
File updateLocation = new File(FileSystemView.getFileSystemView().getDefaultDirectory(), "My Fancy Game Title/updates")


In the launcher, set up two URLClassloaders, one with the updated jars (updatesClassloader) from this location and one with the original application jars (appClassloader). Important: set the updatesClassloader as parent of the appClassloader to make sure, your updated classes are loaded first. Then you can load your games main class from the appClassloader, and call the main-method via reflection.

Mathias - I Know What [you] Did Last Summer!
Offline error777

Senior Newbie





« Reply #4 - Posted 2009-09-10 19:45:28 »

ok so it seams that i will use the jnlp thing.
But i got some problems:

1. How does a jnpl work? I've seen it in games but still i don't know how to use it.
2. Can you unpack a jnpl file?
3. Are there only class files

Or let me put the question simpler: Where can I find a good explanation to how i create this jnpl file and how i use it and a description will also be very useful.

Thank you,
error777
Offline cylab

JGO Ninja


Medals: 49



« Reply #5 - Posted 2009-09-10 21:43:48 »

http://java.sun.com/developer/technicalArticles/Programming/jnlp/

Also Netbeans can generate webstartable apps out of the box.

Mathias - I Know What [you] Did Last Summer!
Offline ishailin

Junior Newbie





« Reply #6 - Posted 2010-03-16 15:22:59 »

java can not supply this function,but if you are base on c++ as mtk or symbian you can do this
three years ago i have the idea as you ...
Offline ImNotBacon

Junior Member




Don't eat me


« Reply #7 - Posted 2010-03-16 19:00:02 »

Webstart isn't a viable deployment strategy. When I tried it over facebook, only 40% of users were able to launch my game.

If your game is deployed as a downloaded application, build a stable updater that does what you describe. Then use classloaders to launch your app.

The advice given about Vista is spot on.  I just have the patcher sit in the applications folder, and download the entire game to a folder in their documents tree and run it from there.

Applets aren't bad, but they have an annoying habit of caching old files.  I've yet to find a setting that will reliably force browsers to update it.
Offline noblemaster

JGO Ninja


Medals: 20
Projects: 10


Age of Conquest makes your day!


« Reply #8 - Posted 2010-03-17 00:39:33 »

Webstart isn't a viable deployment strategy. When I tried it over facebook, only 40% of users were able to launch my game.
If you offer a download, only 10% might be willing to download the game. That would be less than 40%... I think I would be too lazy to download a facebook game. Other games yet, but facebook?

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #9 - Posted 2010-03-23 07:02:03 »

1  
File updateLocation = new File(FileSystemView.getFileSystemView().getDefaultDirectory(), "My Fancy Game Title/updates")


I was calling .getDefaultDirectory() in an unsigned applet, as parameters to a java.awt.FileDialog, and it started throwing SecurityExceptions in Windows 7 Undecided

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
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.

radar3301 (9 views)
2014-09-21 23:33:17

BurntPizza (28 views)
2014-09-21 02:42:18

BurntPizza (18 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (27 views)
2014-09-20 20:14:06

BurntPizza (29 views)
2014-09-19 03:14:18

Dwinin (46 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!