nestharus / JASS

MIT License
31 stars 8 forks source link

Network rewrite #16

Closed Arhowk closed 10 years ago

Arhowk commented 10 years ago

apparently Bnet likes to crash after 1267 orders are sent in a 200ms time frame than slow down to 1 order per 10ms. (which evaluates to 1 byte every 80ms, 4 integers every second) (I swear to god i tested this and i synced 4000 orders in 1sec)

need to find a way to reset it so i can send 1267 orders in 200ms again

Question for Nes on SyncStoredInteger : Does the downtime increase with the number of players in game?

nestharus commented 10 years ago

it indeed does : )

soo.. do 1267 orders in like a 400ms time frame? lol...

Arhowk commented 10 years ago

yeah thats what I'm doing. For some reason, all of a sudden, wc3 is combining my uppercase and lowercase spell books, even though i have different base order IDs

Arhowk commented 10 years ago

Ready for catalog to get fixed.

Arhowk commented 10 years ago

zz

tested in a 12 player game and worked out a few bugs. biggest issue was getting everyone to enable local files. other than that, syncing was quite fast. Had to add a few hardstops for syncing incase there was interference.

nestharus commented 10 years ago

okz

keep improving it. Once u do, then start on codeless save/load, which is the thing that works between File I/O and syncing at max speed.

Arhowk commented 10 years ago

i cant work on codeless saveload because theresn o catalog..

e/ ima just work on terraining for a while. at this rate itll be christmas

nestharus commented 10 years ago

u don't need catalog for a codeless save/load system...

sry, I'm having a lot of fun on Tera :(

I guess I'll do it today >.>

nestharus commented 10 years ago

sry, I promise first thing I do when I wake up tomorrow is work on Catalog, k? :)

I'll find out what's wrong with the count. Right now I'm just way too tired ;o.

It's just kind of demoralizing when you are doing static ability ids for your ability generation for your system >.>. What happens when a user needs to change an ability id for collision? How will they even know? You have a ton. They might just lose their stuff w/o realizing it.

I'm likely going to work on a way to use File Exporter, which you can certainly use, to call the Object Merger exe.

edit ok, I can modify the lookup paths and it'll be able to find war3.mpq then. I can call the exe directly ^)^. This'll work.

Arhowk commented 10 years ago

"They might just lose their stuff w/o realizing it."

It's mentioned to make a backup of their map before running the macro scripts. Keep in mind that the object ID's used are so unused its just insanely unlikely the end user would use those prefixes at all. If they did, its likely the user also would know how to manually fix it...

nestharus commented 10 years ago

Well, I'm going to be doing that Lua thing I mentioned, and if you don't adapt your script to use it, I'll write my own Network thing, lol. And yea, your computer will be able to use it >.>.

Arhowk commented 10 years ago

Okay? I just want catalog fixed.

nestharus commented 10 years ago

Catalog's not broken. I just ran your code and it didn't bug for me. You got different output from what I got. You got a 1, I got a 1 and a 28. The 28 was the count, and it happened to be correct.

Here is the additional code I ran.

function print takes string msg returns nothing
    call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60000, msg)
endfunction

