- Little Demo of the game
- Statistics
- Conception, compatibilities and performances
State of the art ?
- lot of units and tower
- only ajax, saturated network ?
- get on all platforms
At the same time :
- > 500 towers
- > 300 units

No real-time server side, juste apache server running PHP, and some AJAX query client-side

It's not Mekawar stats ._.
Works on all Browser running HTML5
Do an user interface/gesture for each platforms
Some tips to increase performances in your
heavy apps/games
When you use setInterval or setTimeout functions for animations
if (!window.requestAnimationFrame)
{
window.requestAnimationFrame = ( function()
{
return window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(/*function FrameRequestCallback*/callback,/*DOMElement Element*/element)
{
window.setTimeout( callback, 1000 / 40 );
};
})();
}
function animationLoop()
{
// call firstly the next frame
requestAnimationFrame(animationLoop);
// some function to animate some things
animate();
move();
update();
}
Draw one time in a canvas and save the canvas as an image
function buffer()
{
var cvs = document.createElement('canvas');
var ctx = cvs.getContext('2d');
mySuperFunctionToDrawSomething(ctx);
return cvs;
}
var myImage = buffer();
// then you can draw myImage like an other classic image
Load an image before use it
var myPicture = new Image();
myPicture.src = "img/picture.png";
myPicture.onload = function()
{
// image is now ready
};
Don't limit your apps to one canvas only
ctx.globalAlpha = 0.5;
drawParticles();
ctx.globalAlpha = 1;
Create and check timestamps for your objects if you wan't the same animation everywhere !
Example without
var myObject = { "lastMove":Date.now(), "eachMove":80, "update":function(){}};
function loop()
{
var time = Date.now();
if (time - myObject.lastMove > myObject.eachMove)
{
myObject.lastMove = time;
myObject.update();
}
}
Questions ?
Hey help a student project !
- Please like Mekawar on facebook ! -> http://cpc.cx/4NU
This slide is here: http://cpc.cx/4NV