Author Topic: MG Launcher/Lobby  (Read 2321 times)

kagu

  • Administrator
  • Horseman
  • ********
  • Posts: 203
    • View Profile
MG Launcher/Lobby
« on: 22 August 2014, 17:17:59 »
I'm thinking of making a MG Launcher/Lobby inspired from SpringRTS Lobby http://springlobby.info/landing/index.php

I'm developing it with pyQt4 , if you have any suggestions please let me know , I plan to start coding tomorrow.

The github repo:
https://github.com/alketii/MG-Launcher/

Whats done
- Asking for MG directory
- Tries to find MG data dir , if not , it will ask
- If name newbie or null , input dialog
- Showing games
- Joining games
- Auto join games
- Notifications (currently linux only)

For update I think I will use a INI file hosted somewhere which will be like
Code: [Select]
[Megaglest]
version=3.9.1
download=http://megaglest.org/download.zip
[TowerDefense]
version=16
download=http://github.com/download.zip

Which will be compared to the local one

For games I plan to get the CSV file format from play.mg (which for the moment I can't find)

Some features that can't bee seen on screenshots
- If player name is "newbie" , the Input Dialog will prompt.
- It will try to find the Megaglest launcher , if it can't find , the File Dialog will promot



« Last Edit: 26 August 2014, 18:30:27 by alket »
Megaglest Chat
Please support:
1. CEGUI 2. In-process games 3. Registered Players
Playtime:
Every Sunday 21:00 - 01:00 CET

FreshDumbledore

  • Guard
  • ***
  • Posts: 61
    • View Profile
Re: MG Launcher/Lobby
« Reply #1 on: 22 August 2014, 17:21:08 »
great work! not sure if the TowerDefense update stuff is necessary or maybe make a list of mods one can keep track of in an .ini file or something :)

FreshDumbledore

  • Guard
  • ***
  • Posts: 61
    • View Profile
