biro
|
 |
«
Posted
2011-05-13 21:18:43 » |
|
Hello, I believe a few of you know the problem that they wrote a game, and after they've finished and released it it's the time for the first big update/patch. Now it would interest me how you do these updates. Do you post a new version on your website? Do you only update your applet (if you have one)? Or do you perhaps have written an updater for your client, that automatically checks for updates?
What interests me the most, is the last one, the updater software, how would you write one if you haven't? Or if you have one how did you write it? Do you use an FTP-Server with the new Fileversions? Or did you write your own Fileserver with its own Protocol?
Many Greetings biro
|
|
|
|
ra4king
|
 |
«
Reply #1 - Posted
2011-05-13 22:01:37 » |
|
What I tend to do (I don't know if this is the best way for now) is have my desktop game periodically check for an update from either a server I have running, or more simply, a hidden text file on my web site. If there is a new update, I can either download it automatically or open the browser to the download page.
|
|
|
|
biro
|
 |
«
Reply #2 - Posted
2011-05-15 20:51:45 » |
|
Hi, thanks for your answer, it looks like you're the only one that thinks about using an Update software for his/her game^^. Now to your answer: I believe the problematic part is the download part. I wouldn't open a broswer page, because for me that looks kind of unproffesional, so my software should be able to download the update too. The problem is, how do you get the file from the server to your client? I have a few ideas about that, one is using an FTP Server with subfolders that are namened after the programmversions, so the client must only look for the right subfolder, and than needs to download everything inside it. If you use an FTP Server I think it's the best approach to use one of the few FTP Libarys for java, which have already implemented the FTP protocoll. More interesting is, at leat I think so, to write your own protocoll and Update-SERVER. I already tried to play a little bit with the filetransfer in java, it doesn't look so hard, you read the files with an InputStream, then you send it to your client through an OutputStream, sounds very easy, but strangely if I send the file to another PC I often have a package loss.... But if I make the filetransfer PC-Intern it works fine...
how would you solve the problem to get the Files from the Server to the client?
Many Greetings biro
|
|
|
|
Games published by our own members! Check 'em out!
|
|
ra4king
|
 |
«
Reply #3 - Posted
2011-05-15 23:39:25 » |
|
You don't really need an FTP server. All you need is that file available at least on a web server and when your game checks for an update, it gets the version number and uses InputStream to read in the file. For example, your game asks the game server for any new updates, it returns 1.1, so you would do: 1 2 3 4 5 6 7 8 9 10 11
| double version = FileInputStream fis = new FileInputStream(new File(new URI("http://www.website.com/repo/version"+version+"/Game.jar")));
FileOutputStream fos = new FileOutputStream("Game.jar");
int i; while((i = fis.read()) != -1) fos.write(i);
fos.close(); fis.close(); |
|
|
|
|
BoBear2681
|
 |
«
Reply #4 - Posted
2011-05-16 02:00:37 » |
|
Also it's probably best to wrap your streams in BufferedInputStreams/BufferedOutputStreams, and read/write more than 1 byte at a time, especially over teh interwebs.
|
|
|
|
ra4king
|
 |
«
Reply #5 - Posted
2011-05-16 02:46:01 » |
|
Yes I just wanted to make it simplistic. You've got the entire java.io package to play with  But BIS and BOS aren't really necessary when you've got similar methods in FIS and FOS that use arrays. 1 2 3 4 5 6 7 8 9 10
| ...
while(fis.available() > 0) { byte b[] = new byte[4096]; int read = fis.read(b); fos.write(b,0,read); }
... |
|
|
|
|
Orangy Tang
|
 |
«
Reply #6 - Posted
2011-05-16 09:03:35 » |
|
Why bother with version files and having different versions uploaded? Just have a single archive at a known url that's always updated to the latest version.
Then use HTTP and eTags to only download it when it changes.
Also, if you are going to store the version seperately, you really don't want to use a double for it.
|
|
|
|
Eli Delventhal
|
 |
«
Reply #7 - Posted
2011-05-16 18:26:27 » |
|
I've toyed around with making a launcher app like Minecraft does, it's pretty easy to implement as long as your launcher doesn't need to change. The reason for doing this rather than http tags is that you can have the launcher force version parity, which is really nice as it cuts down on supporting older versions.
Basically your launcher will automatically contact your site to see if it has the most recent version, and if it doesn't it downloads it. Pretty easy. I would absolutely advise the use of zips or other compressed formats rather than downloading individual files, as it will be much easier on the server and faster to download. However, you then need to either have users redownload every single game asset (if you're updating the same zip), or you need to write code to automatically prioritize later zips you get. Fortunately because you're using Java you can just add the most recent zips at the end of the classpath and it will pull those assets last.
|
|
|
|
Orangy Tang
|
 |
