martinbwg / Pixel-Tanks

1 stars 3 forks source link

(Help Needed) Lag Update #547

Closed cs6413110 closed 6 months ago

cs6413110 commented 6 months ago

As we all know there are massive bugs with the game. I need help debugging them.

1.) Partial Tank loading This is where a full-load of a tank doesn't happen and so your client is missing information and the gui breaks.

2.) Grapple/Override bug

Post anything you find. Still trying to figure all of these out.

cs6413110 commented 6 months ago

No, because a.) bullet follow the same system and b.) that's an extremely lazy and sloppy solution that could have future issues.

3foe commented 6 months ago

ill learn to code, starting rn. nobody says I do nothing never again, also read the flat issue I basically /screamed you guys

3foe commented 6 months ago

disclaimer (will only make sense after u read the comment on flat) I will not help until the things that I need are satisfied

CelestialKnight7 commented 6 months ago

we don't want ur help. like at all. also go spam on a different issue

3foe commented 6 months ago

Didn't ask, like dident even ask a question, I was here in tanks first and am the sole reason why it still exists, who asked for you help. I know I didn't

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: CelestialKnight7 @.> Sent: Tuesday, May 7, 2024 2:03:27 PM To: cs6413110/Pixel-Tanks @.> Cc: 3foe @.>; Comment @.> Subject: Re: [cs6413110/Pixel-Tanks] [Help Needed] Lag Update (Issue #547)

we don't want ur help. like at all. also go spam on a different issue

— Reply to this email directly, view it on GitHubhttps://github.com/cs6413110/Pixel-Tanks/issues/547#issuecomment-2099306058, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6K4FFCDS7X7SKQKPZ5APLDZBE6R7AVCNFSM6AAAAABHLUPZZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJZGMYDMMBVHA. You are receiving this because you commented.Message ID: @.***>

3foe commented 6 months ago

aaron asked for help i will help him, unless you don't want me doing something you cant steal credit for , there is no reason to not want me to learn how to code

3foe commented 6 months ago

bradley there you go that is a fact that you and even have ignored for all to long

cs6413110 commented 6 months ago

Debug logs:

{"u":[[0.6391791,"rank",20,"username","a","cosmetic","gold helment","cosmetic_hat","gold horns","cosmetic_body","gold wings","color","#ffbd1b","damage",false,"maxHp",500,"hp",0,"shields",0,"team","a:0.6391791","x",124,"y",140,"r",146.84885395374135,"ded",true,"reflect",null,"pushback",0,"baseRotation",135,"baseFrame",1,"fire",{"time":0},"damage",false,"animation",null,"buff",null,"invis",false,"class","builder","flashbanged",null,"dedEffect",{"x":1400,"y":1400,"r":0,"id":"banhammer","start":1715177774588,"time":25668}],[1.4526805,"x",0,"y",0,"type","void","team",":"],[1.1722173,"x",100,"y",0,"type","void","team",":"],[1.7033396,"x",200,"y",0,"type","void","team",":"],[1.1234882,"x",300,"y",0,"type","void","team",":"],[1.9822101,"x",400,"y",0,"type","void","team",":"],[1.8072827,"x",500,"y",0,"type","void","team",":"],[1.2244646,"x",600,"y",0,"type","void","team",":"],[1.1212855,"x",700,"y",0,"type","void","team",":"],[1.1337199,"x",800,"y",0,"type","void","team",":"],[1.8612625,"x",900,"y",0,"type","void","team",":"],[1.9966876,"x",1000,"y",0,"type","void","team",":"],[1.9957344,"x",1100,"y",0,"type","void","team",":"],[1.7030396,"x",0,"y",100,"type","void","team",":"],[1.87685,"x",100,"y",100,"type","void","team",":"],[0.6391791,"rank",20,"username","a","cosmetic","gold helment","cosmetic_hat","gold horns","cosmetic_body","gold wings","color","#ffbd1b","damage",false,"maxHp",500,"hp",0,"shields",0,"team","a:0.6391791","x",124,"y",140,"r",146.84885395374135,"ded",true,"reflect",null,"pushback",0,"baseRotation",135,"baseFrame",1,"fire",{"time":0},"damage",false,"animation",null,"buff",null,"invis",false,"class","builder","flashbanged",null,"dedEffect",{"x":1400,"y":1400,"r":0,"id":"banhammer","start":1715177774588,"time":25668}],[1.9112074,"x",200,"y",100,"type","void","team",":"],[0.6391791,"rank",20,"username","a","cosmetic","gold helment","cosmetic_hat","gold horns","cosmetic_body","gold wings","color","#ffbd1b","damage",false,"maxHp",500,"hp",0,"shields",0,"team","a:0.6391791","x",124,"y",140,"r",146.84885395374135,"ded",true,"reflect",null,"pushback",0,"baseRotation",135,"baseFrame",1,"fire",{"time":0},"damage",false,"animation",null,"buff",null,"invis",false,"class","builder","flashbanged",null,"dedEffect",{"x":1400,"y":1400,"r":0,"id":"banhammer","start":1715177774588,"time":25668}],[1.8104853,"x",300,"y",100,"type","void","team",":"],[1.2265356,"x",400,"y",100,"type","void","team",":"],[2.927344,"team","cs641311:BLUE","r",140.21651905123252,"type","dynamite","x",712.5047875755359,"y",199.4486758809872,"sx",721.8025489370559,"sy",188.45269326622162],[1.6320325,"x",0,"y",200,"type","void","team",":"],[1.0245551,"x",100,"y",200,"type","void","team",":"],[0.6391791,"rank",20,"username","a","cosmetic","gold helment","cosmetic_hat","gold horns","cosmetic_body","gold wings","color","#ffbd1b","damage",false,"maxHp",500,"hp",0,"shields",0,"team","a:0.6391791","x",124,"y",140,"r",146.84885395374135,"ded",true,"reflect",null,"pushback",0,"baseRotation",135,"baseFrame",1,"fire",{"time":0},"damage",false,"animation",null,"buff",null,"invis",false,"class","builder","flashbanged",null,"dedEffect",{"x":1400,"y":1400,"r":0,"id":"banhammer","start":1715177774588,"time":25668}],[1.5753458,"x",200,"y",200,"type","void","team",":"],[0.6391791,"rank",20,"username","a","cosmetic","gold helment","cosmetic_hat","gold horns","cosmetic_body","gold wings","color","#ffbd1b","damage",false,"maxHp",500,"hp",0,"shields",0,"team","a:0.6391791","x",124,"y",140,"r",146.84885395374135,"ded",true,"reflect",null,"pushback",0,"baseRotation",135,"baseFrame",1,"fire",{"time":0},"damage",false,"animation",null,"buff",null,"invis",false,"class","builder","flashbanged",null,"dedEffect",{"x":1400,"y":1400,"r":0,"id":"banhammer","start":1715177774588,"time":25668}],[1.4960577,"x",700,"y",200,"type","barrier","team",":"],[2.927344,"team","cs641311:BLUE","r",140.21651905123252,"type","dynamite","x",712.5047875755359,"y",199.4486758809872,"sx",721.8025489370559,"sy",188.45269326622162],[1.5998956,"x",0,"y",300,"type","void","team",":"],[1.2526185,"x",100,"y",300,"type","void","team",":"],[1.4424151,"x",700,"y",300,"type","barrier","team",":"],[1.3546501,"x",800,"y",300,"type","barrier","team",":"],[1.0427762,"x",1100,"y",300,"type","barrier","team",":"],[1.240437,"x",0,"y",400,"type","void","team",":"],[1.8321289,"x",100,"y",400,"type","void","team",":"],[1.8070626,"x",500,"y",400,"type","weak","team",":","maxHp",100,"hp",100],[1.7354538,"x",800,"y",400,"type","barrier","team",":"],[1.4206642,"x",1100,"y",400,"type","barrier","team",":"],[1.124,"x",0,"y",500,"type","void","team",":"],[1.7784346,"x",400,"y",500,"type","weak","team",":","maxHp",100,"hp",100],[1.1436303,"x",500,"y",500,"type","weak","team",":","maxHp",100,"hp",100],[1.0543905,"x",800,"y",500,"type","barrier","team",":"],[1.4930455,"x",1000,"y",500,"type","strong","team",":","maxHp",200,"hp",84.00000000000001],[1.9188204,"x",1100,"y",500,"type","barrier","team",":"],[1.209164,"x",0,"y",600,"type","void","team",":"],[1.8647191,"x",700,"y",600,"type","barrier","team",":"],[1.0522079,"x",800,"y",600,"type","barrier","team",":"],[1.594224,"x",1100,"y",600,"type","barrier","team",":"],[1.530555,"x",0,"y",700,"type","void","team",":"],[1.1177371,"x",200,"y",700,"type","barrier","team",":"],[1.9731373,"x",300,"y",700,"type","barrier","team",":"],[1.0564014,"x",600,"y",700,"type","barrier","team",":"],[1.3401234,"x",700,"y",700,"type","barrier","team",":"],[1.7459901,"x",1100,"y",700,"type","barrier","team",":"],[1.4350291,"x",0,"y",800,"type","void","team",":"],[1.0237608,"x",222,"y",852,"type","strong","team","LostKing:0.6921257","maxHp",200,"hp",120],[1.9476349,"x",300,"y",800,"type","barrier","team",":"],[1.0237608,"x",222,"y",852,"type","strong","team","LostKing:0.6921257","maxHp",200,"hp",120],[1.4806659,"x",400,"y",800,"type","barrier","team",":"],[1.9168773,"x",500,"y",800,"type","barrier","team",":"],[1.9579095,"x",600,"y",800,"type","barrier","team",":"]],"d":[1.1947223,1.3793178,1.7687728,1.7725106,1.105766,1.1403101,1.4386071,1.969405,1.9450406,1.7663866,1.8909346,1.0252794,1.0276347,1.4698461,1.5681439,1.9930787,1.5534236,1.4165936,1.4683974,1.9181924,1.4288866,1.8799348,1.7567235,1.0342163,1.8194126,1.1518635,1.1025025,1.2824461,1.0416882,1.0557231,1.2110649,1.3005164,1.217716,1.6668996,1.7857072,1.7294033,1.6491028,1.3335586,1.7755456,1.5234675,1.0909009,1.7376286,1.5799202,1.1177465,1.304914,1.4369356,1.7380742,1.481663,1.0948863,1.2364651,1.6988964,1.1260215,1.9265409,1.6247184,1.9802567,1.0335855,1.2329168,1.41074,1.713598,1.6779079,1.6486273,1.1394677,1.6281317,1.7859637,1.7459817,1.1237844,1.4874456,1.9082876,1.6911383,1.2767403,1.0281638,1.2392156,1.9388245,1.1359933,1.8465809,1.2690577,1.7353672,1.3210259,1.0331471,1.7976287,1.5529297,1.405844,1.6586731,1.6629199,1.8246502,1.1706817,1.5680062,1.843808,1.3788067,1.310007,1.8242043,1.9475068,1.3523647,1.909938,1.7374157,1.5196115,1.6796901,1.4942728,1.4231843,1.139993,1.276772,1.4277206,1.1488645,1.7860965,1.2734646,1.5010413,1.8585057,1.9216381,1.43098,1.4005437,1.9416699,1.7304798,1.4795385,1.8410581,1.376673,1.5967022,1.2367225,1.5025293,1.3927613,1.996923,1.2163532,1.5379932,1.0818616,1.4624185,1.828099,1.420574,1.0980478,1.7925306,1.0374645,1.4960441,0.3313786,0.3313786,1.3659927],"event":"update","logs":[]}
cs6413110 commented 6 months ago

:(

cs6413110 commented 6 months ago

this is lag update forum pls stop with ur pvp

3foe commented 6 months ago

im done with pvp when i get admin and collaborator, bradley is the only one critting out people, he is on the offense. ill talk to aaron later bout this.

DarkMemeGod411 commented 6 months ago

no no no no hate for ANYONE (except alex he deserves it)

Sir, I know u hate me but stop throwing shade on github

cs6413110 commented 6 months ago

Relevant code for debugging purposes: Entity updating:

updateEntity(e, x, y, w, h, ox, oy, c) {
    let update = this.updates.find(u => u[4] === e.id);
    if (!update) {
      update = A.template('arr').concat(x, y, w, h, e.id);
      this.updates.push(update);
    }
    for (const p of c) {
      const i = update.indexOf(p), value = isNaN(e[p]) ? e[p] : Math.round(e[p]*10)/10;
      if (i >= 5) update[i+1] = value; else update.push(p, value);
    }
    for (const t of this.pt) {
      let tx = t.x-1010, ty = t.y-710, o = Engine.collision(ox, oy, w, h, tx, ty, 2100, 1500), n = Engine.collision(x, y, w, h, tx, ty, 2100, 1500);
      if (!o && n) {
        let i = t.msg.d.indexOf(e.id);
        if (i !== -1) t.msg.d.splice(i, 1);
        t.msg.u.push(this.loadEntity(e));
      } else if (o && !n) {
        let i = t.msg.u.findIndex(u => u[0] === e.id);
        if (i !== -1) t.msg.u.splice(i, 1);
        t.msg.d.push(e.id);
      }
    }
  }

Chunkloading:

chunkload(t, ox, oy, x, y) {
    const w = 21, h = 15, m = o => Math.max(0, Math.min(29, o)), m2 = o => Math.max(-1, Math.min(30, o));
    const ocx = Math.floor((ox+40)/100)+.5, ocy = Math.floor((oy+40)/100)+.5, ncx = Math.floor((x+40)/100)+.5, ncy = Math.floor((y+40)/100)+.5;
    const xd = ocx-ncx, yd = ocy-ncy, yda = yd < 0 ? -1 : 1, xda = xd < 0 ? -1 : 1, yl = Math.min(h, Math.abs(yd))*yda;
    for (let nys = (yda > 0 ? 0 : -1)+ncy-h/2*yda, y = m(nys), l = false; (yda > 0 ? (y < m2(nys+h*yda)) : (y > m2(nys+h*yda))); y += yda) {
      if (yda < 0 ? y <= nys+yl : y >= nys+yl) l = true;
      for (let nxs = (xda > 0 ? 0 : -1)+ncx-w/2*xda, x = m(nxs); (xda > 0 ? (x < m2(nxs+(l ? Math.min(w, Math.abs(xd)) : w)*xda)) : (x > m2(nxs+(l ? Math.min(w, Math.abs(xd)) : w)*xda))); x += xda) {
        for (const e of this.cells[x][y]) {
          let i = t.msg.d.indexOf(e.id);
          if (i !== -1) t.msg.d.splice(i, 1);
          t.msg.u.push(this.loadEntity(e));
        }
      }
    }
    for (let oys = (yda > 0 ? -1 : 0)+ocy+h/2*yda, y = m(oys), l = false; (yda < 0 ? (y < m2(oys-h*yda)) : (y > m2(oys-h*yda))); y -= yda) {
      if (yda > 0 ? y <= oys-yl : y >= oys-yl) l = true;
      for (let oxs = (xda > 0 ? -1 : 0)+ocx+w/2*xda, x = m(oxs); (xda < 0 ? (x < m2(oxs-(l ? Math.min(w, Math.abs(xd)) : w)*xda)) : (x > m2(oxs-(l ? Math.min(w, Math.abs(xd)) : w)*xda))); x -= xda) {
        for (const e of this.cells[x][y]) {
          let i = t.msg.u.findIndex(u => u[0] === e.id);
          if (i !== -1) t.msg.u.splice(i, 1);
          t.msg.d.push(e.id);
        }
      }
    }
  }

Compiling/Sending the data:

 eventSend() {
    for (const t of this.pt) {
      t.msg.logs = this.logs.slice(t.logs).concat(t.privateLogs);
      t.logs = this.logs.length;
      t.privateLogs.length = 0;
      if (t.global !== this.global) t.global = t.msg.global = this.global;
      for (const d of this.deletions) {
        if (Engine.collision(d[0], d[1], d[2], d[3], t.x-1010, t.y-710, 2100, 1500)) {
          if (!t.msg.d.includes(d[4])) t.msg.d.push(d[4]);
        }
      }
      for (const u of this.updates) {
        if (!t.msg.d.includes(u[4]) && Engine.collision(u[0], u[1], u[2], u[3], t.x-1010, t.y-710, 2100, 1500)) {
          let i = t.msg.u.indexOf(e => e[0] === u[4]);
          if (i >= 0) t.msg.u[i].push(...u.slice(5)); else t.msg.u.push(u.slice(4));
        }
      }
      if ((t.msg.logs.length || t.msg.u.length || t.msg.d.length || t.msg.global)) {
        if (/*(!t.lastSend || (Date.now()-t.lastSend >= 1000/settings.ups)) && */!t.busy) {
          t.busy = true;
          t.socket._send(pack(t.msg), {}, () => (t.busy = false));
          t.lastSend = Date.now();
          t.msg.u.length = t.msg.d.length = 0;
          t.msg.global = t.msg.logs = undefined;
        }
      }
    }
    this.updates.length = this.deletions.length = 0;
  }
3foe commented 6 months ago

jonas i think its time to start forgiving or at least start trying to forgive alex

alex its time for you to do something that makes it possible for jonas to forgive you hint hint nudge nudge its his b day today, maybe a certain sword(I will give u filiment to run the program)

cs6413110 commented 6 months ago

Here is the code for loading and unloading things that move out of your render distance: *added comments for explaination

updateEntity(e, x, y, w, h, ox, oy, c) {
    // e is entity(has id)
    // x, y, w, and h, are coords and size of entity
   // ox and oy are old position of the entity
  // c is a list of the values that changed
    let update = this.updates.find(u => u[4] === e.id);
    if (!update) {
      update = A.template('arr').concat(x, y, w, h, e.id);
      this.updates.push(update);
    }
    for (const p of c) {
      const i = update.indexOf(p), value = isNaN(e[p]) ? e[p] : Math.round(e[p]*10)/10;
      if (i >= 5) update[i+1] = value; else update.push(p, value);
    }
    // previous code pushes updates to the main thread
    // The following code does the actual unloading/loading

    for (const t of this.pt) { // for each player
      let tx = t.x-1010, ty = t.y-710, o = Engine.collision(ox, oy, w, h, tx, ty, 2100, 1500), n = Engine.collision(x, y, w, h, tx, ty, 2100, 1500); 
      // o is if the entity used to be within render distance of the player
     // n is if the entity is currently within render distance of the player
      if (!o && n) { // if an entity moved into render distance
        let i = t.msg.d.indexOf(e.id);
        if (i !== -1) t.msg.d.splice(i, 1); // remove that entity from deletion if necessary
        t.msg.u.push(this.loadEntity(e)); // push a full load of that entity
      } else if (o && !n) { // if entity moved out of render distance
        let i = t.msg.u.findIndex(u => u[0] === e.id);
        if (i !== -1) t.msg.u.splice(i, 1); // remove it from updates
        t.msg.d.push(e.id); // add it to deletion
      }
    }
  }
cs6413110 commented 6 months ago

Screenshot 2024-05-08 11 13 29 AM Screenshot 2024-05-08 11 14 29 AM

cs6413110 commented 6 months ago

Ok spotted both bugs. Working on solutions

cs6413110 commented 6 months ago

after I fix lag update :)

CelestialKnight7 commented 6 months ago

game keeps freezing repeatedly halp

cs6413110 commented 6 months ago

Uh idk

DarkMemeGod411 commented 6 months ago

were doomed, for the first time ever Aaron doesn't know how to fix.

CelestialKnight7 commented 6 months ago

been fixed mission complete well done

3foe commented 6 months ago

laff there is a secret technique a technique I haven't used since the days of the oldern quangle tank: the forbidden fix

CHEEZE ITS FOR FIX

3foe commented 6 months ago

Screenshot 2024-05-09 12 32 23 PM

cs6413110 commented 6 months ago

Like uh, idk? Probably bad chromebooks. Also I havent seen this at all.