• Content count

  • Joined

  • Last visited

About rafinskipg

  • Rank

Contact Methods

  • Twitter
  1. Tricky question

    Helloo, good morning. Several things. 1 - In JavaScript, a function search for its variables in his scope, that means that outsideFunction will first search for the variable inside itself, then if it's not found it will look for it on the parent scope (the window onload stuff). The problem, outside function its not defined in the window onload stufff, its called from there, but not defined there, so, when it looks for "var something" it looks on the parent scope where its defined. Solution 1: Use parameters. var something;function outSideFunction(something){ var result = getCalculatedStuff(something); return result;}Passing parameters to functions is "correct", better than working with global stuff. It's more correct even if you dont modify the passed parameters, instead return the result of the calculus , but not over the passed object. In JavaScript all are objects, that means they share the reference, so whenever you pass a object as a parameter and modify it, it gets directly modified in the declaration of the object. And it's better to try to avoid that in some cases, for better code. About the "insideFunction", don't do that, define your functions normally outside the window.onload, then you can call it. It's happening the same, the outsideFunction doesn't find the insideFunction name. 2 - This is not 2D specific, it's more the kind of question for "Stackoverflow" but i liked to reply
  2. Proposal for Framework needed

    If you do a research by this forums you will find the most common used pack this days, "PhaserJS" for framework pick , and CocoonJs for wrapping it (for performance boost) It only allows to use canvas games, no html/frameworks wrapping it like AngularJS.
  3. Phaser 2.0.6 - Jornhill - Released

    Tried phaser today , love it. ! .... Despite the documentation segregation.. :S
  4. Multiplatform games DOM+CSS vs CANVAS vs both

    Nice to know that, I used crosswalk-project in substitution of cocoon webview+, because it's easy to wrap with it. But i didn't know that canvas+ was much better performant than webview+... This is something to consider. I should redo all my UI with canvas, or prepare a mobile version with just the canvas part. Anyway, both of the ways will involve a huge rework, maybe it's time to split my project into mobile and pc versions. Thank you
  5. Hi people. I've been doing a game for a year or so. Now i'm facing some troubles with the performance. I know i can use cocoonjs but before talking about that, i want to ask you if this are myths or realities , if you have faced it: Aclaration: Performance was not measured, it was what I saw with the lag of the game. This was tested with chrome 35. Using different canvas layers.I've been doing all in the same canvas element, i tried one time to add more canvas layers but I didn't noticed any change. Have you tried this? How is your experience with that? Rendering in a virtual canvas, and then painting on the visible canvas.This is one of the last changes i did, now i'm painting all in a hidden canvas created at runtime, and then drawing It on the visible canvas after drawing all the individual entities on the virtual one. I have noticed no change of performance. Not drawing too much entitiesThis made the game work better. As expected. What other tips could you provide to improve the performance? I'm using map/ functional style of programming for updating the entities, may this lead into a black hole of performance? function updateEnemies(){ enemies = _.compact(enemies.map(update) .map(move) .map(removeIfOutOfScreen));}I know "for" loops are better performants, but i don't know if this is what hits the performance of the game. Other thing I'm not doing is using a QuadTree algorithm for checking near positions. How do you check that? Any algorithm? Brute force? This is the game I'm doing. http://cooldog.venturastudios.org/ I'm opensourcing everything but before I have to clean all the f**ing mess of code I did in one year. (I think i have at least 6 more months to work on cleaning and performance) I accept all the suggestion and ideas you have for performance, or whatever you want to say! Thank you bros!
  6. Multiplatform games DOM+CSS vs CANVAS vs both

    I use DoM for UI and responsiveness. What James says about all browsers, it gets mitigated using Bootstrap or other styles framework. The worst part is not being able to use canvas +.
  7. Multiplatform games DOM+CSS vs CANVAS vs both

    Hi, James Have you tried Webview+ from Ludei? I'm using a cordova application with Dom (angular js app ) + the game, which is in canvas. I use angular for having a framework available when doing some calls to server, rendering lists, etc. I haven't tried Canvas+ , does it has much difference in performance with Webview+?
  8. CocoonJS, Images and screen resolution

    Awesome! Going to try! Did you had to change your input touch events to calculate the zoomed thing? (in case you use input touch)