Friday, May 24, 2019

Additions to 3.0: New scoreboard, better duplicate reporting, custom roles

There's a bit of a bigger addition to Meowth 3.0 that I felt required a longer blog post. Since the beta launched there have been innumerable bug fixes and some smaller additions, but in the last few days I've added enough new things that I wanted to dig into them in a bit more detail for you guys.

Small stuff first: Meowth 3.0 now has custom roles! You can use addcustomroles to designate a list of pre-existing server roles as self-assignable. Then users can assign themselves to the role with the iam command, or remove that role from themselves with iamnot. If you need to remove the self-assign ability from a role, use removecustomroles.

Meowth 3.0 now has the duplicate command! This has been reworked significantly from how it worked in 2.0. Now when you use the duplicate command in a raid channel, Meowth grabs a list of raids that have the same level or boss, and asks you which raid the channel is a duplicate of. When you make your selection, Meowth automatically copies the RSVPs and raid groups from the duplicate to the original raid. Anyone can use this command, and there's no requirement that three people report the duplicate before Meowth takes action.

Here's the big change: the scoreboard cog! Meowth now keeps score for using reporting commands in your server. The scores are divided into five (for now) categories: raid, wild, trade, research, and service. Some changes have been made to the way this works from how it did in 2.0. Notably, you now receive more points based on the popularity of the reports you make. Here are the details:

  • Raid: 1 point for the raid report + 1 point for each user who completes the raid (i.e. is in a group that uses the starting command)
  • Wild: 1 point for the wild report + 1 point for each user who reports a catch (by reacting to the report with the Pokeball emoji)
  • Research (under construction) : 1 point for the report + 1 point for each user who reports obtaining the task
  • Trades: 1 point for each trade agreed to by both parties
There are several commands for managing and viewing the data from the scoreboard. The leaderboard command displays the top ten server members in whichever category you ask. The scorecard command displays all five scores for the member you ask for (or your own scores, if you omit this argument). For server admins, the reset_board command can set scores to 0 in any or all of the categories and for any or all of the users in the server. For more fine-tuned control of scores, server admins can use the adjust command to add or subtract points from a user's total in any category. (Note that at this time, no log of these adjustments is kept.)

You may have noticed I left out a category. The service category is meant for miscellaneous point awards from server admins. You can use this category however you like, but here are some ideas on how you might want to use it. I know many Pokemon Go communities take part in community service projects in their areas. You could award service points to members who contribute to these projects however you see fit. For example, you could do a canned food drive and award one point for every can a member donates. You could also use this category to reward service to your Pokemon Go community. Maybe you want to give points for checking in users at Community Day events, or for organizing meetups, or for dropping lures, or for recruiting or helping new members. I hope everyone finds their own unique ways to make use of this feature to promote greater engagement within your communities and with the larger communities you belong to.

These features are all live in the Meowth 3.0 beta as of now! Let me know in the Discord server if you find any bugs or have any feedback. The full release of 3.0 is coming soon! I'm hoping to be able to get the research cog done within the next week, and then 3.0 will have feature parity (more or less) with Meowth 2.0, and the transition will begin!

EDIT: Forgot to mention, due to the spamish nature of the leaderboard and scorecard commands, those are usable only in the 'users' reporting channels, i.e. the same channels you can use want and such.

Also also, setstatus is also now in 3.0 and works (I think) the same way it did in 2.0.

Friday, April 26, 2019

Announcing the Meowth 3.0 Open Beta

Greetings users of Meowth! Today is an exciting and somewhat terrifying day. It is time at last for an open beta of Meowth 3.0! I've been working hard to put the finishing touches on Meowth 3.0 and the end is definitely in sight! For now, I'm allowing everyone who wants to try the new version to invite the beta bot to their server. Before then, I'm hoping everyone will read this post as I try to summarize the key changes to keep in mind as you transition from 2.0 to the 3.0 beta.

Key Points

  • !research is the only major cog that is not yet ready, and the timetable for its completion is hopefully less than a week.
  • Most of the old commands work exactly as they did in 2.0.
  • Major commands that no longer exist: !invite
  • Commands that have been renamed and/or reworked: the !set commands, !starttime, !configure
  • Quick migration can be done with the !importconfig command
  • New configuration options are available
  • There will be bugs

