Page 1 of 1

Custom Autoupdater/Launcher

Posted: Sun Apr 25, 2010 5:13 pm
by Zaibacu
It's a launcher/auto updater written in Java, works fine on MAC/Linux/and all Microsoft Windows versions. Fully customize-able (by editing settings.xml and gui.xml), button clicks triggers scripts (written in Jython), which can be customized too (if you know this scripting language...).
I've used multithreading technique, so graphic interface, actions, and each script are on separate threads. Because of that, there should be no lags, and launcher should not crash(unless there're some problems in configuration)

Standart looks(yes i know, i'm not very good designer :D):
Image
Background image, font color, button color, button coordinates, window size, center html frame can be anything you want (note: HTML frame is kinda basic. It don't know any CSS and javascript)

For updater to work, you need to create separate folder in your web hosting and create new index.php, then add this php code:
*See 'update.php' file from 'php examples' download*
Last two lines are folders in which newest files are added. It may be not just system directory, I added it for an example.
This page will print files with their sizes, launcher will scan through them, then check your game files and determine which files should be downloaded. Then if you agree, it will download them. :)

Build-in functions:(for scripting)
z.getIP() - returns IP

z.getDir() - returns game dir

z.web(url) - opens webpage in default browser

z.launch(dir) - launches application

z.download(url,destination) - downloads and saves file

z.check() - checks for updates

z.sendPacket(packetString, IP, Port, Timeout) - sends a custom packet to server. packetString, IP goes in string format, Port and Timeout in integer format

Updates:
v1.1
  • Custom packet sending function added. What for? For example you can make launcher start somekind of protection in background(to kill all hack processes, auto ban or something more), and force players to use it. If protection is off - player gets kicked from server. Well it needs some further modifications at server core and little bit advanced script, but atleast I've made it possible for now :)
  • All script files were moved from Data folder to web page. This way server admins have full control of scripts
Scripts php file example:
*See 'scripts.php' file from 'php examples' download*
Basicly you only need to 'echo' each line of script, don't forget to use '<br>' at end of lines. Scripting language remains the same (Jython)

Known bugs:
  • If base game directory has spaces, it may throw error "directory not found bla bla bla". I've did some fixes in script, but not sure if they helped
  • Downloading huge files may crash program (the biggest file i've tryed was 300mb, and it worked fine, but not sure about 1gb+)
Download: Version 1.1 beta
Download: Version 1.0 beta

Download: Example php files

Re: Custom Autoupdater/Launcher

Posted: Thu Apr 29, 2010 4:06 am
by KadeL
Thanks for sharing, nice work :wink:

Re: Custom Autoupdater/Launcher

Posted: Sat May 01, 2010 8:09 am
by Zaibacu
Thanks man :)
Had some free time today, so here's update:
v1.1
  • Custom packet sending function added. What for? For example you can make launcher start somekind of protection in background(to kill all hack processes, auto ban or something more), and force players to use it. If protection is off - player gets kicked from server. Well it needs some further modifications at server core and little bit advanced script, but atleast I've made it possible for now :)
  • All script files were moved from Data folder to web page. This way server admins have full control of scripts

Re: Custom Autoupdater/Launcher

Posted: Sun May 02, 2010 6:59 am
by pokiokio
It may sound noobish but, how do I launch it? :oops:

How are the players gonna run it?

Re: Custom Autoupdater/Launcher

Posted: Sun May 02, 2010 7:37 am
by Zaibacu
Well normally it should run on double click the Jar file(or need to set 'open with' with java), or there is bath command 'java -jar file_name.jar'

P.S. And don't forget to delete "dircache.txt" file before you compress the launcher. It simply stores a game directory. If launcher can't find that file, it lets you to set a new one. That way each player can set their game directory

Re: Custom Autoupdater/Launcher

Posted: Sun Feb 13, 2011 6:26 am
by Warmaster
i no like the design sorry :?

Re: Custom Autoupdater/Launcher

Posted: Sun Feb 13, 2011 1:49 pm
by Edelvez
First see the date before posting.. do not revive old post