/********************************************************************************************
                                Hero Catalog
********************************************************************************************/
    struct ItemRoots extends array
        private static LevelGroupVersionCatalog catalog

        //Versions
        static constant integer v03G = 1
        static constant integer v03H = 2
        //Group Id
        static constant integer gA = 1 //all
        static constant integer gZA = 2
        static constant integer gWR = 3
        static constant integer gAm = 4
        static constant integer gZ = 5
        static constant integer gW = 6
        static constant integer gAn = 7
        static constant integer gR = 8

        static constant integer amazon = 'H006'
        static constant integer zealot = 'H003'
        static constant integer witch = 'H013'
        static constant integer anarchist = 'H010'
        static constant integer runemaster = 'H005'

        static integer curGroup

        public static method test takes nothing returns nothing
            local LevelGroupVersionCatalog catalog = LevelGroupVersionCatalog.create()
            local Catalog t
            call catalog.add(1010,1,gA, 1)
            set t = catalog.get(1, gA,1, 1)
            if t.id(1010) != 1 then
                call print("return false")
            else
                call print("return true")   //desired
            endif
            set catalog = LevelGroupVersionCatalog.create()
            call catalog.add(15,1,gA, 1)
            call catalog.add(1010,2,gA, 1)
            set t = catalog.get(1, gA,1, 1)
            if t.id(1010) != 1 then
                call print("return false")  //desired
            else
                call print("return true")
            endif
            set catalog = LevelGroupVersionCatalog.create()
            call catalog.add(1010,1,gA, 1)
            call catalog.add(1011,2,gA, 1)
            set t = catalog.get(2, gA,1, 1)
            if t.id(1010) != 1 then
                call print("return false")
            else
                call print("return true")   //desired
            endif
            set catalog = LevelGroupVersionCatalog.create()
            call catalog.add(1010,2,gA, 1)
            set t = catalog.get(2, gA,1, 1)
            if t.id(1010) != 1 then
                call print("return false")
            else
                call print("return true")   //desired
            endif

            call print("---------------------------------------------------------------------")
        endmethod

        public static method get takes integer id, integer vers returns Catalog
            //call test()
            //call print("version : " + I2S(vers) + " : " + I2S(v03H))
            //call test()
            //call print("testing get")
            if id == amazon then
                return catalog.get(vers,gAm,0,1)
            elseif id == zealot then
                return catalog.get(vers,gZ,0,1)
            elseif id == witch then
                return catalog.get(vers,gW,0,1)
            elseif id == anarchist then
                return catalog.get(vers,gAn,0,1)
            elseif id == runemaster then
                return catalog.get(vers,gR,0,1)
            else
                call print("illegal ID : " + GetObjectName(id))
                return 1/0
            endif
        endmethod
        private static method init takes nothing returns nothing
            set catalog = LevelGroupVersionCatalog.create()

            //All
              //Rings
                call catalog.add('I00S', v03G, gA, 1)
                call catalog.add('I016', v03G, gA, 1)
                call catalog.add('I01E', v03G, gA, 1)
                call catalog.add('I00W', v03G, gA, 1)
               // call catalog.add('I02A', v03H, gA, 1)
              //Armors
                call catalog.add('I004', v03G, gA, 1)
                call catalog.add('I00X', v03G, gA, 1)
                call catalog.add('I01F', v03G, gA, 1)
                call catalog.add('I015', v03G, gA, 1)
              //Helms
                call catalog.add('I00J', v03G, gA, 1)
                call catalog.add('I013', v03G, gA, 1)
                call catalog.add('I01C', v03G, gA, 1)
                call catalog.add('I01L', v03G, gA, 1)
              //Boots
                call catalog.add('I00K', v03G, gA, 1)
                call catalog.add('I010', v03G, gA, 1)
                call catalog.add('I019', v03G, gA, 1)
                call catalog.add('I01I', v03G, gA, 1)
              //Gloves
                call catalog.add('I00H', v03G, gA, 1)
                call catalog.add('I011', v03G, gA, 1)
                call catalog.add('I018', v03G, gA, 1)
                call catalog.add('I01K', v03G, gA, 1)
              //Amulets

            //Zealot and Anarchist
              //Swords
                call catalog.add('I002', v03G, gZA, 1)
                call catalog.add('I00Y', v03G, gZA, 1)
                call catalog.add('I017', v03G, gZA, 1)
                call catalog.add('I01G', v03G, gZA, 1)
            //Witch and Runemaster
              //Staves
                call catalog.add('I00O', v03G, gWR, 1)
                call catalog.add('I00V', v03G, gWR, 1)
                call catalog.add('I01D', v03G, gWR, 1)
                call catalog.add('I014', v03G, gWR, 1)
            //Amazon
              //Bows
                call catalog.add('I00G', v03G, gAm, 1)
                call catalog.add('I012', v03G, gAm, 1)
                call catalog.add('I01A', v03G, gAm, 1)
                call catalog.add('I01J', v03G, gAm, 1)
              //Quivers
                call catalog.add('I00F', v03G, gAm, 1)
                call catalog.add('I00Z', v03G, gAm, 1)
                call catalog.add('I018', v03G, gAm, 1)
                call catalog.add('I01H', v03G, gAm, 1)

              //Charms

            call catalog.addGroup(v03G, gAm, gA)    
            call catalog.addGroup(v03G, gZ, gA)
            call catalog.addGroup(v03G, gR, gA)
            call catalog.addGroup(v03G, gAn, gA)
            call catalog.addGroup(v03G, gW, gA)

            call catalog.addGroup(v03G, gZ, gZA)
            call catalog.addGroup(v03G, gAn, gZA)
            call catalog.addGroup(v03G, gW, gWR)
            call catalog.addGroup(v03G, gR, gWR)
        endmethod

        private static method testz takes nothing returns nothing
            call print(I2S(get(amazon, v03H).count))
            call print(I2S(get(amazon, v03H).count))
            call print(I2S(get(amazon, v03H).count))
        endmethod

        private static method onInit takes nothing returns nothing
            call TimerStart(CreateTimer(), 0, false, function thistype.init)
            call TimerStart(CreateTimer(), 1, true, function thistype.test)
            call TimerStart(CreateTimer(), 1, true, function thistype.testz)
        endmethod

        //Saving
            //Heroes['id00'].id
            //Heroes[GetUnitTypeId(hero)].id
            //call stack.push(Heroes[GetUnitTypeId(hero)].id,Heroes.count)

        //Loading
            //CreateUnit(Heroes[unitIdFromCode].raw,0,1)
            //call CreateUnit(Heroes[stack.pop(Heroes.count)].raw,0,0)
    endstruct

_edit_ i'm getting something different though. The id/raw is returning 0 for some reason.

nestharus commented 10 years ago

now I'm getting 4 instead of 28. O_o

your variable names make this VERY difficult to figure out what you're doing... I can't make sense of any of it.

_edit_ solved the bug for version skipping (I was putting in version 4, skipping from 1 to 4, and then loading up version 2, which had nothing in it, which was the cause of my strange values). As for your bug of infinite loop, I'm not getting that, so I can't help you, lol. Your very code for me isn't buggy. No idea how you are bugging it. It must be something on your end.

nestharus commented 10 years ago

Ok, I updated the stuff. Now it works well with space between versions.

At this point, I get absolutely 0 bugs when running either your code or mine. Before, I got 0 bugs with your code, but 1 bug with mine (incorrect counts due to me accessing version 3, then version 2).

Update the filter you are using. That's the only code I changed. Catalog is unchanged.