Details

Gonna just go point by point and elaborate a bit here.

!invite has been removed, and EX Raid channels will be open to users just like regular raid channels. My observations lately have made me think that the invite command caused more confusion than value. I might put it back as an option later on.

A lot of the user-facing !set commands are still around under different names. !set pokebattler is now just !pokebattler, same with !set silph becoming simply !silph.

!starttime's functionality has been rolled into !group, which now allows the creation of multiple groups for a raid.

!configure is now a pair of commands !enable/!disable, and these work quite a bit differently and (I believe) are easier to understand. I'm attempting to hit a sweet spot of simplicity and customization here. The main change here is that !enable/!disable typically only changes settings in the current channel. This allows different reporting channels to have different settings as far as what commands are enabled, what area the channel covers, how raids reported in them are categorized.

The features that can be enabled/disabled are grouped into these areas: raid, wild, trade, research (still in development), meetup, and users. Most of these are self-explanatory. The "users" area is a catch-all for miscellaneous user self-management commands like !want, !team, !pokebattler, !silph, etc. The "spammy" commands if you like.

If you're happy with how Meowth 2.0 works or at least you want to just get it working on your server quickly, you can use the !importconfig command which will attempt to copy most of the applicable settings from 2.0. Note that this only transfers the settings and things like active raids will not transfer. With that, let's talk about the transition as a whole.

Migrating to 3.0b

Here's the quickest way to switch to the 3.0 open beta and get it configured in mostly the same way you had 2.0 configured. IT IS HIGHLY RECOMMENDED THAT YOU WAIT UNTIL RAIDS ARE DONE FOR THE DAY.

  1. Invite Meowth 3.0 with this link
  2. Keep the beta bot out of your current reporting channels for a bit.
  3. Use the !importconfig command in a channel the beta bot can see. If successful, it will give you a list of "location channels" that need further configuration. These are mainly your raid, wild, exraid reporting channels.
  4. One at a time, let the beta bot into each reporting channel, and use !setlocation in those channels. The arguments are <city> <lat> <lon> <radius>. Make sure to wrap the "city" argument in quotes if it is multiple words.
  5. Restrict Meowth 2.0's permissions in each channel after running !setlocation.
  6. Test each reporting command in each channel just to check that the permissions are all correct and to familiarize yourself with the new or altered features.
  7. At the end of this process, you should have kicked Meowth 2.0 out of all channels except the ones you need for research reporting. Because this cog is not enabled in 3.0, you should be able to use !research in channels where both Meowths are, but make sure you disable other commands for Meowth 2.0 so as not to get duplicate raid channels.
  8. At this point you can play around with the new options for configuration. You can change how raids are categorized, you can !enable train or clean if you like. !train was discussed in a previous post here, and if you do !enable clean in a reporting channel, the beta bot will erase all messages sent by other users, leaving only Meowth's responses to commands for a "clean" channel.
  9. PLEASE KEEP IN MIND THIS IS STILL A BETA. I have done some pretty extensive testing of most of this stuff, but I'm positive I missed things. If you are uncomfortable using the beta as your main bot while the kinks are ironed out, I would suggest putting it off for another week or so. But if you're brave and adventurous or just impatient, go ahead and jump in. You can switch back to 2.0 at any time and any configuring you do for 3.0 will carry over to the full release.
  10. BIG IMPORTANT THING WHY IS IT AT THE BOTTOM I DON'T KNOW. The !want command works differently now. When you !want a Pokemon, it will a) subscribe you to notifications for any Pokemon in that family and b) it will put you on a list Meowth keeps internally. Meowth will create a role for that want ONLY WHEN TEN USERS IN THE SAME SERVER WANT THAT WANT. Related to this, MEOWTH 3.0 DOES NOT KNOW ABOUT THE ROLES CREATED BY MEOWTH 2.0. So your users will have to redo all their wants. This change is an attempt to keep the number of roles Meowth creates to a more manageable level.