«
Reply #8 - Posted
2011-05-16 20:30:06 » |
|
I've toyed around with making a launcher app like Minecraft does, it's pretty easy to implement as long as your launcher doesn't need to change. The reason for doing this rather than http tags is that you can have the launcher force version parity, which is really nice as it cuts down on supporting older versions. You can write your launcher to do that just fine with http+etags. Why make things more complicated than they need to be?
|
|
|
|
ra4king
|
 |
«
Reply #9 - Posted
2011-05-16 23:12:40 » |
|
Why bother with version files and having different versions uploaded? Just have a single archive at a known url that's always updated to the latest version.
Then use HTTP and eTags to only download it when it changes.
Also, if you are going to store the version seperately, you really don't want to use a double for it.
Yeah, if you don't want a repository of all previous version then 1 copy is all you need. And my bad for using double  New code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Scanner scanner = new Scanner(new File(new URI("http://www.website.com/game/version.txt"))); if(scanner.nextDouble() > this.version) { scanner.close(); FileInputStream fis = new FileInputStream(new File(new URI("http://www.website.com/game/Game.jar"))); FileOutputStream fos = new FileOutputStream("Game.jar"); while(fis.available() > 0) { byte b[] = new byte[4096]; int read = fis.read(b); fos.write(b,0,read); } fos.close(); fis.close(); }
|
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Eli Delventhal
|
 |
«
Reply #10 - Posted
2011-05-19 04:14:05 » |
|
I've toyed around with making a launcher app like Minecraft does, it's pretty easy to implement as long as your launcher doesn't need to change. The reason for doing this rather than http tags is that you can have the launcher force version parity, which is really nice as it cuts down on supporting older versions. You can write your launcher to do that just fine with http+etags. Why make things more complicated than they need to be? That's if you're running it from an applet or off a website, but if you have a downloaded app you can't do that - the user still would need to redownload the update. Unless you have a launcher. For a purely online experience I definitely wouldn't do that.
|
|
|
|
Orangy Tang
|
 |
«
Reply #11 - Posted
2011-05-19 08:43:03 » |
|
I've toyed around with making a launcher app like Minecraft does, it's pretty easy to implement as long as your launcher doesn't need to change. The reason for doing this rather than http tags is that you can have the launcher force version parity, which is really nice as it cuts down on supporting older versions. You can write your launcher to do that just fine with http+etags. Why make things more complicated than they need to be? That's if you're running it from an applet or off a website, but if you have a downloaded app you can't do that - the user still would need to redownload the update. Unless you have a launcher. For a purely online experience I definitely wouldn't do that. I think you're missing my point completely. I suspect you're confusing html tags with http etags because nothing you're saying makes any sense.
|
|
|
|
ra4king
|
 |
«
Reply #12 - Posted
2011-05-19 10:38:37 » |
|
I've toyed around with making a launcher app like Minecraft does, it's pretty easy to implement as long as your launcher doesn't need to change. The reason for doing this rather than http tags is that you can have the launcher force version parity, which is really nice as it cuts down on supporting older versions. You can write your launcher to do that just fine with http+etags. Why make things more complicated than they need to be? That's if you're running it from an applet or off a website, but if you have a downloaded app you can't do that - the user still would need to redownload the update. Unless you have a launcher. For a purely online experience I definitely wouldn't do that. Even a desktop app could download the its own new version, install it, and restart it. All an applet needs to do is refresh the page (and have the parameter "separate_jvm" set to true) to update to the new version.
|
|
|
|
Eli Delventhal
|
 |
