[Patch] Multiplayer server list filtering

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

[Patch] Multiplayer server list filtering

Post by adf88 »

This patch allows to filter and categorise items on the multiplayer server list.

DOWNLOAD

Server List Filtering 1.2.0 for OpenTTD 1.2.3
  • Windows binaries. Extract to OpenTTD's root directory e.g. "C:\Program Files\OpenTTD".
    The attachment Multiplayer Server List Filtering 1.2.0 - OpenTTD 1.2.3 win32 binaries.zip is no longer available
  • Diff files. GRF included. Generate projects first if you are on MSVC.
    ServListFilter1.2.0_OTTD1.2.3.zip
    (81.27 KiB) Downloaded 236 times

ATTENTION: make sure you are using the latest GRF file servlistfilter.grf
NOTE: Diff files for all versions of the patch: http://adf88.freehostia.com/openttd/Mul ... Filtering/
NOTE: if you are having problems while merging this patch with other patches because of conflicts then give me a note, I'll help, maybe.
--------------------------------------------------------------------------------------------------------------------------------
Screen (slightly outdated):
Image
--------------------------------------------------------------------------------------------------------------------------------
Features:
1. Filtering servers by various flags:
  • Image - show/hide offline servers.
    Image - show/hide servers with incompatible version.
    Image - show/hide servers with incompatible NewGRF.
    Image - show/hide password-protected servers.
    Image - show/hide servers without any companies.
    Image - show/hide servers with no more companies available.
    Image - show/hide servers without any connected players.
    Image - show/hide servers with no more players available.
2. Filtering servers by map size and landscape.
We can choose a certain landscape and some common map dimensions from dropdown lists in the multiplayer server list window. "(advanced)" label means that we chose more complex filtering from "Advanced filter window". Advanced map size and landscape filtering allows to choose any map dimension range and any set of landscapes.

3. Filtering servers by dates.
This filter is accessible only from "Advanced filter window". "Dates" button in the server list window indicates that date filter is enabled. Clicking on it will open "Advanced filter window". We can specify a yearly ranges for game starting date, game present date and number of years the game is running.

4. Filtering servers by language spoken.
You can choose a flag from a dropdown list next to "Dates" button.

5. Filtering servers by name.
Server name must contain all words entered into filter editbox, but not necessarily as a whole words i.e. "sup ann" filter matches "Joannas Super Server" name.

6. Favourites.
You can add a server to favourites. A "favour star" is shown within favourite server. Also there is a separated list of all favourites.

7. Separation between LAN servers and Internet servers.
There are two separated lists for these two types of servers.

8. New column - favour indicator.
The "number of times played" bar is shown in this column. The longer the bar is the more times we played the game. Also a "favour star" is shown here. When we sort servers within this column they are compared firstly by "is or isn't a favourite", secondly by number of times played.

9. Removal of duplicated games.
Some servers use variable port number to host a game, these games appear sometimes as duplicated entries differing only by the port number. The patch merges duplicates into single items.


10. This patch doesn't modify network protocols (you can play on non-patched servers) or game save compatibility (you can save a game and load it later with non-patched OTTD).
--------------------------------------------------------------------------------------------------------------------------------
Known bugs:
  • none
--------------------------------------------------------------------------------------------------------------------------------
Changelog:

0.2
  • - added 'Map size' and 'Landscape' button
    - tips
    - rearrangement of buttons
    - partial integration with GUIList filtering framework
0.3
  • - window with advanced settings
0.3.1
  • - some bug fixes
0.4.0
  • - textbox to filter servers by name
    - dropbox to choose language spoken on server
    - filter configuration saved in config file
    - icons
1.0.0
  • - server categories
    - favourites
    - duplicates removal
1.0.1
  • - bug fix ("times played" bar)
    - add/remove to favourites button instead of add button
1.0.2
  • - bug fix (servers not added to the list with "Hide offline servers" filter on)
1.1.0
  • - new method to add/remove items to/from favourites - click to a favour star
    - graphics for category buttons, other graphics refinement
    - button to reset filter settings in the Advanced Filter Settings window
    - distinction between "OFFLINE SERVER" and "HOST UNREACHABLE" (shown in the info box on the right)
    - use dark font for offline/unreavhable servers
    - removed most of filtering settings from the configuration file, now only flags are stored
    - new method to detect LAN servers - checking if a network address is in our broadcast domain
    - GUI code update to conform to the new GUI API
    - general code refinement