OK, I'm tired and nervous so let's just flip the switch and see what happens. I HIGHLY RECOMMEND NOT SWITCHING YOUR SERVER'S OPERATIONS TO THE BETA UNTIL TONIGHT OR TOMORROW FOR A FEW REASONS. FOR ONE THING IT WILL CAUSE A LOT OF CONFUSION IN THE MIDDLE OF THE DAY AND FOR ANOTHER I AM SEEING AVENGERS IN ABOUT FIVE HOURS AND I'LL BE DAMNED IF I'M GOING TO CHECK DISCORD DURING THE MOVIE. Ok, but seriously I'm tired, guys. I'll sleep so much better when this thing is done I tell you what. REMEMBER THAT 3.0 CAN'T DO RESEARCH YET. DON'T AT ME ABOUT IT PLEASE. THANK YOU ALL FOR YOUR PATIENCE I CAN'T BELIEVE WE'RE THIS CLOSE.

OH one more thing, Meowth can use your existing team roles but you need to do !teamrole <team name> <role name> for each of the three teams to make it work.

Friday, March 29, 2019

Feature Spotlight: Raid Trains

Well, boys and girls, it's time to unveil a super-secret brand-new feature for Meowth 3.0! I'm really excited about this one but hoo boy did it take some doing. I'm pretty tired and it's about time to leave my day job for the weekend so I'm gonna try to get through this one really quickly.

Raid Trains

When I first thought about making Meowth almost two years ago, when raids had been in the game for mere weeks, I noticed that a lot of players tended to jump from raid to raid in sequence, picking up new players here and there as they went. I've heard a few different names for this phenomenon but the one that always stuck with me was "raid train." My first thought when writing Meowth was to have a channel for each of these groups as they went from place to place. But at the time I couldn't figure out how to make that work because I barely knew how to do anything back then. I was and still am really happy with what I ended up with in having a temporary channel for each reported raid. But it nagged at me that it forced users to hop from channel to channel. The massive reorganization that I did for 3.0 allowed the "raid train" channel idea to come back, and I think this has the potential to streamline raid coordination in a really significant way. So let's dive in and talk about how a raid train works in Meowth 3.0.

Let's say you are wanting to do a few raids in a row and have plenty reported raids to choose from. When you type !train, Meowth will show you a list of all the raids that have been reported, and ask you to use a reaction to choose your starting raid. Meowth will create a channel for the raid train and allow people to join your train officially via reactions or a !join command in the train channel. While a raid is selected, the train channel behaves exactly like a temporary raid channel for the current raid, with some additions. First, Meowth will send the list of reported raids for users to vote on while the current raid is in progress. Second, newly reported raids get their own message sent to the train channel, and users can vote to go to new raids next from those as well. When you are finished with the current raid (whether you actually do the raid or decide to go to a different one instead) you can type !next and Meowth will determine which raid is next by counting the reaction votes for each raid. Whichever raid has the most votes will be next, and Meowth will clean up its messages relating to the old raid and set up the train channel for the next one.

One thing to note here is that every Discord user still handles their own RSVPs for each raid during the train. Also, if there are any other channels dedicated to the same raid (whether a raid channel or a train channel) all RSVPs will be sent to all the channels so that everyone knows who's coming to the raid. So joining the train does not free you from updating your status. I imagine the typical use case will be one Discord user per car updating RSVPs for whoever is in that car, but you could also designate one person to handle RSVPs for everyone by including the whole train in that user's total.

The last thing I'll mention is that every time a user leaves a train either by sending !leave to the train channel or by using the reaction in the report channel, Meowth checks to see if there is anyone left in the train. If there is no one left in the train, Meowth will automatically end the train and delete the channel. I will probably add some sort of check for inactivity soon just in case people forget to leave their trains.

There is also some really cool quality of life features in this that I'm really happy about. If your server utilizes the gym database, Meowth will include the travel times between gyms that it knows about when asking you to select the next raid. This only works if the current raid is at a known gym. So this should help you figure out which raid you want to do based on which gym is closest and when the raids are expiring (all of which is information Meowth helpfully includes when asking you to vote on the next raid).

There's still quite a bit of refining that needs to be done on this one, but it's Friday and I managed to get it functional so I wanted to let you guys know about it! Go test it out on our support server!

Monday, March 4, 2019

Feature Spotlight: Trading