«
Reply #13 - Posted
2011-05-19 17:46:31 » |
|
I've toyed around with making a launcher app like Minecraft does, it's pretty easy to implement as long as your launcher doesn't need to change. The reason for doing this rather than http tags is that you can have the launcher force version parity, which is really nice as it cuts down on supporting older versions. You can write your launcher to do that just fine with http+etags. Why make things more complicated than they need to be? That's if you're running it from an applet or off a website, but if you have a downloaded app you can't do that - the user still would need to redownload the update. Unless you have a launcher. For a purely online experience I definitely wouldn't do that. I think you're missing my point completely. I suspect you're confusing html tags with http etags because nothing you're saying makes any sense. Perhaps so, but I don't think so. As I understand it, and eTag is a way more or less of versioning a web resource. Here is what I am thinking: - You download App X. - You run App X. - App X determines it is out of date. - App X downloads App X v2. - App X must restart so that it can run v2.Regardless of eTags, how can you possibly avoid that situation without a launcher app that does this: - You download App X Launcher. - You run App X Launcher. - App X Launcher determines that App X is out of date. - App X Launcher downloads App X v2. - App X Launcher seamlessly launches directly into App X v2. Am I missing something? The problem seems clear to me.
|
|
|
|
endolf
|
 |
«
Reply #14 - Posted
2011-05-19 18:12:18 » |
|
There is always webstart, which has an updater built in.
Endolf
|
|
|
|
ra4king
|
 |
«
Reply #15 - Posted
2011-05-19 21:50:15 » |
|
@endolf Yes but webstart is very glitchy and unreliable.
@Eli What's the difference between "restart" and "seamlessly"? In both situations you still need to close the current instance and run the new version. The best way is to do "Runtime.exec("java -jar MyGame.jar")" then "System.exit(0)".
|
|
|
|
kappa
|
 |
«
Reply #16 - Posted
2011-05-19 21:56:16 » |
|
You could try GetDown, its suppose to be a better webstart.
|
|
|
|
ra4king
|
 |
«
Reply #17 - Posted
2011-05-19 22:52:20 » |
|
LWJGL has its own Webstart that I have heard is better than GetDown 
|
|
|
|
Eli Delventhal
|
 |
«
Reply #18 - Posted
2011-05-19 23:17:03 » |
|
@endolf Yes but webstart is very glitchy and unreliable.
@Eli What's the difference between "restart" and "seamlessly"? In both situations you still need to close the current instance and run the new version. The best way is to do "Runtime.exec("java -jar MyGame.jar")" then "System.exit(0)".
Yes, on PC you run two instances of the same app, but on Mac OS X that call would do nothing unless you rename v2 of the app, which IMO is a bad user experience. By seamlessly I mean you don't actually see anything quit, because the launcher basically just calls a method within the new JAR you downloaded. Just think Minecraft, which is whose behavior I emulated when I made a launcher, anyway...
|
|
|
|
ra4king
|
 |
«
Reply #19 - Posted
2011-05-20 00:50:41 » |
|
Ah, I didn't know about the Mac OS X thing. Another reason why Mac sucks 
|
|
|
|
jezek2
|
 |
«
Reply #20 - Posted
2011-05-20 01:50:27 » |
|
I just released my launcher (updater) that I use in my game, details here.
|
|
|
|
ra4king
|
 |
«
Reply #21 - Posted
2011-05-20 02:10:41 » |
|
Woot woot 
|
|
|
|
endolf
|
 |
«
Reply #22 - Posted
2011-05-20 06:16:21 » |
|
I've had no problems with webstart as long as you don't allow offline mode, which for an online game is fine  . Sometimes web caches get in the way, but you'll get that whatever technique you use if you do it over http/ftp. Some proxies also ignore the cache TTL headers, which is annoying. Endolf
|
|
|
|
|