1.1.1
  • - refined offline servers filtering rules
    - general code refinement
1.1.2
  • - show the number of visits in server details
    - fix servlistfilter.grf palette handling
1.2.0
  • - case-insensitive and diacritic-insensitive filtering
    - removed "duplicates removal" feature
    - general code refinement, split into smaller patches
--------------------------------------------------------------------------------------------------------------------------------
Last edited by adf88 on 23 Dec 2012 19:13, edited 107 times in total.
:] don't worry, be happy and checkout my patches
Timmaexx
Transport Coordinator
Transport Coordinator
Posts: 301
Joined: 03 Jan 2009 17:55

Re: [Patch] Multiplayer server list filtering

Post by Timmaexx »

@adf88: Really Nice Patch!!!
If this is implented in OpenTTD i don't need anything more in OpenTTD Multiplayer!!!
One Thing: Offline Server can't be showed because they are offline ;)
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [Patch] Multiplayer server list filtering

Post by adf88 »

Timmaexx wrote:One Thing: Offline Server can't be showed because they are offline ;)
More precisely - servers that are not responding. In ottd they appears on the list as just an IP addres. "Game info" box says "SERVER OFFLINE" ;)
:] don't worry, be happy and checkout my patches
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: [Patch] Multiplayer server list filtering

Post by Bilbo »

Great idea for a patch. Hope it'll make into trunk soon.

Offline servers can be shown (you see their IP), though no info about them is shown because no info is available for them.

In future I think the idea may be extended by more advanced filters (by climate, by map size>X, map size<X, by specific server settings (I hate servers with "original" train acceleration model)), though that would make perhaps enough code for another patch :)

Also, it will probably need small update of network code to be able to get these settings from server without connecting to it (or it is possible somehow?).
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [Patch] Multiplayer server list filtering

Post by adf88 »

Bilbo wrote:In future I think the idea may be extended by more advanced filters (by climate, by map size>X, map size<X
Comming soon (take a look on my firs post, after attachments).
Bilbo wrote:by specific server settings (I hate servers with "original" train acceleration model)), though that would make perhaps enough code for another patch :)

Also, it will probably need small update of network code to be able to get these settings from server without connecting to it (or it is possible somehow?).
Yes, that would be a great feature. But cant code this myself. Its my firs approach to ottd development. I was just annoyed at hardness in looking for proper server so I wrote these few lines of code (less then 100 :lol: ).

But who knows, maybe in feature... :D
:] don't worry, be happy and checkout my patches
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] Multiplayer server list filtering

Post by Roujin »

Looks great! I'm happy about every new use of the filter framework (guess why :P), and this seems to be a very useful addition. :)

May I suggest to base the patch against current trunk instead of 0.7.0? It may need rewriting the GUI part to match the new widget system (depends on if it has already been done for the server list window); anyway at some point it will be needed.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: [Patch] Multiplayer server list filtering

Post by Rubidium »

Roujin wrote:Looks great! I'm happy about every new use of the filter framework (guess why :P), and this seems to be a very useful addition.
Actually it doesn't use the filter framework.

It furthermore hardcodes strings making it impossible to translate and it makes the window wider than the default resolution.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] Multiplayer server list filtering

Post by Roujin »

Rubidium wrote:
Roujin wrote:Looks great! I'm happy about every new use of the filter framework (guess why :P), and this seems to be a very useful addition.
Actually it doesn't use the filter framework.

It furthermore hardcodes strings making it impossible to translate and it makes the window wider than the default resolution.
Well, shame on me for only looking at the screenshot, not the code :oops:
Then, aside from basing against trunk instead of 0.7.0, please use the existing framework for filtering of GUILists. You can look at the content list (src/network/network_content_gui.cpp) for an example how it's done. It's somewhat similar to sorting. ;)
edit: the changelog for (svn r15372) could be of help

About the hardcoded strings, well I guess he's planning to use icons instead of them in the next version...
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [Patch] Multiplayer server list filtering

Post by adf88 »