It's time for another somewhat-polished feature of Meowth 3.0 to be given the spotlight, and this time it's all about the revamped trade feature. This one was quite easy for the most part for a number of reasons. It was the last major thing I wrote for Meowth 2.0, and so it needed quite a bit less work to fit it into 3.0, as it's really the only 2.0 feature sort of written in the 3.0 style so to speak. Even in 2.0 it was its own module, it had a data class with methods... you know, the way people who actually know how to write Python do! So a straight port to 3.0 would have been very easy. But I didn't want to do just a straight port, so I added a few bells and whistles based on the feedback I've gotten for trading in 2.0.

What's Old

This is all going to feel very familiar if you've used the trade command at all in 2.0. The premise is basically the same. You use the trade command, and tell Meowth what Pokemon you are offering to trade. Meowth asks you what you will accept in exchange. You give it a list. Meowth creates a pretty message summarizing. Other people use reactions to make you an offer. You get a DM for each offer, and you can either accept or reject. If you accept an offer, the reactions on the original message are cleared and the message is edited to reflect the accepted offer.

What's New

The first big thing is you are now able to offer multiple Pokemon in one trade. If you do this, Meowth won't attach a sprite thumbnail to the trade message. Whenever someone makes an offer on your trade, Meowth asks which of the Pokemon you are offering they are wanting to trade for. Hopefully this streamlines the trading channels a lot since users don't have to make a whole bunch of trades if they have a whole lot to offer.

The next thing is the addition of a lot more detail. You can use the same strings to specify things like moveset and level that you would when reporting a wild Pokemon. So for instance if you are trading a Gengar with Shadow Claw, you can type:

!trade "Gengar @shadowclaw"

As with the wild command, for multiple words in the command to be treated as one argument - in this case, a Pokemon, you need to enclose each group of words in quotes. IVs cannot be specified for trade offers since those attributes are re-rolled.

When telling Meowth what Pokemon you will accept in exchange, you still separate Pokemon with a comma. This does mean you have two different ways of specifying a list of Pokemon in the same command, but it was the easiest way to code things, since in the first case the Discord library is parsing arguments in a command, whereas in the second the whole message content has to be handled as one string, and then split into multiple arguments.

There's also two new special arguments you can give when specifying Pokemon you will accept in exchange for your trade offer(s). If you are wanting to selflessly give away some rare Pokemon, you can type 'any' to let people know you will accept anything. If you are wanting something good in exchange but don't want to tie people down, you can type 'obo' to let people make you an offer that is not on your list. Other users can specify the Pokemon they're offering you in the same format that you specify your Pokemon. Attributes like shininess, gender, level, and movesets can all be specified.

In 2.0 there was a step for confirming a trade once it had taken place. This wasn't very useful in the first place and it often didn't work in the second. Additionally, in 2.0 trade offers would stop responding after a while. That issue shouldn't be present in this version. Also, in 2.0 Meowth enforced a "clean" trade channel and deleted all messages from other users. This will be an option in 3.0 but not enforced.

The new and improved trade feature is available to test on our support server. Go break it!

Roadmap Update

Finally, I wanted to give an update on the timetable for 3.0. Things are progressing pretty well at this point. I am getting to a busy time of year at work but I was able to get this feature done in about a week or so. Here's what's left to do, along with my estimates on how long each thing should take:
  • Research (1 week)
  • EX Raids (1-2 days)
  • Clean mode option (1-2 days)
  • Super secret feature (1 week)
  • Configure (1 week?)
  • Error handling, documentation, polish (1 week?)
So with all that, I'm hoping everything will be finished by the end of March. I realize I said the same thing at the beginning of February, but ¯\_(ツ)_/¯

That's all I have for now! Thanks as always for the support.

Monday, February 18, 2019

Feature Spotlight: Wild Spawn Reporting

It's time again to look at a core feature of the upcoming Meowth 3.0. This time I'll be sharing the progress that has been made on the wild spawn reporting feature. This one was much simpler to develop than the new raid module, and I'm pretty happy with how it's turning out. But let's get down to the details.

What's Old

First, you can keep using the wild command exactly as you have been and it will continue to work. The only things you'll need to learn are how to take advantage of the new features. The reaction for marking yourself as "on the way" to a spawn is still there, as is the reaction for saying a wild Pokemon has despawned.

What's New

