Coyo's development thread

Discussion in 'Development General' started by coyotte508, Aug 9, 2010.

  1. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Yea it can. The stuff in the devel branch needs C++0x, but for stuff in the master branch it's ok now.
     
  2. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    Oh, and I think you can tag versions in git, so no separate release branch will be needed.
     
  3. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    https://github.com/coyotte508/pokemon-online/blob/devel/src/BattleManager/battlecommandinvoker.h

    <3 C++0x stuff.

    I'm making good progress. I already have a battle input extracter, now I need to finish BattleData & BattleClientLog, and I'll have a way to convert raw to log & use that in client battles. Then a BattleScene class, and it will be usable for client battles completely. Then a BattleServerLog class, and all the logging code will be removed from battle.cpp and placed into the BattleLogs plugin. Then, battle plugins client side or server side will be possible, and that includes making AI. Battle replays too. Then...

    Well, I cleared the templating hurdle, now I just have to write code en masse.

    Mystra will also be happy to know that the code is gcc 4.4 compatible now.
     
  4. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    I am, yes! :3
     
  5. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
  6. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    https://github.com/coyotte508/pokemon-online/blob/devel/src/BattleManager/battledata.h
    https://github.com/coyotte508/pokemon-online/blob/devel/src/BattleManager/battledata.cpp

    Made the battledata class. It's surprisingly light, and will be usable by any other class in the battle command flow. Entirely separating this from GUI is so delightful <3

    Of course it'll be changed, and later I intend to add more and more data (like stat boosts, weather, spikes, reflect, leech seed, embargo, etc) plus evaluate data for AI use (item, ...) or client use from battle log. But for now I can already use it to make a spectator window!
     
  7. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Did client logging, works just fine.

    I'm doing the battle scene now. On to QML learning (and it's awesome). By the way mystra it's type-safe!

    Maybe I'll do a backup C++ battle scene for poor people with Qt 4.6 ^^
     
  8. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    >type-safe

    JS is weak typed among other things. What a horrible abomination (>_>)

    Just try to compile on 4.6. Or say me where I can download code to test. Maybe it works. It's not like you are using super mega something. Or maybe you do (O.o)
     
  9. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    it's type-safe.

    Of course you can use full javascript files in QML but all the properties are typed. Even C++ user types all have a different type. The weak-typed thing only applies in scripts you could generate, but if you only base yourself on your properties you'll never encounter that.

    And if for example you try to assign an int to a Text property, it'll cause an error :)

    (To test, try the devel branch of PO)
     
    Last edited: Sep 12, 2011
  10. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    Well, I thought we have compiled languages for that already :3
     
  11. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    constexpr: GCC 4.5. GCC used Troll! It's super-effective!
     
  12. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    lol...

    I even removed the for (x : container) to make it compatible with versions prior to 4.6. Just use 4.5.2 already xD
     
  13. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    y u so newer, latest, shiny
     
  14. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    line 74 of battle.h, replace constexpr by const. Does it work?
     
  15. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Wheee

    QML is weird... Some weird thing.

    Did you know that if you attached the same notify signal to different properties you could have a crash? Or all the ownership rules which catch you offguard? And that you for the love of god you can't just swap items in a grid? How complicated it is to dynamically create objects? That when moving items in a gridview you can't animate them, you have to reparent a subelement to the grid with the coords to the item? That you can't call invoke() cpp methods from properties even if they're QML-registered? (or in some cases...) And ...

    Well, you gotta learn it somehow. First animation implemented for whoever can compile. Upside is that once it's learned, it's good stuff, but you gotta learn it the hard way with the current internet resources. Plenty of good doc from Qt, but really no index to organize them.
     
    Last edited: Sep 14, 2011
  16. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    Q_INVOKABLE does not work?
     
  17. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    They do work fo TeamProxy, but not for PokeProxy, go figure...
     
  18. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    In the meantime

    :}
     
  19. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Lol

    Got so annoyed by the States & Transitions thingie that I did imperative using the declarative interface and some tricks... And animations work. (Though they do need to be improved)

    Will do States + Transitions & HP display tomorrow, hopefully.
     
  20. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Did States & Transition. Did HP bar animations.

    Did fainting animation, send out, send back. On a side note, fixed a crash, and added spectator name to battle protocol.

    Now I'm going to introduce a QML element to do frame animations ... For the pokeballs.
     
  21. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    One thing to do soon, is to implement color-shading on the pokemon icons or their sprite, to tell they are KOed, or burned, etc. (Like the pokemon game does)

    So I think this shadereffect will do :

    Code (javascript):
    1. ShaderEffectItem {
    2.         id: blendEffect
    3.         blending: true
    4.  
    5.         property variant sourceTexture: sourceImage
    6.         property color blendColor: "slategray"
    7.         property real colorAlpha: 0.5
    8.  
    9.         vertexShader: "
    10.            uniform highp mat4 qt_ModelViewProjectionMatrix;
    11.            attribute highp vec4 qt_Vertex;
    12.            attribute highp vec2 qt_MultiTexCoord0;
    13.  
    14.            varying highp vec2 qt_TexCoord;
    15.  
    16.            void main(void)
    17.            {
    18.                qt_TexCoord = qt_MultiTexCoord0;
    19.                gl_Position =  qt_ModelViewProjectionMatrix * qt_Vertex;
    20.            }
    21.        "
    22.  
    23.         fragmentShader: "
    24.            uniform lowp sampler2D sourceTexture;
    25.            uniform lowp vec4 blendColor;
    26.            uniform lowp float colorAlpha
    27.            varying highp vec2 qt_TexCoord;
    28.  
    29.            void main (void)
    30.            {
    31.                vec4 c = texture2D(sourceTexture, qt_TexCoord);
    32.                vec4 b = blendColor;
    33.                gl_FragColor = vec4(b.rgb, min(colorAlpha, c.a));
    34.            }
    35.        "
    36.     }
    If it works... :D
     
  22. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    [secret]
    Code (text):
    1. import QtQuick 1.0
    2.  
    3. FrameAnimation {
    4.     id: pokeball;
    5.  
    6.     source: "../images/pokeballs.png"
    7.     width: 41
    8.     height: 40
    9.     frameCount: 8
    10.     delay: 50
    11.     col: 6
    12.  
    13.     function trigger() {
    14.         triggerProp = !triggerProp;
    15.     }
    16.  
    17.     property bool triggerProp: false
    18.  
    19.     property int destX: woof.x + (woof.width/2-20);
    20.     property int destY: woof.y - 20;
    21.  
    22.     property int deltaX: woof.back ? - 150 : 150
    23.     property int deltaY: woof.back ? 50 : -50
    24.  
    25.     property int sourceX: destX + deltaX;
    26.     property int sourceY: destY + deltaY;
    27.  
    28.     property int amplY: 60;
    29.  
    30.     x: sourceX + deltaX * percent;
    31.     y: sourceY -(0.5-percent)*(0.5-percent)*4*amplY + amplY + percent*deltaY;
    32.  
    33.     property real percent: 0;
    34.  
    35.     signal animationCompleted();
    36.  
    37.     Behavior on triggerProp {
    38.         SequentialAnimation {
    39.             ScriptAction {
    40.                 script: {reset(); paused = false; opacity = 1;}
    41.             }
    42.  
    43.             NumberAnimation {
    44.                 property: percent
    45.                 from: 0; to: 1.0; duration: 700;
    46.             }
    47.  
    48.             NumberAnimation {
    49.                 property: opacity;
    50.                 from: 1.0; to: 0; duration: 150;
    51.             }
    52.  
    53.             ScriptAction {
    54.                 script: { pokeball.paused = true; animationCompleted();}
    55.             }
    56.         }
    57.     }
    58. }
    59.  
    [/secret]

    Doesn't work because of a QML bug elsewhere, so putting it there as I'm not putting it in the git repository.
     
  23. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
  24. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    Seeing PO UI is kinda complete, I'm not sure if that's any use.
     
  25. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    More dependencies? I'll ban you all.
     
  26. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    The color button widget is at least useful for the CSS plugin
     
  27. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    I have only Qxt in backports :P
     
  28. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    Use full version in Shared/config.h if you can :3 Like, say, 1.0.30.1
     
  29. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    i got headshot by qt >_>

    Moved to qt 4.8, and in the headers there is some stuff that cause an ICE for mingw 4.4 (got fixed in later gcc) when std-c0xx enabled. :(
     
  30. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Go back to 4.7 and do bug report? :P
     
  31. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    What is it and why do you need it? Maybe there is an update for that too.
     
  32. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    ICE is internal compiler error. Worst is when developping PO i had the same kind of structure in C++0X and the same error for gcc, so i bugreported it, but they said it was fixed in 4.5 anyway so i can't do anything.
     
  33. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Okay, so what i've done recently: Multiple teams, reconnect feature, new design for teambuilder.

    Look at that :p

    [​IMG]

    What I am going to do now:

    - Introduce true RBY support
    - Support multiple gens in teambuilder
    - Improve stuff in QML battle window
    - Finish up network protocol etc.

    What I'd like to do, what I think would be interesting, side developments of PO:

    - Make the stats plugin auto move the stats every month (through python, statsextracter?)
    - Make a basic gui for the stats plugin
    - Make the stats extracter able to generate the 10000 most popular sets per generation in an easily read format (later to be read by the stat plugin)... For something like a rental cup?
    - Make the tiers update automatically (for NU etc) using usage statistics, every month
    - Make a mini website on the PO server (open source of course) or even from the website. A registered player on the server would first /identify himself and alias it to a forum account here. The server would make a webcall to the website, etc. Then, if he gets to a certain rating in a tier (using a weird mathematical, or a simple, formula), he can register it on the server (through server script) and the server would notify the mini-website. Anyway the goal of the mini-website would be wishmkr-like, users would be able to nominate pokemons for suspecting/desuspecting in the tier, have convos in a 4chan way on the nominated pokemons (or w/e), ultimately vote on no-ban/test-ban/ban and following that it would take effect on the server. It would first be placed as an experiment in the DW tiers.

    I don't mind people working on those though ^^
     
  34. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Looks nice :(
     
  35. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    We can do this in our setup easily, the reason I don't do this is that UsageStats plugin needs to be disabled before doing this.
    Working on a script for this. I don't think this should be added to C++ code as each server handles these differently.

    I'm interested in making a Web GUI for Registry, serving two pages: The Server Listing available for all (As in http://valssi.fixme.fi:8088/ - this uses a python script to connect to registry and display that) and Admin page where we could view bans and modify them.

    I know I'm a lazy bastard and these would just be there to ease my life of registry banning bad server owners and update the tiers.
     
    Last edited: Mar 1, 2012
  36. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    I have a script to update PO tiers based on usage. It can automatically update stuff it sees is wrong.

    Code (text):
    1. [valssi:~/updatescripts/po-server-goodies] (git)-[master] % python3 updatepotiers.py
    2. Reading PO tiers
    3. Updating PO tiers...
    4. Downloading ranked stats for Wifi OU... Calculating banlists for Wifi UU... Calculated.
    5. Proposed changes:
    6. Remove bans for {'Deoxys-S', 'Excadrill'} as they are banned in parent tiers.
    7. Proceed with changes? [Y/n]
    8. Tier Wifi UU updated!
    9. Downloading ranked stats for Wifi UU... Calculating banlists for Wifi LU... Calculated.
    10. Proposed changes:
    11. Add bans for {'Bronzong'} as they should be banned by usage or banlist.
    12. Remove bans for {'Tornadus', 'Mamoswine', 'Donphan', 'Jolteon', 'Roserade', 'Metagross'} as they are banned in parent tiers.
    13. Proceed with changes? [Y/n]
    14. Tier Wifi LU updated!
    15. Downloading ranked stats for Wifi LU... Calculating banlists for Wifi NU... Calculated.
    16. Unknown bans present: {'Snover', 'Houndoom', 'Misdreavus'}
    17. Proposed changes:
    18. Add bans for {'Crustle'} as they should be banned by usage or banlist.
    19. Remove bans for {'Durant', 'Wobbuffet', 'Escavalier', 'Medicham', 'Stoutland', 'Omastar', 'Virizion'} as they are banned in parent tiers.
    20. Proceed with changes? [Y/n]
    21. Tier Wifi NU updated!
    22.  
    23. Writing PO tiers
    24. Done
    25.  
    And rerunning doesn't find the errors again as they are fixed:
    Code (text):
    1. Reading PO tiers
    2. Updating PO tiers...
    3. Downloading ranked stats for Wifi OU... Calculating banlists for Wifi UU... Calculated.
    4. Tier Wifi UU seems fine.
    5. Downloading ranked stats for Wifi UU... Calculating banlists for Wifi LU... Calculated.
    6. Tier Wifi LU seems fine.
    7. Downloading ranked stats for Wifi LU... Calculating banlists for Wifi NU... Calculated.
    8. Unknown bans present: {'Snover', 'Houndoom', 'Misdreavus'}
    9. Tier Wifi NU seems fine.
    10.  
    11. Writing PO tiers
    12. Done
    13.  
    One thing I need to prepare it is to check for Pokemon that drop from OU or UU so that they only should drop one tier at the time, such as Houndoom.

    Then I add Snover to the same BL as Abomasnow:
    Code (text):
    1. [valssi:~/updatescripts/po-server-goodies] (git)-[master] % python3 updatepotiers.py
    2. Reading PO tiers
    3. Updating PO tiers...
    4. Downloading ranked stats for Wifi OU... Calculating banlists for Wifi UU... Calculated.
    5. Tier Wifi UU seems fine.
    6. Downloading ranked stats for Wifi UU... Calculating banlists for Wifi LU... Calculated.
    7. Proposed changes:
    8. Add bans for {'Snover'} as they should be banned by usage or banlist.
    9. Proceed with changes? [Y/n]
    10. Tier Wifi LU updated!
    11. Downloading ranked stats for Wifi LU... Calculating banlists for Wifi NU... Calculated.
    12. Unknown bans present: {'Houndoom', 'Misdreavus'}
    13. Proposed changes:
    14. Remove bans for {'Snover'} as they are banned in parent tiers.
    15. Proceed with changes? [Y/n]
    16. Tier Wifi NU updated!
    17.  
    18. Writing PO tiers
    19. Done
    20.  
    Victory! Now everything is automatic:
    Code (text):
    1. [valssi:~/updatescripts/po-server-goodies] (git)-[master] % python3 updatepotiers.py
    2. Reading PO tiers
    3. Updating PO tiers...
    4. Downloading ranked stats for Wifi OU... Calculating banlists for Wifi UU... Calculated.
    5. Tier Wifi UU seems fine.
    6. Downloading ranked stats for Wifi UU... Calculating banlists for Wifi LU... Calculated.
    7. Tier Wifi LU seems fine.
    8. Downloading ranked stats for Wifi LU... Calculating banlists for Wifi NU... Calculated.
    9. Likely dropped from Wifi UU to Wifi LU: {'Sigilyph', 'Froslass', 'Houndoom'}. Added to Wifi NU ban list.
    10. Unknown bans present: {'Misdreavus'}
    11. Proposed changes:
    12. Add bans for {'Sigilyph', 'Froslass'} as they should be banned by usage or banlist.
    13. Proceed with changes? [Y/n]
    14. Tier Wifi NU updated!
    15. Downloading ranked stats for DW OU... Calculating banlists for DW UU... Calculated.
    16. Unknown bans present: {'Wobbuffet'}
    17. Tier DW UU seems fine.
    18.  
    19. Writing PO tiers
    20. Done
    21.  
     
    Last edited: Mar 2, 2012
  37. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    That's... great!
     
  38. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Then maybe a script command to disable the plugin, launch, and readd the plugin?
     
  39. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    Even a server script command would definitely make it easier, but would be better if usage stats wouldn't crash when moving the raw files.
     
  40. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    Well I just fixed that (but then, previously you just needed to let the folders there even if you emptied them in order not to crash).

    There's still the issue of resetting rated stats, as they are kept in memory and loaded only when the plugin is loaded.