Jammy

Members
  • Content Count

    177
  • Joined

  • Last visited

Everything posted by Jammy

  1. @jonforum Still needs some work but I think it's got the minimum now so if it's of any use give it a go. Let me know what might be worth changing, I'll probably be adding some more stuff later in the week. If anyone tries it then it would be great to know any bugs, thanks. http://pixitools.jamdonut.com/
  2. @jonforum I also need this so I'm working on the tool. I'll post a link soon.
  3. Absolutely superb well done. I'll give that a vote for sure but you won't need it as i'm sure this will breeze greenlight.
  4. @d4ne I recommend adding a visual aid here to save yourself a lot of pain debugging. document.onmousedown = function(event) { //create a ball here //position the ball at event.pageX - ctx.canvas.offsetLeft and event.pageY -ctx.canvas.offsetTop socket.emit('positionUpdate', {x: event.pageX - ctx.canvas.offsetLeft, y: event.pageY -ctx.canvas.offsetTop, state: true}); } -- if the ball appears under your cursor you atleast know you're sending the co-ordinates correctly. Also: self.updatePosition = function(x, y) { //create another ball if not already existing //set position to x and y if(self.mouseMovement){ // Problem movement var targetX = x; var targetY = y; If the new ball is in the correct position then you know you received the position correctly, and therefore there is an issue processing the "from->to" loop.
  5. @kaasis You can minify and uglify with tools like UglifyJS https://github.com/mishoo/UglifyJS2 And you can obfuscate but it may impact performance more. https://github.com/javascript-obfuscator/javascript-obfuscator It's worth researching minification, uglification and obfuscation.
  6. @dimanux cheers for the screenies and info, so would you say its a traffic/promotion issue on the mobile stores? whereas on portals i guess you're getting a lot more traffic across tons of different sites
  7. Jammy

    Cliclock

    I disagree, knowing the ms was quite good and the color in the background also was a good indicator. On another note, without looking into its settings. I would actually like after my first ten to do 25, then 50, then 100 clicks so adding stages is justified here I think. I used to practice this game in my free time, i.e. looking at my watch then trying to wait a full perfect 30 or 60 seconds before looking at it again, it's a very interesting subject. I would really think it would be interesting if you could let people submit some survey information which you store on a score board. It's been said by biologists that older people perceive time as moving faster and young people perceive it as moving slower, so getting some more science from your game would be really interesting!
  8. From hacking perspective nothing changed? var gl; var canvas; var cam = new Object(); var mouse = new Object(); var demoTime = 0; var curTime = (new Date).getTime(); var lastTime = curTime; var elapsed; // shader var program; var posAttr, resAttr, timeAttr, camAttr, mouseAttr; // quad definition var vertices = [ -1,1,0, -1,-1,0, 1,-1,0, 1,1,0 ]; var indices = [ 3, 2, 1, 3, 1, 0 ]; // vertex and index buffers var vb, ib; Run(); // run demo function Run() { document.body.style = "height:100%; width:100%; padding:0; margin:0; font-family:Tahoma; background:#000000; font-color:#808080; overflow:hidden"; // init canvas canvas = document.createElement("canvas"); canvas.style.width = "100%"; canvas.style.height= "100%"; document.body.appendChild(canvas); if (!canvas) { alert('glcanvas not found'); return false; } canvas.width = 800; canvas.height = 450; var div = document.createElement("div"); div.style = "position:absolute; top:32px; left:32px; font-family:verdana; font-size:32px; color:#FFFF00; font-weight:bold"; div.innerHTML = "CAN YOU<br>STEAL THIS<br>JAVASCRIPT CODE?"; document.body.appendChild(div); // init gl if (!(gl = InitGL(canvas))) { alert('failed to initialize webgl'); return false; } if (!LoadShader()) { alert('failed to load shaders'); return false; } CreateQuad(); cam.x = cam.y = 0; cam.z = -100; mouse.x = canvas.width / 2; mouse.y = canvas.height / 2; // activate shader and vertex attribute gl.useProgram(program); gl.enableVertexAttribArray(posAttr); // pass the values which will remain fixed for the entire demo gl.vertexAttribPointer(posAttr, 3, gl.FLOAT, false, 0, 0); gl.uniform2fv(resAttr, [canvas.width, canvas.height]); // mouse handling canvas.addEventListener('mousemove', function(event) { var rect = canvas.getBoundingClientRect(); mouse.x = event.clientX - rect.left; mouse.y = event.clientY - rect.top; }); // touch handling canvas.addEventListener('touchmove', function(event) { var rect = canvas.getBoundingClientRect(); mouse.x = event.touches[0].clientX - rect.left; mouse.y = event.touches[0].clientY - rect.top; }); // start demo loop requestAnimationFrame(Draw); // succeeded return true; } // switch to fullscreen function RequestFullscreen() { if (document.fullscreenEnabled) return; if (canvas.requestFullscreen) { canvas.requestFullscreen(); } else if (canvas.msRequestFullscreen) { canvas.msRequestFullscreen(); } else if (canvas.mozRequestFullScreen) { canvas.mozRequestFullScreen(); } else if (canvas.webkitRequestFullscreen) { canvas.webkitRequestFullscreen(); } } // initialize gl function InitGL() { var gl = null; try { gl = canvas.getContext("webgl", {antialias:false}); gl.disable(gl.DEPTH_TEST); gl.viewport(0, 0, canvas.width, canvas.height); } catch(e) { } return gl; } // create a fullscreen quad function CreateQuad() { vb = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, vb); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); gl.bindBuffer(gl.ARRAY_BUFFER, null); ib = gl.createBuffer(); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ib); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); gl.bindBuffer(gl.ARRAY_BUFFER, vb); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ib); } // load and compile shaders function LoadShader() { var vertexSource = ` attribute vec3 pos; void main(void) { gl_Position = vec4(pos, 1.0); } `; var fragmentSource = ` precision highp float; uniform vec2 res; // canvas res uniform float time; // simulation time uniform vec2 mouse; // normalized mouse coordinates uniform vec3 cam; // camera position void main(void) { // plasma by imerso #define PI 3.1415926535897932384626433832795 vec2 uv = vec2(gl_FragCoord.x/res.x, gl_FragCoord.y/res.y) - vec2(.5, .5); uv.x += 0.1*sin(time) + 0.2 * sin(time+uv.y*4.); uv.y += 0.1*cos(time*0.33) + 0.2 * sin(time+uv.x*3.); vec2 suv = uv * (8. + 4. * sin(time)); // zoom float lum = sin(suv.x+time) + sin(suv.y+time/2.); // repeat lum += sin(sqrt(suv.x*suv.x + suv.y*suv.y)+time*1.5); // distance field vec3 c = vec3(sin(lum*PI), 0., cos(lum*PI)); // cyclic color c.y = c.x * c.z; // cyclic color gl_FragColor = vec4(c, 1.0); } `; var vertexShader = gl.createShader(gl.VERTEX_SHADER); gl.shaderSource(vertexShader, vertexSource); gl.compileShader(vertexShader); var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); gl.shaderSource(fragmentShader, fragmentSource); gl.compileShader(fragmentShader); program = gl.createProgram(); gl.attachShader(program, vertexShader); gl.attachShader(program, fragmentShader); gl.linkProgram(program); if (!gl.getProgramParameter(program, gl.LINK_STATUS)) return false; posAttr = gl.getAttribLocation(program, "pos"); resAttr = gl.getUniformLocation(program, "res"); timeAttr = gl.getUniformLocation(program, "time"); mouseAttr = gl.getUniformLocation(program, "mouse"); camAttr = gl.getUniformLocation(program, "cam"); return true; } // load one shader program function GetShader(id) { var shaderScript = document.getElementById(id); if (!shaderScript) return null; var theSource = ""; var currentChild = shaderScript.firstChild; while(currentChild) { if (currentChild.nodeType == 3) { theSource += currentChild.textContent; } currentChild = currentChild.nextSibling; } var shader; if (shaderScript.type == "x-shader/x-fragment") { shader = gl.createShader(gl.FRAGMENT_SHADER); } else if (shaderScript.type == "x-shader/x-vertex") { shader = gl.createShader(gl.VERTEX_SHADER); } else return null; gl.shaderSource(shader, theSource); gl.compileShader(shader); if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { alert('fragment error: ' + gl.getShaderInfoLog(shader)); return null; } return shader; } // draw scene function Draw() { // update demo time curTime = (new Date).getTime(); elapsed = curTime - lastTime; lastTime = curTime; demoTime += elapsed / 1000; // normalize mouse coords var mx = mouse.x / window.innerWidth; var my = mouse.y / window.innerHeight; // update shader variables gl.uniform1f(timeAttr, demoTime); gl.uniform2fv(mouseAttr, [ mx, my ]); gl.uniform3fv(camAttr, [ cam.x, cam.y, cam.z ]); // draw fullscreen quad gl.drawElements(gl.TRIANGLES, indices.length, gl.UNSIGNED_SHORT, 0); // next frame requestAnimationFrame(Draw); }
  9. It doesn't even require any complex tools, I can just watch the network tab on google chrome dev tools, then load your php file... Maybe this PHP files output should be obfuscated aswell.
  10. var vertexSource = ` attribute vec3 pos; void main(void) { gl_Position = vec4(pos, 1.0); } `; var fragmentSource = ` precision highp float; uniform vec2 res; // canvas res uniform float time; // simulation time uniform vec2 mouse; // normalized mouse coordinates uniform vec3 cam; // camera position void main(void) { // plasma by imerso #define PI 3.1415926535897932384626433832795 vec2 uv = vec2(gl_FragCoord.x/res.x, gl_FragCoord.y/res.y) - vec2(.5, .5); uv.x += 0.1*sin(time) + 0.2 * sin(time+uv.y*4.); uv.y += 0.1*cos(time*0.33) + 0.2 * sin(time+uv.x*3.); vec2 suv = uv * (8. + 4. * sin(time)); // zoom float lum = sin(suv.x+time) + sin(suv.y+time/2.); // repeat lum += sin(sqrt(suv.x*suv.x + suv.y*suv.y)+time*1.5); // distance field vec3 c = vec3(sin(lum*PI), 0., cos(lum*PI)); // cyclic color c.y = c.x * c.z; // cyclic color gl_FragColor = vec4(c, 1.0); } `;
  11. Can you tell us a bit more, seems very low for the "holy grail" app stores
  12. Possibly use toplevel option on uglify https://stackoverflow.com/questions/21003890/uglifyjs-2-api-equivalent-for-cli-m-toplevel
  13. Looks like you went deep! I owe you a beer thanks for the notes dude!
  14. Hi guys, I was wondering, how do I get my picture added to that top image thing on the homepage? Yknow it shows like a posts image, then u can check out the link below it? Thanks,
  15. Thanks dude, I think I'll have to code it so you can't place on grass as it does seem odd lol!
  16. Hi guys, I have more info about the game coming soon but would like to start getting help from more people in terms of testing. I'm looking for any flaws here, errors, game play issues, bugs. Some I am aware of from prior testing and still have yet to figure out and resolve although the game should allow you to play through. The game is a simplistic simulator which allows you to build your own arcade, the walls, the machines, the floors, everything. If you've played prison architect or Rimworld you'll probably see the resemblance which I drew inspiration from. The game is planned to work in any browser and any mobile tablet. Sadly a phone version may just be too far away/complex to achieve. At current the game lets you start the tutorial and then continue to play through on the tutorial level. You can pan the camera with W A S D or by touching the edges. [update] Latest Version here: https://jamdonut.com/prod/0.8/ All feedback appreciated, thanks guys. Jammy
  17. Jammy

    Layouts

    Yup its possible, it adds more coding though for the sake of saving memory when the games resized (which should be rare). I picked saving development time!
  18. If your objects are in a container you could resize the container after resizing the renderer?
  19. Jammy

    Layouts

    Yep, you're completely right. I did wonder like, if I had one overall array/object containing things I might want to reposition then I could reposition them all. But after all the thinking, existing UI's and the pain I'd have trying to manage for example 5 GUI's each within their own "container" kinda thing, then having to update all their position... Even now I struggle to really think of a good solution without creating a real good layout library, at that point im not making my game anymore tho so I have to crack on hahaha. Glad the info helps.
  20. Ah that wasn't so clear... Maybe it could show me a message to let me know that and point an arrow to where I need to go. The controls of the game are quite interesting, like a mixture of 2 game-types. I feel like I could run off the golf course and steal a car classic GTA style.
  21. Jammy

    Layouts

    I anchor/pivot the positions manually based on view port width and height, no built in pixi help (although I can imagine some way to do it, but I wanted full control). Consider I have a challenge menu. I run game.ui.challengeMenu() to create it, if I ever need to redraw it and let its position change, I just destroy it with game.ui.closeChallengeMenu() then recreate it again with game.ui.challengeMenu(); Since I use game.ui._VIEWPORT_RIGHT [+] (A var which sets itself to viewport width on resize), then all the sprites will be in their new positions when the menu is recreated. I could of course write a "resize/reposition" function for every UI, but that feels like more dev-time, while this isn't the most elegant or efficient it works, you write it once, and then it's done.
  22. Jammy

    Layouts

    I couldn't find any nice way to do it to be honest. Any 3rd party libs weren't being maintained and I couldn't be bothered coding the solution myself - instead I just have each "gui" in its own function and if the viewport resizing I destroy the GUI and redraw it... Still I'm not happy with that as the solution but I had to crack on with the game itself. So I recorded some resizing so you can see, it has some unpleasant side effects on the actual resize but after that its fairly sound. The code isn't too much of a nightmare to manage but I think my organised codebase helps with that.
  23. Yeah since "this" may be the button... Could try this: gameUnit1: function() { if (GameState.gameUnit1Bought == false) { GameState.buyUnit1Button = game.add.button(100, 500, 'blankButton', function(){GameState.buyUnit1()}, GameState); if (GameState.gold <= 200) { GameState.buyUnit1Button.alpha = .1; } } else { GameState.buyUnit1Button.destroy(); GameState.unit1Text = game.add.text(12, 480, GameState.gameUnit1Name + ":", GameState.headerStyle); }; },
  24. Jammy

    Layouts

    i do it all by scratch everytime and anchor to viewport right/bottom *cries*
  25. im pretty sure its because you're calling this inside the function as if it'll be gamestate when it'll actually be the button