The big thing is that you're able to give Meowth a lot more detail about the wild spawn, if you choose. Here are the attributes of a wild spawn you are able to specify:
  • CP
  • IVs
  • Level
  • Moveset
  • Gender
This is in addition to being able to specify the form of the species, for the odd cases of species like Castform and Alolan forms.

In order to report attributes of a wild spawn, you must use a system that is similar to the search parameters you can use in Pokemon Go. For instance, to specify that a wild spawn has 500 CP, you can add "cp500" to your report. Because you can now include multiple terms in describing the wild spawn, this creates some ambiguity when parsing the command arguments. Specifically, where does the Pokemon end and the location begin? To handle this ambiguity, multi-word arguments describing the wild Pokemon must be enclosed in quotation marks. This is also true in the raid module, but there it's usually limited to reporting Alolan form bosses.

One thing that was a priority for me with this new feature was making sure that users weren't forced to spend a lot of time typing out the command with all the information. I didn't want users to have to wait until after catching a Pokemon to report it with all its attributes. Because of these concerns, it's also possible to add the information to a wild report after the initial command. It works like this. Let's say you spot a Combee and report it immediately. Combee's a fairly rare spawn at the moment so you want your fellow trainers to have as much time as possible to get there and catch it.


After you catch the Combee yourself, you realize it is a female Combee - making the spawn even rarer and more valuable. To add this attribute, you can hit the "information" reaction and let Meowth now the Combee is female.


Meowth helpfully provides a list of attributes you can specify along with how to set each of them. Meowth treats each "word" as a separate attribute, so it's important that you don't leave space between 'cp' and the number. Once you have replied to the message, Meowth deletes your reaction, the message prompting for information, and your reply to it, leaving only the edited wild spawn.

What Else Is Going On Behind the Scenes?

Boy am I glad you asked. There's quite a bit! Meowth is first checking that the species is even available in the wild when you report it. It's also validating the attributes when you specify them - you can't report a male Nidoran♀ for instance. If you specify level and IVs, it will calculate the CP for you. If you specify just level and CP, it will check that the CP falls within the possible CP range for that level. If you specify a moveset, Meowth checks that that moveset is available to the Pokemon. If you specify gender, Meowth checks to see if the species is one of those that has gender differences in appearance, and if it is, Meowth displays the image of the correct gender.
Meowth also takes advantage of the "gym matching" functionality, searching for gyms or Pokestops that it has in its database to provide precise directions whenever possible.

Any Bugs or Missing Functionality?

Just a bit! There's a feature that asks you to clarify if it finds multiple possible matches for a Pokemon name. This can lead to some strange results - for instance if you report a wild Pikachu, Meowth asks you to clarify if you meant Pikachu or Pichu, despite the fact that Pichu doesn't spawn in the wild. This is not really a bug per se but it is odd. Also, at the moment Meowth doesn't distinguish between legacy moves and currently available moves. So it will allow you to report a wild Dragonite with Draco Meteor for example.

I'm Super Stoked When Can I Try This Awesome Feature And When Will 3.0 Be Actually Released Also Did You Spend All of Our Money Yet

First off, wow, maybe try some punctuation. Second, no I haven't spent any of your money yet. The credit I had from Google Cloud Platform finally ran out the other day, and I'm very happy to say that you guys have been generous enough to cover Meowth's current operating costs for several months. Third, you can try the new wild feature today! There's a new channel for it in the support server. And fourth, I'm hoping 3.0 will be out no later than a month from now. I still have to write the modules for research and trades, I still have to add EX raid functionality to the raid module, I want to add a couple of general purpose server administration tools, and of course I have to make it possible to actually configure the bot for each server. I don't anticipate those being very complicated since a lot of the underlying framework is similar. And then of course 3.0 needs some actual error handling and documentation before it's released. But I believe the hardest work is over and I'm excited to get this thing to a stable release and into your servers as soon as possible. Thanks again for all your support and feedback!

Wednesday, January 16, 2019

Feature Spotlight: Raid Reporting and Coordination

The next feature I wanted to talk about is the one that's really at the core of the original design goals for Meowth: the ability to report and coordinate raids. Easily the most complex of all the functions of Meowth, this feature is now available to be tested on our support server!

Introduction

