Teambuilder Smogon Plugin

Discussion in 'Development General' started by d25inferno, Sep 30, 2012.

  1. d25inferno

    d25inferno New Member

    Joined:
    Sep 15, 2012
    Messages:
    11
    Likes Received:
    0
    Hey All,

    We (Me and one other person) are planning to create a new plugin where users can auto choose stats and Pokemon moves from Smogon's strategy guide (http://www.smogon.com/bw/pokemon/) within Pokemon online, allowing players to easily build commonly seen Pokemon teams for battle. This will be a plugin feature, built on-top of the current Pokemon online application.

    We have looked through the QRCode Plugin and figured out how plugins in Pokemon Online work. We think that the MainEngineInterface that client plugins use does not have any method to access which Pokemon is currently selected in Teambuilder by the user. We were wondering if there was any good way to getting this data.

    Thanks.
     
  2. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    Hi, the plugins have been created mostly on-demand, and the interface required has been developed side-by-side.

    Currently src/Teambuilder/Teambuilder/teamholderinterface.h exposes a read-only (const) interface but your plugin would most likely need a read-write interface.
    Either teamholder could be edited into read-write, or MainEngineInterface (src/Teambuilder/engineinterface.h) could include some functions which allow this.

    Regardless of which way you go, it would be best to not break the current plugins by changing the interfaces so that they won't be compactible with the current one anymore.

    What ideas you have? Do you need some help adding the required plugin interface?
     
  3. d25inferno

    d25inferno New Member

    Joined:
    Sep 15, 2012
    Messages:
    11
    Likes Received:
    0
    Hi Lamprei,

    Thanks for the response. I purposely didn't reply for some time since I was still understanding the underlying structure of teamholderinterface.
    I understand now what you mean when you say that the interface needs to be read-write.

    Right now our idea is that our plugin will open a window, allow a user to choose a build for the pokemon on his/her team from Smogon. When the plugin is closed, the UI and underlying model should update with the changes made in the plugin.

    For example if the user has Infernape in the team, the user can use the plugin to select the Nasty Plot build on this page (http://www.smogon.com/dp/pokemon/infernape). When the window is closed, the values listed on smogon should be reflected in the UI.

    Right now I am not sure what the best way to expose needed features is. Any input in this regard would really help.
     
  4. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Since your plugin would be a "teambuilder" plugin (it would only be usable in the teambuilder right?), you can copy what's already been done with the client scripts plugin.

    The plugin manager basically stores one instance of an "OnlineClientPlugin" for each client open:

    Code (c++):
    1. void PluginManager::launchClient(ClientInterface *c)
    2. {
    3.     clients.insert(c);
    4.  
    5.     foreach(ClientPlugin *pl, plugins) {
    6.         OnlineClientPlugin *o = pl->getOnlinePlugin(c);
    7.  
    8.         if (o) {
    9.             c->addPlugin(o);
    10.             clientPlugins[c].insert(pl, o);
    11.         }
    12.     }
    13. }
    14.  
    15. void PluginManager::quitClient(ClientInterface *c)
    16. {
    17.     foreach(OnlineClientPlugin *o, clientPlugins.value(c)) {
    18.         delete o;
    19.     }
    20.  
    21.     clientPlugins.remove(c);
    22.     clients.remove(c);
    23. }
    24.  
    When a client is open, each plugin is asked whether or not it wants to create an OnlineClientPlugin, and if so, the OnlineClientPlugin is stored. When the client is closed, the OnlineClientPlugins for that client are removed.

    Basically you need to put in place the same system for TeamBuilder (use Ctrl+Shift+U on launchClient and quitClient of the plugin manager to see where to introduce the teambuilder functions in the teambuilder code). You would give your TeamBuilderPlugin a TeamBuilderInterface* parameter, which can be used to update the teambuilder based on the change of the team.
     
  5. d25inferno

    d25inferno New Member

    Joined:
    Sep 15, 2012
    Messages:
    11
    Likes Received:
    0
    All, thank you for all the help here - I really appreciate it.

    Me and a friend have finished developing our first version of SmogonPlugin. SmogonPlugin is a plugin where users can auto choose stats and Pokemon moves from Smogon's strategy guide (http://www.smogon.com/bw/pokemon/) within Pokemon online, allowing players to easily build commonly seen Pokemon teams for battle.

    How it works:
    [video=youtube;isDXGqwXPqw]http://www.youtube.com/watch?v=isDXGqwXPqw[/video]

    Currently we have implemented a simple interface for viewing builds.
    The user can modify the build if it has options.
    The user can save build to the default team directory as the name specified before entering teambuilder

    In the future we plan on:
    - Modifying the main TeamBuilder UI dynamically when the user changes build or options in the plugin.
    - Have a save dialog appear when you hit the save button in after you have made the choices.
    - Currently the move hidden power is ported to PO correctly for gens 3-5, gen 2 does not work at the moment because of a difference in style between gen 2 and the other gens.
    - Check if a move was entered twice

    There is a lot of testing and work to be done here, and it would be great to hear the communities feedback for the next release!

    Link to source:
    https://github.com/dgurjar/pokemon-online/tree/master/src/SmogonPlugin
     
  6. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Looks really impressive!
     
  7. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Alright, I've added it to the PO repo and tested it!

    It's pretty impressive you seem to know so much about Qt already, and using network instead of local storage for smogon sets.

    Though, I have a question, do you want to wait and improve it before it's included in the next PO release, or is it ok like it is now?
     
  8. d25inferno

    d25inferno New Member

    Joined:
    Sep 15, 2012
    Messages:
    11
    Likes Received:
    0
    Hey, Thanks! It's fine as is for now, I am busy for this month, but afterwords do plan on releasing an improved version. Would love for the PO community to give it a try and report any bugs they find.
     
  9. Tyki

    Tyki Change

    Joined:
    Nov 13, 2011
    Messages:
    926
    Likes Received:
    0
    PO Trainer Name:
    Tyki
    I've tried it out, and so far a love the idea, but I am completely unable to save any of the sets onto the pokemon (mac version). I've followed all of the steps from the video, but when I click "save" nothing saves.
     
  10. d25inferno

    d25inferno New Member

    Joined:
    Sep 15, 2012
    Messages:
    11
    Likes Received:
    0
    Hey, I just downloaded the current OS X version 2.0.05 and found that it didn't have the plugin included. Did you build it yourself?

    From our end, we never tested our plugin on OS X, only Windows and Linux. Out of curiosity did you name your team before using our plugin? Currently we save your team based on the name provided. In the video, the team was named smogonBuild. A blank name for the team could potentially be a problem in OS X.

    Also just for reference, what version of OS X are you running?
     
  11. Tyki

    Tyki Change

    Joined:
    Nov 13, 2011
    Messages:
    926
    Likes Received:
    0
    PO Trainer Name:
    Tyki
    The current version of mac is actually 2.0.07, and Lamperi packaged the plugin on that version. I'm running Mountain Lion, 10.8.2. I put in a name, though I try out some other things and report back if I can fix it.
     
  12. Emperor PPP

    Emperor PPP PKMNPurePower

    Joined:
    Feb 15, 2012
    Messages:
    853
    Likes Received:
    1
    2 things:

    1) It crashes every time I use it :(
    2) I'm not sure about other pokes but Qwilfish only uses 504 EVs on its set
     
  13. d25inferno

    d25inferno New Member

    Joined:
    Sep 15, 2012
    Messages:
    11
    Likes Received:
    0
    Hey, I tried out the plugin in 2.0.07 on mountain lion, and it seemed to work fine for me.
    Posted a video of it working: http://www.youtube.com/watch?v=AaR4X6crA-w

    Please let me know if you are still having any troubles.
     
  14. d25inferno

    d25inferno New Member

    Joined:
    Sep 15, 2012
    Messages:
    11
    Likes Received:
    0
    Hey can you tell me which OS you are using and the exact nature of the crash?

    Also all Pokemon use EVs specified according to Smogon. Smogon uses 504 for Qwilfish and mostly all the pokes I've seen. Not sure why this is the case... However since the plugin is meant to be as close to Smogon as possible, we expect you guys to manually tweak your pokes as needed.

     
  15. Tyki

    Tyki Change

    Joined:
    Nov 13, 2011
    Messages:
    926
    Likes Received:
    0
    PO Trainer Name:
    Tyki
    Oh, I understand now. Yea, it's working now. Thanks for the clarification.
     
  16. Emperor PPP

    Emperor PPP PKMNPurePower

    Joined:
    Feb 15, 2012
    Messages:
    853
    Likes Received:
    1
    @d25inferno

    I'm using Windows 7
     
  17. d25inferno

    d25inferno New Member

    Joined:
    Sep 15, 2012
    Messages:
    11
    Likes Received:
    0
    Hmm...
    And can you give me the time in my video where it would crash for you?

     
  18. Emperor PPP

    Emperor PPP PKMNPurePower

    Joined:
    Feb 15, 2012
    Messages:
    853
    Likes Received:
    1
    ^
    1:24, as soon as you save it

    (Also sorry about all the posts guys)

    EDIT

    @Coyo
    I tried that, no change
    Thanks anyway
     
    Last edited: Nov 23, 2012
  19. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Emperor PPP, just to make sure, download again the whole thing and reinstall it.
     
  20. d25inferno

    d25inferno New Member

    Joined:
    Sep 15, 2012
    Messages:
    11
    Likes Received:
    0
    Hey, when I tried it on Windows 7 (Fresh install) it gave me a popup error when trying to save saying that PO couldn't save to the specified directory.
    I found the following workaround:

    Simply create the directory
    if that doesn't work, try
    I forget which one it is.

    After creating that directory, it seemed to save fine. This is something that will be fixed in the next update. Let me know if this fixes it for you.
     
  21. Emperor PPP

    Emperor PPP PKMNPurePower

    Joined:
    Feb 15, 2012
    Messages:
    853
    Likes Received:
    1
    Still nothing
    Should I try running it as an administrator?
     
  22. Crystal Moogle

    Crystal Moogle Ayaya~ Administrator Administrator

    Joined:
    Jul 19, 2010
    Messages:
    3,205
    Likes Received:
    531
    PO Trainer Name:
    Hanako
    I crash too when clicking save. Win 7 64 Bit.
    I added the folder(s) specified above and still nothing.

    I have this if it helps though
    [​IMG][/HIDE]

    I tried running it through the debugger after I crashed :x
     
  23. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Fixed (i think)

    Code didn't check if tab->getPokeTeam() was NULL or not (in frame 1 of the debug stack in the screenshot)
     
  24. Emperor PPP

    Emperor PPP PKMNPurePower

    Joined:
    Feb 15, 2012
    Messages:
    853
    Likes Received:
    1
    Quick thing,
    I can't actually access that file to replace the data (My laptop can't run java :( )
    (Btw if it matters, I run 32-bit windows)
     
  25. Kyrk

    Kyrk KACAW

    Joined:
    Jun 28, 2011
    Messages:
    1,232
    Likes Received:
    142
    PO Trainer Name:
    RTG
    I'm having trouble using this on my macbook OS X Snow Leopard 10.6.8. I downloaded the zip file, but the plugin manager didn't detect it. I tried individually testing each file to see if the manager read it to no avail.
     
  26. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    The alpha version of this plugin is included on Mac download 2.0.07.

    You should not need to do any other downloading.
     
    Last edited: Nov 29, 2012
  27. Kyrk

    Kyrk KACAW

    Joined:
    Jun 28, 2011
    Messages:
    1,232
    Likes Received:
    142
    PO Trainer Name:
    RTG
    Wasn't aware of that until I located and downloaded 2.0.07 (which you should probably link in the main site's download page,) and I then had those same crashing problems.

    It apparently crashes if you don't put a moveset in every pokemon on the team before saving. However, if Smogon didn't make a set for a certain pokemon on my team, I just copied the other sets manually and added some random set on that unknown pokemon, making sure I don't save in the plugin box so I don't crash the client.
     
  28. wedfrgthzukoiöp

    wedfrgthzukoiöp New Member

    Joined:
    Nov 20, 2012
    Messages:
    15
    Likes Received:
    0
    Hi, when i click on "save", it says, "can't create file". And when i start PO as admin, and click "save", it crashes :l
    (I mean the save-button in the plugin)
     
  29. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    yea, well you need valid sets for every poke, or next update the crash will be fixed.
     
  30. ashy

    ashy New Member

    Joined:
    Dec 12, 2010
    Messages:
    26
    Likes Received:
    1
    hey guys,

    I'm pretty dumb, so can someone explain me how to activate this plugin :(
     
  31. SoulWind

    SoulWind Member

    Joined:
    Mar 31, 2011
    Messages:
    109
    Likes Received:
    7
    Is there any way to change the database of the plugin? I mean changing any of the movesets or adding more EV Spreads to the Pokémon or it's impossible?
     
  32. Ethan

    Ethan Member

    Joined:
    Nov 6, 2011
    Messages:
    238
    Likes Received:
    0
    No. The Pokémon are ripped from the Smogon website.
     
  33. YaduXGT

    YaduXGT New Member

    Joined:
    Mar 17, 2013
    Messages:
    1
    Likes Received:
    0
    Hey Guys i saw that the pokedex option is missing in the v2 what about it ?
     
  34. GotThatPopcorn

    GotThatPopcorn Banned

    Joined:
    Jan 30, 2013
    Messages:
    177
    Likes Received:
    0
    PO Trainer Name:
    GTP
    go to the plugins on the nav bar at the top, click add plugin and there are many there, but be sure not to use Smogon yet because of the crashes it has on your PO
     
  35. fitzy

    fitzy Heart of the cards Forum Moderator Forum Moderator

    Joined:
    Apr 16, 2012
    Messages:
    883
    Likes Received:
    296
    Since 2.4.1 this has stopped working for me. Anyone else having the same problem?
     
  36. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Link's been updated for gen 6 analyses, which smogon still doesn't have.

    Once they put it up, it will work. You can still get gen 5 sets by setting your gen to BW2.