Roujin wrote:Looks great! I'm happy about every new use of the filter framework (guess why :P), and this seems to be a very useful addition.
Unfortunately, it doesn't use the filter framework.
In the beginning I planned to use it, even started coding. But after few lines of code I realised that it is useless. The reason was that there is only one filter function (based on various settings) and it's always activated. Secondly, applying filter entails rebuilding the list and vice-versa so it was naturally to put them together.
To make use of filter framework I would have to separate filtering between set of functions. IMO that would be unhandy because in order to apply filtering I would have to switch between these functions and call them one by one (through Filter method).
The problem is that your framework is directed to using one filter at time. It would be useful if you change that, change
SetFilterState(bool state){...}
SetFilterType(uint8 n_type){...}
to
ActivateFilter(uint8 n_type){...}
DeactivateFilter(uint8 n_type){...}
you know what I mean ...
I searched whole solution and didn't found any usage of filter framework so a thought that it is not completed yet :p .
Roujin wrote:May I suggest to base the patch against current trunk instead of 0.7.0? It may need rewriting the GUI part to match the new widget system (depends on if it has already been done for the server list window); anyway at some point it will be needed.
I didn't know it exists :) Its my second day of ottd developing. I'm glad that you are directing me to right path. Currently I'm finishing "map size" and "landscape" dropboxes, but I'l take a look with pleasure on the new widget system. I hope it has more object-oriented drawing and interaction (these OnPanit and OnClick overload ... this should be automated).
Rubidium wrote:It furthermore hardcodes strings making it impossible to translate and it makes the window wider than the default resolution.
This is temporary.
Last edited by adf88 on 16 Apr 2009 11:10, edited 3 times in total.
:] don't worry, be happy and checkout my patches
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [Patch] Multiplayer server list filtering

Post by Zuu »

A slightly more complicated filter usage you can find in the filter sign list patch I have written (see link in my signature). There it has a button for if it should match case or not when it filters the sign list for a string.

The filter sign list patch makes use of the filter interface.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
jonty-comp
Tycoon
Tycoon
Posts: 2542
Joined: 22 Oct 2005 16:05
Location: Chesterfield, England
Contact:

Re: [Patch] Multiplayer server list filtering

Post by jonty-comp »

Excellent! I think a patch like this is really useful. There are generally well over 100 servers nowadays and it's often quite difficult to find the one you're looking for if you don't have a direct-connect IP/host.

I even tried to do this a bit myself, but gave up after deciding OpenTTD was not the best project to learn C++ on. :P
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [Patch] Multiplayer server list filtering

Post by adf88 »

New version released (0.2)
:] don't worry, be happy and checkout my patches
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: [Patch] Multiplayer server list filtering

Post by Eddi »

Timmaexx wrote:If this is implented in OpenTTD i don't need anything more in OpenTTD Multiplayer!!!
by my experience, that kind of statement is never true. as soon as something is included, it will be old news, and people will cry for the next new thing.

PS: it's "implemented", and it's probably the wrong word at this point.
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: [Patch] Multiplayer server list filtering

Post by Bilbo »

I tried your patch and GCC compiler seems to be complaining about errors when compiling:

Code: Select all

[SRC] Compiling network/network_gui.cpp
/home/bilbo/p/openttd/0.7.0/src/network/network_gui.cpp:968: error: ‘_network_game_window_widgets’ was declared ‘extern’ and later ‘static’
/home/bilbo/p/openttd/0.7.0/src/network/network_gui.cpp:175: error: previous declaration of ‘_network_game_window_widgets’
Well, "static" and "extern" does not mix well together.
Either drop the static in the _network_game_window_widgets declaration or move the declaration up to the place where you have the extern now.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [Patch] Multiplayer server list filtering

Post by adf88 »

I moved the declaration. Now it's fine.
:] don't worry, be happy and checkout my patches
Telordya
Engineer
Engineer
Posts: 12
Joined: 04 May 2009 23:28

Re: [Patch] Multiplayer server list filtering

Post by Telordya »

I replaced the openttd.exe with your patched .exe and I receive this popup error message when I execute it:
Attachments
error.PNG
error.PNG (6.62 KiB) Viewed 12566 times
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: [Patch] Multiplayer server list filtering

Post by Eddi »

you need to replace ALL files. not just the .exe, the .lng files, too.
Telordya
Engineer
Engineer
Posts: 12
Joined: 04 May 2009 23:28

Re: [Patch] Multiplayer server list filtering

Post by Telordya »

Ok, but the .zip file only contains openttd.exe, there is not .lng files. Did I miss something?
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: [Patch] Multiplayer server list filtering

Post by Eddi »

then the uploader made a mistake in not adding them, they are essential. at least english.lng must be included, better all of them.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: [Patch] Multiplayer server list filtering

Post by petert »

Tell me if I am wrong on this but...
What's the point of this patch if the compiled version can't join multiplayer servers?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 58 guests