The raid system has been completely rewritten. The new system has support for a number of highly requested features, as well as some new surprises. Additionally, it will (hopefully) end up being much more efficient than the old system. Time will tell on that piece, but it certainly looks promising so far. Let's dive in.

What's new?

The following new features are present in the current build of Meowth 3.0:
  • Gym matching (with the old system of location-guessing used as a fallback)
  • Distinction between different forms of Pokemon such as Alola forms
  • Generic counters cached when raid bosses change and displayed on all raid information messages.
  • CP range displayed in the raid information
  • Recommended group size displayed in the raid information (based on Level 20 attackers)
  • Support for multiple raid groups and start times
  • Most RSVP changes can now be done with reactions in addition to commands

Gym Matching Benefits

Gym matching has brought some more benefits besides improved locations. In the last blog post I mentioned that the database stores the ID of the Level 10 S2 Cell containing each gym. Well, here's one benefit to that: we know that the in-game weather is determined at Level 10. So if a user at one gym updates the weather via the !weather command in a raid channel, the weather is also updated for each active raid in the same cell. Pretty neat!

Pokemon Forms

This is a big one and it's pretty complicated, but the short version is that if you want to report an Alolan Exeggutor raid, you will now need to put that in quotation marks. In fact this is true any time the "raid boss" argument is more than one word. The word order won't matter here, so "exeggutor alola" will work just as well as "alolan exeggutor".

Group Size Recommendations

The improved integration of Pokebattler has also made some things possible that I have long hoped to implement. Here are the details. With cached data on each raid boss, Meowth displays a recommended group size. When attempting to use !starting with an undersized group, Meowth sends a warning that you may not be able to defeat the boss. You have the option of going ahead anyway. Also, if you have asked Meowth to give your user-specific counters via Pokebattler, Meowth will take that into account when determining your group's strength. So although the recommended group size for Heatran is 3, if you and a friend have used !counters in a raid channel and Pokebattler thinks the two of you can duo the boss, Meowth won't warn you.

Additionally, if you attempt to start a group that is far above the power requirements for a certain boss, Meowth will suggest splitting into smaller groups in order to maximize rewards. Currently, this threshold is at a factor of 3 - in other words, if a group of 9 or more attempts to start, this warning will be sent. Of course, Meowth will allow you to go on ahead with the large group if you choose to.

Finally, when a group attempts to start a raid using !starting, Meowth checks to see if the users who are still on the way to the raid and the users who have not joined a group are able to defeat the boss without your group. If Meowth calculates that the number of users that you are leaving behind is not sufficient to defeat the boss, Meowth warns you about this and asks you to confirm. So in this situation, if you have a group of 5 about to do a Heatran raid, but there is 1 user that is still on the way, Meowth will warn you that you may be leaving out a user who is on the way but unable to defeat the boss without your group. You have the option of waiting or going on ahead anyway, so no need to worry about users who said they were on the way but never show up.

RSVP Changes

Most RSVP commands can now be done via reactions as well as the regular commands. If you use a reaction, Meowth will assume you are a group of 1, unless you have previously set a group size, even on a previous raid. Meowth will now remember the makeup of your group until you change it yourself. So if you always raid with the same group of people, set it once with a command and then you can use reactions from then on! Also, Meowth now enforces a limit of one raid that you are either "coming" to or "here" at. So if you said you were "here" to one raid but then say you are "coming" to a different raid, Meowth will cancel your RSVP to the first raid. This has been done to more accurately reflect the intention that "coming" is for users who are actively on the way and to help reduce the effect of people forgetting to mention when they leave a raid.

Summary

There's a lot to digest here but here's what is currently available to beta test on the support server.
  • The !raid command (no alias yet). The argument order is the same as it always has been - boss or level, location, time until hatch or expire.
  • RSVP commands and reactions (!interested, !coming, !here, !starting) as well as reactions for backing out or confirming in the case of warning messages.
  • !counters, !weather, !group (in raid channels)
Play around with it! There are quite a few bugs I'm sure but that's why this is a beta. Let me know what bugs you find and what feedback you have! As always, thanks for the support and patience.

Wednesday, December 5, 2018

Feature Spotlight: Gym Matching

