Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


hdnine

Member Since 19 Dec 2004
Offline Last Active Jun 06 2013 05:52 AM

Posts I've Made

In Topic: [JS] Confused how to retrieve variable value from within a function

09 November 2012 - 04:29 AM

Right... will give it a try. Thanks!

In Topic: 2D tile level drawing performance, which of two approaches is best?

31 October 2012 - 03:14 AM

How is your rendering loop set up? Are you using setTimeout? setInterval? requestAnimationFrame? It should be possible to draw a reasonable number of things to <canvas> without poor performance.


What i use is requestAnimFrame:
[source lang="jscript"]function render() { // Basically renders graphics, checks for collision and moves the player}window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function( callback ){ window.setTimeout(callback, 1000 / 60); };})();(function animloop(){ requestAnimFrame(animloop); render();})()[/source]

It might be that the lagging and jerking comes from the browser? I've noticed that Chrome seems to work best for Canvas while i personally like to develop in Firefox. Thanks also to Bad Unicorn for the input!

In Topic: 2D tile level drawing performance, which of two approaches is best?

29 October 2012 - 03:03 PM

Right now i can't say if my chosen approach will affect performance or not but it was one of those things that i realized just might do. But as you say, maybe i'm better off focusing on other things until it actually becomes a problem.

One issue i have with detecting performance bottlenecks is that the canvas atm isn't optimized to such a point that it would run smoothly in all browsers. At times it lags, jerks and does other wierd stuff with only minimal animations on stage, so it's hard to tell if these are browser issues or if i have some poorly written code. Anyway, thanks!

In Topic: Javascript collision detection in tile based game (demo page available)

24 October 2012 - 06:23 AM

Thanks! ^^

In Topic: Javascript collision detection in tile based game (demo page available)

22 October 2012 - 11:03 AM

Right, thanks... right now i'm not that worried about optimization, more that the collsion itself was faulty. But thanks anyway i will certainly take a look at it. ^^

PARTNERS