Wii Opera SDK Moved to Its Own Website
By geekrecon. Monday, 21. April 2008, 14:51:54
And Internet Channel Software that Uses It
By geekrecon. Monday, 21. April 2008, 14:51:54
By geekrecon. Friday, 4. April 2008, 00:56:48
By geekrecon. Tuesday, 18. September 2007, 17:37:22
By geekrecon. Friday, 14. September 2007, 02:06:36
Did you know that games with advanced graphics and controls are possible on the Wii's Internet Channel (Opera 9.0) using nothing but HTML and efficiently-coded Javascript? I'm not talking about Pong, either. I'm referring to games with graphics that rival those of Starfox for the SuperNES or the original Wolfenstein 3D for the PC. This is the first in a three-part article that will help you achieve just that. This article focuses on thinking in the mindset of optimizing your Javascript code as much as possible for both speed and memory in areas specific to the Wii. Articles already exist on the Wii Remote and the canvas object, so I will not spent a great deal of time on the specifics of those but will dive right into the meat of the topic.
scale = Math.floor((x2-x1)/img.width); scale = ((x2-x1)/img.width)>>0; scale = ((x2-x1)/img.width)|0;For calculations of our needs, always avoid the first example. Javascript's built-in Math class is very slow compared to bit shifts or bit comparisons. If all values are integers already, then conversions are only needed on divides. For rounding numbers, add half of the denominator to the numerator before dividing. The second example leads us into bit shifting over division and multiplications. Divides (and to a lesser extant: multiplies) can be processor-intensive when used repeatedly, so always use bit-shifts when an integer is going to be multiplied or divided by a power of two, like so:
centerx = (x1+x2)/2; centerx = (x1+x2)>>1;
while(Math.abs(tempX)<=absdx){
destH2 = (destH*tempX+dy1)|0;
this.context.drawImage(img, (sourceX*tempX/destH2)|0, 0, 1, sourceH, tempX+x1, (destY*tempX+y1)|0, absscale, destH2);
tempX+=fullscale;
}
Most of the variable calculations were moved outside the loop, leaving only the ones that absolutely had to be recalculated on each iteration of tempX, which is the scanline variable. Other tricks for speed boosts include avoiding global and outside-scope variables if at-all possible (No, it was not possible to avoid this.context.drawImage.) because javascript checks for the narrowest scoped variable of the given name first, then progressively broadens, leading to slowdowns.
By geekrecon. Friday, 20. July 2007, 21:36:15
Official Website for Wii Opera SDK
Official HullBreach Forum
Wiki Site at HullBreach
News and Articles for Homebrew Wii Coders
Two player Starfox clone controlled with the Wii Remotes
MMO RPG for the Wii