This is the first in a series of blog posts where I break down a feature that is either new or improved in Meowth 3.0, providing details and insights for users and a break from coding for myself. There's no better place to start with the most-requested feature of all time for Meowth: gym matching.


Introduction


For the uninitiated, "gym matching" is what we call the process of matching a location string supplied by a user to an actual gym in our database. For a very long time, Meowth did not have a database at all because I didn't know anything about databases or how to build them. Luckily for us Scragly did a lot of invaluable work in both building a database interface and helping me learn how to use it. As a result Meowth 3.0 does have a database, and one of the tables in that database is for gyms.


Storing the Data


A description of the gyms table

Each gym in the table has, at minimum:
  • a unique ID (generated by a sequence automatically as gyms are added)
  • the gym's name in Pokemon Go (supplied by a server administrator)
  • the gym's latitude and longitude (also supplied by a server administrator)
  • the ID of the Level 10 S2 Cell containing the gym
  • the ID of the Discord server that submitted the gym (note: in the current build this can be NULL, but in the final build it will be required)
There are also currently columns for:
  • a nickname
  • a True/False value indicating whether the gym is an EX Raid Gym or not (this information will have to be included by the server administrator)

Implementation


Building a table including this information is not too difficult. But at Meowth's intended scale there are some possible problems, for instance that there are lots of gyms with the same name (e.g. "Starbucks", "First Baptist Church", and others.) Sometimes there may even be multiple gyms of the same name even in one server's playing area. However, there are lots of ways we can narrow down the list of gyms to only the relevant ones for that area when trying to find a match. One of the important pieces has to do with the reporting channel. In Meowth 3.0, every reporting channel has an associated circular region. The server administrator who configures the channel for reporting must supply a center and radius for the region. Then, when a user reports a raid in that channel, the following steps are taken:
  • Build a query of the gyms table, selecting the 'id', 'name', and 'nickname' columns.
  • Filter out all gyms added by other servers.
  • Generate a covering of Level 10 S2 Cells for the circular region associated with the channel.
  • Filter out all gyms that are not located inside the covering.
  • Retrieve the data for all of the remaining gyms.
  • Check the location argument against the nickname list.
  • If there's not a match, check it against the name list.
  • Pick the best match as judged by a fuzzymatching module.
This is the basic algorithm as it stands right now. Before release, there will be a step added that asks for clarification if there are multiple close matches.

Benefits


Under the old system of locations, Meowth had a very unsophisticated process for guessing where a gym was - take the location string, add it to the "city string" in the configuration for the channel, shove all those words in a Google Maps URL, and hope Google knows about it. This worked sometimes but not all the time - unsurprising given the relative obscurity of some landmarks. So keeping an actual gym database with saved locations is obviously going to improve the directions Meowth gives. But there are other benefits as well. For one, detecting duplicate raids is now actually possible. After determining which gym a user is reporting a raid at, Meowth checks the raids table to see if a raid has already been reported there. If there has, Meowth sends the information for the raid, including the channel it's being coordinated in.

Another benefit is that it is now possible for Meowth to make raid channels that are visible to multiple reporting regions. Raids will be visible to any reporting channel whose circular region contains any part of the gym's Level 10 S2 cell. This means that if you report a raid that is on or near the border of two channels' regions, the resulting raid channel will be visible to users from both regions.

Drawbacks


This system is highly dependent on quality data from server administrators. Since an official gym map tool does not exist, we rely on user reports and have no way of vetting the data that is put in. Because of this, each server has access only to their gyms that they have imported, and only server administrators are capable of adding or removing gyms to that list. If the data is incomplete, the results may be inconsistent. In the event that Meowth cannot find a match to the gym, it will simply fall back to the old way of creating a Google Maps search for the string.

Preparing Your Data


This is a link to a spreadsheet template you can use to gather your server's gym data. You'll need to make a copy of it to use it. When Meowth 3.0 launches, you will be able to import a CSV that matches the template to add your server's gym data in bulk. Thereafter, there will be commands for adding to, removing from, and modifying your server's gym list.

Final Thoughts


This system is not likely to change drastically between now and release. As always, I welcome all constructive feedback! Let me know what you think in the comments or in the Meowth Discord Server!

Changes to Research

More details on today's changes to the research command are below. A new optional argument has been added to the research command. Thi...