Re: MG Launcher/Lobby
« Reply #2 on: 22 August 2014, 17:27:35 »
plz make the chat scroll down to the last entry automatically :D

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: MG Launcher/Lobby
« Reply #3 on: 22 August 2014, 22:43:43 »
hey great idea!! If not to difficult could you make it editable for standalone games like annex?
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: MG Launcher/Lobby
« Reply #4 on: 23 August 2014, 01:57:27 »
For games I plan to get the CSV file format from play.mg (which for the moment I can't find)
I wasn't aware that there was one. The desktop notifications feature that I wrote for play.mg uses JSON.  Use this URL: http://play.mg/showServersJson.php.  For parsing JSON with Python, see here.

You might also want to consider taking a look at the desktop notifications script. It automatically recreates the table you see on play.mg and creates desktop notifications (so includes a means of detecting new games). You could use similar functionality in your launcher.

To check for the current version of MegaGlest, consider using GitHub's API. Here's how to get release data. Here's the exact URL you'd have to use to access release data: https://api.github.com/repos/MegaGlest/megaglest-source/releases. Note that it's in ascending chronological order. While it technically does include the binaries that get bundled with each release, not every release has every binary, so users would probably need to manually install. Also, it looks like Softcoder released 3.9.2 on Github, but that's not the version on the forum or MegaGlest site (and the release has no binaries).

If you have questions about the masterserver API, let me know and I may be able to help.

EDIT: Obviously the mentioned limitation of using Github's API would prevent the launcher from installing updates automatically. Unfortunately, the INI file that you posted would have major limitations of its own, namely the inability to maintain platform independence (speaking of which, platform independence is why I love using languages like Java or Python over C++). You could work around this, but there's no trivial solution. Possibilities include:

  • You could convince the MG devs to make their releases consistent. Have every release (on Github) have bundled executables that have a specific naming format. It looks like they already partially do this, but not entirely. You could try this and if there's no bundled executable, then tell the user they have to manually download and give them a link to the release (although this will fail hard for things like this 3.9.2 issue, where the release doesn't seem to be official).
  • You could store these binaries on your own server. Gives you full control, but you'd have to have storage and bandwidth. You'd also have to do extra work on every release (whereas with #1, all the work is stuff that normally is done on every release, anyway).
  • The solution that always works: interact with git and download the source code for that release and compile it locally. You'll never have to worry about the release not having bundled executables, since you make your own executables. The downside is that compiling MG can be a pain in the ass, sometimes. You'd need a way to get the dependencies (the Windows dependencies are huge). Windows and Linux currently have different methods of compiling. The first time downloading everything would be very slow, but after that, updates would be very fast. Much, much faster than downloading everything. Some programs take this approach to downloading stuff. Off the top of my head, OS X's Homebrew does this, downloading sources and building them locally instead of downloading prebuilt binaries.

Each of these has pros and cons. #1 is the easiest to implement, but requires depending on the MG team to change their process and stick to it. If they screw up, your program also gets screwed up. #2 is expensive, as you need your own server. #3 is probably the safest approach, but by far the most difficult (not to mention the very slow initial downloading of dependencies and the git repo).
« Last Edit: 23 August 2014, 02:14:04 by Omega »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: MG Launcher/Lobby
« Reply #5 on: 23 August 2014, 08:13:06 »
CSV output

The CSV output, which is also used by the game, is found here:
http://master.megaglest.org/showServersForGlest.php

Source code:
https://github.com/MegaGlest/megaglest-masterserver/blob/master/showServersForGlest.php

Please don't hammer the master server, that is automated reloads should always take place in intervals of 10 or more seconds. (Failing to comply with this may result in temporary or permanent bans.)

Version detection

The game currently displays warnings in the chat area when you run an outdated game version.
This is based on a simplistic flat file version checking mechanism: The game accesses URL which consists of three components:

VersionURL as defined in glest(user).ini + current game version (with "v" prefix) + ".txt"

Example URLs:
http://master.megaglest.org/files/versions/v3.9.0.txt
http://master.megaglest.org/files/versions/v3.9.1.txt
http://master.megaglest.org/files/versions/v3.8.0-beta1.txt

As you will notice, the URL for the current game version v3.9.1.txt returns an empty file (blank page, no error message). That's just because at some point we decided against displaying a message when you run the latest version, but to display one when you do not. All of these existing game versions will return a HTTP 200 status code, non-existing versions will return a different HTTP status code (usually a 404 status).

On the server side this is (currently) implemented with simple text files and symbolic links. The directory contents are as follows:
Code: [Select]
_LATEST_DEV_SNAPSHOT 
_LATEST_PRERELEASE 
_LATEST_RELEASE 
_LATEST_RELEASE_OFF 
_LATEST_RELEASE_PRERELEASE_AVAILABLE 
_OUTDATED 
_OUTDATED_BUT_COMPATIBLE 
v3.3.7.1.txt -> _OUTDATED
v3.3.7.2.txt -> _OUTDATED
v3.4.0-beta1.txt -> _OUTDATED
v3.4.0-beta2.txt -> _OUTDATED
v3.4.0-beta3.txt -> _OUTDATED
v3.4.0-dev.txt -> _OUTDATED
v3.4.0.txt -> _OUTDATED
v3.4.1-dev.txt -> _OUTDATED
v3.5.0-beta1.txt -> _OUTDATED
v3.5.0-beta2.txt -> _OUTDATED
v3.5.0-dev.txt -> _OUTDATED
v3.5.0.txt -> _OUTDATED
v3.5.1-dev.txt -> _OUTDATED
v3.5.1.txt -> _OUTDATED
v3.5.2-dev.txt -> _OUTDATED
v3.5.2.txt -> _OUTDATED
v3.5.3-beta1.txt -> _OUTDATED
v3.5.3-beta2.txt -> _OUTDATED
v3.5.3-dev.txt -> _OUTDATED
v3.6.0.1.txt -> _OUTDATED
v3.6.0.2.txt -> _OUTDATED
v3.6.0.3.txt -> _OUTDATED
v3.6.0.txt -> _OUTDATED
v3.6.1-dev.txt -> _OUTDATED
v3.7.0-beta1.txt -> _OUTDATED
v3.7.0-beta2.txt -> _OUTDATED
v3.7.0.txt -> _OUTDATED
v3.7.1-dev.txt -> _OUTDATED
v3.7.1.txt -> _OUTDATED
v3.8.0-beta1.txt -> _OUTDATED
v3.8.0-dev.txt -> _OUTDATED
v3.9.0.txt -> _OUTDATED_BUT_COMPATIBLE
v3.9.1.txt -> _LATEST_RELEASE

The former file system objects (starting with an underscore) are actual text files containing the text that is returned. The remaining file system objects (containing version numbers) are symbolic links pointing to these text files. This system is a bit ugly due to its simplicity, but it should scale better than server side scripts. A better approach would be client side logic interpreting the static information provided by the server, though, but this has not been implemented by anyone so far (and then the current system isn't that bad).

General announcement

Also in the chat area, the game will report an announcement if there's one configured.

This is retrieved from AnnouncementURL as configured in glest(user).ini. Currently this points to http://master.megaglest.org/files/announcement.txt for MegaGlest (other MG based games may point it elsewhere). We have used this to point out upcoming planned multi-player games, tournaments, new releases and general MG related news and hints in the past.
« Last Edit: 23 August 2014, 09:04:07 by tomreyn »
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

kagu

  • Administrator
  • Horseman
  • ********
  • Posts: 203
    • View Profile
Re: MG Launcher/Lobby
« Reply #6 on: 23 August 2014, 16:12:48 »
FreshDumbeldore

I think also Techtrees , Maps etc, should be updated too.
Thanks for chat suggestion.

Ishmaru
Yes , I make it as much as possible , but since its free software and made with python , its easy to change strings etc.
Thanks

Omega & tomreyn
Thanks for suggestions, I think I will go with CSV (which tomreyn posted) since it outputs smaller data and its easy to split with one delimeter.

For updates , I think my first idea will be better because I will have only to host a single file , and that file will tell where to download, I plan to host techtrees etc in github and only unzip them after download. Obviously INI needs more data , I plan to do it like this

On server
Code: [Select]
[MegaGlest]
type=game
win_ver = 3.9.1
lin_ver = 3.9.1
mac_ver = 3.9.1
win_url = http://megaglest.org/download_w.zip
lin_url = http://megaglest.org/download_l.zip
mac_url = http://megaglest.org/download_m.zip

[TowerDefense]
type=techtree
ver=16
url=https://github.com/MG_launcher/bin/tower_defense.zip


On client side , it will be the same , only if some version is lower than on serveside , the update will promot.

P.S.
By all means I'm not skilled in Python, I'm only using some things that I learned over years , and I only did just one app before, so help will be much welcomed.

The github repo
https://github.com/alketii/MG-Launcher/

Megaglest Chat
Please support:
1. CEGUI 2. In-process games 3. Registered Players
Playtime:
Every Sunday 21:00 - 01:00 CET