|
Mostrar Temas
|
Páginas: [1]
|
1
|
Programación / Programación General / Como mejorar esta función
|
en: 23 Diciembre 2016, 03:46 am
|
Tengo un juego basado en agar.io y quiero mejorar está función de modo que el juego vaya más rapido , alguien que de verdad sepa puede hacerlo ? function updateNodes(view, offset) { timestamp = +new Date; var code = Math.random(); ua = false; var queueLength = view.getUint16(offset, true); offset += 2; for (i = 0; i < queueLength; ++i) { var killer = nodes[view.getUint32(offset, true)], killedNode = nodes[view.getUint32(offset + 4, true)]; offset += 8; if (killer && killedNode) { killedNode.destroy(); killedNode.ox = killedNode.x; killedNode.oy = killedNode.y; killedNode.oSize = killedNode.size; killedNode.nx = killer.x; killedNode.ny = killer.y; killedNode.nSize = killedNode.size; killedNode.updateTime = timestamp; } } for (var i = 0;;) { var nodeid = view.getUint32(offset, true); offset += 4; if (0 == nodeid) break; ++i; var size, posY, posX = view.getInt32(offset, true); offset += 4; posY = view.getInt32(offset, true); offset += 4; size = view.getInt16(offset, true); offset += 2; for (var r = view.getUint8(offset++), g = view.getUint8(offset++), b = view.getUint8(offset++), color = (r << 16 | g << 8 | b).toString(16); 6 > color.length;) color = "0" + color; var colorstr = "#" + color, flags = view.getUint8(offset++), flagVirus = !!(flags & 0x01), flagEjected = !!(flags & 0x20), flagAgitated = !!(flags & 0x10), _skin = ""; flags & 2 && (offset += 4); if (flags & 4) { for (;;) { // skin name t = view.getUint8(offset, true) & 0x7F; offset += 1; if (0 == t) break; _skin += String.fromCharCode(t); } } for (var char, name = "";;) { // nick name char = view.getUint16(offset, true); offset += 2; if (0 == char) break; name += String.fromCharCode(char); } var node = null; if (nodes.hasOwnProperty(nodeid)) { node = nodes[nodeid]; node.updatePos(); node.ox = node.x; node.oy = node.y; node.oSize = node.size; node.color = colorstr; } else { node = new Cell(nodeid, posX, posY, size, colorstr, name, _skin); nodelist.push(node); nodes[nodeid] = node; node.ka = posX; node.la = posY; } node.isVirus = flagVirus; node.isEjected = flagEjected; node.isAgitated = flagAgitated; node.nx = posX; node.ny = posY; node.setSize(size); node.updateCode = code; node.updateTime = timestamp; node.flag = flags; name && node.setName(name); if (-1 != nodesOnScreen.indexOf(nodeid) && -1 == playerCells.indexOf(node)) { document.getElementById("overlays").style.display = "none"; playerCells.push(node); if (1 == playerCells.length) { nodeX = node.x; nodeY = node.y; } } } queueLength = view.getUint32(offset, true); offset += 4; for (i = 0; i < queueLength; i++) { var nodeId = view.getUint32(offset, true); offset += 4; node = nodes[nodeId]; null != node && node.destroy(); } ua && 0 == playerCells.length && showOverlays(false) }
[/i] ARCHIVO COMPLETO POR SI DESEAS VERLO: http://ogar.pw/assets/js/main_out.js
|
|
|
2
|
Programación / Programación General / Error with javascript code
|
en: 31 Julio 2016, 16:20 pm
|
i have a my own game , They have given me a map for the game but the draw of .js exits of minimap.png see the photo https://cloud.githubusercontent.com/assets/20700185/17277044/aad9c740-5707-11e6-952a-dffe9f15f366.pngsee the map.. code: !function(){function i(i,t){var n=u("<div>").attr("id","mini-map-token-"+ i).css({position:"absolute",width:"5%",height:"5%",background:t,top:"0%",left:"0%"});return n} function t(i,t){void 0===window.mini_map_tokens &&(window.mini_map.append(t),window.mini_map_tokens=t)} function n(i){void 0!==window.mini_map_tokens&&(window.mini_map_tokens.detach(),delete window.mini_map_tokens)} function e(i){return void 0!==window.mini_map_tokens} function o(i,t,n){return void 0!==window.mini_map_tokens?(window.mini_map_tokens.css("left",t/26e3*104+"%").css("top",n/26e3*104+"%"),!0):!1} function s(i,t){window.mini_map_pos.text("x: "+ i.toFixed(0)+" / y: "+ t.toFixed(0))} function a(){var i=window.jQuery;if(window.mini_map_tokens={},0===i("#mini-map-pos").length&&(window.mini_map_pos=i("<div>").attr("id","mini-map-pos").css({top:50,left:10,color:"white",background:"rgba(155, 155, 155, 0.6)",fontSize:14,fontWeight:800,position:"fixed",padding:"0px 10px"}).appendTo(document.body)),0===i("#mini-map-wrapper").length){var t=i("<div>").attr("id","mini-map-wrapper").css({position:"fixed",top:"80px",left:"10px",width:"150px",height:"150px",background:"url('img/mini.png')"}),n=i("<div>").attr("id","mini-map").css({width:"100%",height:"100%",position:"relative"});t.append(n).appendTo(document.body),window.mini_map=n}} function r(i,t,n,e,o,s){m=this,this.id=i,this.ox=this.x=t,this.oy=this.y=n,this.oSize=this.size=e,this.color=o,this.points=[],this.pointsAcc=[],this.setName(s)} function d(i,t,n){Object.defineProperty(i,n,{get:function(){return t[n]},set:function(i){t[n]=i},enumerable:!0,configurable:!0})} function p(i,t){var n=+new Date,e=Math.random(),o=t,s=i.getUint16(o,!0);o+=2;for(var a=0;s>a;++a){var d=m[i.getUint32(o,!0)],p=m[i.getUint32(o+ 4,!0)],o=o+ 8;d&&p&&(p.destroy(),p.ox=p.x,p.oy=p.y,p.oSize=p.size,p.nx=d.x,p.ny=d.y,p.nSize=p.size,p.updateTime=n)} for(a=0;{var c=i.getUint32(o,!0);if(o+=4,0==c)break;++a;var d=i.getInt16(o,!0),o=o+ 2,p=i.getInt16(o,!0),o=o+ 2;g=i.getInt16(o,!0),o+=2;for(var h=i.getUint8(o++),u=i.getUint8(o++),l=i.getUint8(o++),h=(h<<16|u<<8|l).toString(16);6>h.length;)h="0"+ h;var h="#"+ h,w=i.getUint8(o++),u=!!(1&w),l=!!(16&w);2&w&&(o+=4),4&w&&(o+=8),8&w&&(o+=16);for(var f,w="";f=i.getUint16(o,!0),o+=2,0!=f;)w+=String.fromCharCode(f);f=w,w=null,m.hasOwnProperty(c)?(w=m[c],w.updatePos(),w.ox=w.x,w.oy=w.y,w.oSize=w.size,w.color=h):(w=new r(c,d,p,g,h,f),w.pX=d,w.pY=p),w.isVirus=u,w.isAgitated=l,w.nx=d,w.ny=p,w.nSize=g,w.updateCode=e,w.updateTime=n,f&&w.setName(f)} for(e=i.getUint32(o,!0),o+=4,a=0;e>a;a++)c=i.getUint32(o,!0),o+=4,w=m[c],null!=w&&w.destroy()} function c(i){var t=0,n=new DataView(i.data);switch(240==n.getUint8(t)&&(t+=5),n.getUint8(t++)){case 16:p(n,t);break;case 20:l=[];break;case 32:var e=n.getUint32(t,!0);l.push(e)}} var h=window.WebSocket,u=window.jQuery,m=[],l=[];r.prototype={id:0,points:null,pointsAcc:null,name:null,nameCache:null,sizeCache:null,x:0,y:0,size:0,ox:0,oy:0,oSize:0,nx:0,ny:0,nSize:0,updateTime:0,updateCode:0,drawTime:0,destroyed:!1,isVirus:!1,isAgitated:!1,wasSimpleDrawing:!0,destroy:function(){delete m[this.id],id=l.indexOf(this.id),-1!=id&&l.splice(id,1),this.destroyed=!0,n(this.id)},setName:function(i){this.name=i},updatePos:function(){-1!=l.indexOf(this.id)&&(e(this.id)||t(this.id,i(this.id,this.color)),o(this.id,this.nx,this.ny),s(this.nx,this.ny))}},window.WebSocket=function(i,t){void 0===t&&(t=[]);var n=new h(i,t);d(this,n,"binaryType"),d(this,n,"bufferedAmount"),d(this,n,"extensions"),d(this,n,"protocol"),d(this,n,"readyState"),d(this,n,"url"),this.send=function(i){return n.send.call(n,i)},this.close=function(i,t){return n.close.call(n,i,t)},this.onopen=function(){},this.onclose=function(){},this.onerror=function(){},this.onmessage=function(){},n.onopen=function(i){if(this.onopen!=null){return this.onopen.call(n,i)}}.bind(this),n.onmessage=function(i){if(this.onmessage!=null){return c(i),this.onmessage.call(n,i)}}.bind(this),n.onclose=function(i){return this.onclose.call(n,i)}.bind(this),n.onerror=function(i){return this.onerror.call(n,i)}.bind(this)},window.WebSocket.prototype=h,a()}();
|
|
|
3
|
Programación / Programación General / Alguien que sepa de javascript, que me ayude
|
en: 9 Julio 2016, 18:53 pm
|
Hola ForoElHacker , veo que aqui saben mucho y bueno tengo una duda , yo tengo un juego que es similar a agar.io. En agar.io puedes definir la calidad de juego en un <select> que dice
graphics : - high - normal - medium - low - extra low y bueno yo nosé como hacer eso , creo que es javascript , si alguien supiera y me ayudaria se lo agradeceria , en otro agar ya lo tienen y tienen esto miren:
select style="width: 62%; margin-left: 20%; display: none;" id="resolution" class="form-control" onchange="setCookie('lulzyserver_graphics', this.value, 365); setQuality($('#resolution').val());"> <option disabled value="">-- Graphics Quality --</option> <option selected value="1">Graphics: NORMAL</option> <option value="0.8">Graphics: MEDIUM</option> <option value="0.65">Graphics: LOW</option> <option value="0.5">Graphics: VERY LOW</option> </select
PERO ESE ES EL CODIGO HTML , NOSE NADA DEL CODIGO javascript , que esta ofuscado..
|
|
|
4
|
Programación / Scripting / descifrar CODIGO
|
en: 6 Julio 2016, 23:50 pm
|
Hola me gustaria descifrar lo siguiente: ;var serverip=$(_0x1ce8[1])_0x1ce8[0];function checkServer(){var _0xf6b7x3;var _0xf6b7x4=$(_0x1ce8[1])_0x1ce8[0];switch(_0xf6b7x4){case _0x1ce8[3]:_0xf6b7x3= _0x1ce8[2];break;case _0x1ce8[5]:_0xf6b7x3= _0x1ce8[4];break;case _0x1ce8[7]:_0xf6b7x3= _0x1ce8[6];break;case _0x1ce8[9]:_0xf6b7x3= _0x1ce8[8];break;default:_0xf6b7x3= _0x1ce8[10]};$(_0x1ce8[12])_0x1ce8[11]}setInterval(checkServer,2000);function pingServer(){ping(serverip_0x1ce8[27])_0x1ce8[26]_0x1ce8[15]}setInterval(pingServer,2000);function serverPlayers(){var _0xf6b7x9;var serverip=$(_0x1ce8[1])_0x1ce8[0];switch(serverip){case _0x1ce8[3]:_0xf6b7x9= _0x1ce8[28];break;case _0x1ce8[5]:_0xf6b7x9= _0x1ce8[29];break;case _0x1ce8[7]:_0xf6b7x9= _0x1ce8[30];break;case _0x1ce8[9]:_0xf6b7x9= _0x1ce8[31];break;default:_0xf6b7x9= _0x1ce8[10]};$_0x1ce8[37]}setInterval(serverPlayers,1000);function serverPlayersButtons(){$_0x1ce8[37];$_0x1ce8[37];$_0x1ce8[37];$_0x1ce8[37]}setInterval(serverPlayersButtons,6000);function hideSkinUrl(){$(_0x1ce8[49])_0x1ce8[48];$(_0x1ce8[52])_0x1ce8[51]}function showSkinUrl(){$(_0x1ce8[49])_0x1ce8[48];$(_0x1ce8[55])_0x1ce8[51]}function hideTeam(){$(_0x1ce8[56])_0x1ce8[48];$(_0x1ce8[58])_0x1ce8[51]}function showTeam(){$(_0x1ce8[56])_0x1ce8[48];$(_0x1ce8[60])_0x1ce8[51]}deletead();function deletead(){$(_0x1ce8[62])_0x1ce8[61]}$(_0x1ce8[64])_0x1ce8[63];$(_0x1ce8[65])_0x1ce8[61];$(_0x1ce8[66])_0x1ce8[61];$(_0x1ce8[67])_0x1ce8[61];$(_0x1ce8[68])_0x1ce8[61];$(_0x1ce8[70])_0x1ce8[69];$(_0x1ce8[70])_0x1ce8[61];$(_0x1ce8[71])_0x1ce8[61];$(_0x1ce8[72])_0x1ce8[61];$(_0x1ce8[73])_0x1ce8[61];$(_0x1ce8[74])_0x1ce8[61];$(_0x1ce8[75])_0x1ce8[61];$(_0x1ce8[77])_0x1ce8[51];$(_0x1ce8[80])_0x1ce8[79];$(_0x1ce8[81])_0x1ce8[79];$(_0x1ce8[1])_0x1ce8[83];$(_0x1ce8[85])_0x1ce8[83];$(_0x1ce8[1])_0x1ce8[51];$(_0x1ce8[87])_0x1ce8[51];$(_0x1ce8[88])_0x1ce8[61];$(_0x1ce8[89])_0x1ce8[83];$(_0x1ce8[49])_0x1ce8[83];$(_0x1ce8[92])_0x1ce8[91];$(_0x1ce8[94])_0x1ce8[83];$(_0x1ce8[54])_0x1ce8[91];$(_0x1ce8[59])_0x1ce8[91];$(_0x1ce8[97])_0x1ce8[96];$(_0x1ce8[97])_0x1ce8[96];$(_0x1ce8[93])_0x1ce8[96];$(_0x1ce8[93])_0x1ce8[96];$(_0x1ce8[93])_0x1ce8[96];$(_0x1ce8[103])_0x1ce8[96];$(_0x1ce8[105])_0x1ce8[96];$(_0x1ce8[107])_0x1ce8[96];$(_0x1ce8[105])_0x1ce8[96];$(_0x1ce8[110])_0x1ce8[96];$(_0x1ce8[110])_0x1ce8[96];$(_0x1ce8[110])_0x1ce8[96];$(_0x1ce8[107])_0x1ce8[96];$(_0x1ce8[107])_0x1ce8[96];$(_0x1ce8[107])_0x1ce8[96];$(_0x1ce8[80])_0x1ce8[20];$(_0x1ce8[56])_0x1ce8[48];$(_0x1ce8[94])_0x1ce8[83];$(_0x1ce8[121])_0x1ce8[48];window_0x1ce8[127];$(_0x1ce8[49])_0x1ce8[129];$(_0x1ce8[130])_0x1ce8[0];connect(_0x1ce8[3]);localStorage_0x1ce8[132];document[_0x1ce8[133]]= _0x1ce8[134];$(document)_0x1ce8[135]
ME HAN DICHO QUE UN TAL JXBEUTIFIER ES LO MAS LEJOS QUE SE PUEDE LLEGAR , PERO NO ME descifra BIEN QUE HAGO !!
|
|
|
5
|
Programación / Programación C/C++ / conectar ip a un boton
|
en: 29 Mayo 2016, 23:48 pm
|
Necesito crear el botones que conecten a ip diferentes osea ws://127.0.0.1:444 y ws://127.0.0.1:445
por ejemplo cuando juegas y te dice server1 y server2 eso quiero hacer
por ejemplo los botones de esta web
|
|
|
|
|
|
|