Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 27 May 2011
Offline Last Active Nov 14 2013 01:20 AM

Posts I've Made

In Topic: Coding horror experiment in HTML 5

31 October 2013 - 09:11 PM

			<canvas id="canvas" width="800" height="600">
				Your browser does not support the canvas element
		<div style="display: none">
				window.onload = function() {
					var canvas = document.getElementById("canvas");
					if(canvas.getContext) {
						var canvasWidth = canvas.offsetWidth;
						var canvasHeight = canvas.offsetHeight;
						var context = canvas.getContext("2d");
						var lastTime = 0;
						var keys = new Object();
						var delta = 0;
						context.fillStyle = "rgb(0, 0, 0)";
						context.fillRect(0, 0, canvasWidth, canvasHeight);
						var sprite = document.getElementById("sprite");
						var x = Math.random() * (canvasWidth - sprite.width);
						var y = Math.random() * (canvasHeight - sprite.height);
						function Draw() {
							if (Math.random() > 0.9)
								var grad = context.createLinearGradient(0, 0, canvasWidth, canvasHeight);

								for (var i = 0; i < 2; i++)
									grad.addColorStop(i, "#" + Math.floor(Math.random()*9999999).toString(16));
								context.fillStyle = grad;
							context.fillRect(0, 0, canvasWidth, canvasHeight);
							context.drawImage(sprite, x, y);
						function keyDown(e) {
							e = e || window.event;

							if(e.keyCode == '87') {
								y += delta;
							} else if (e.keyCode == '83') {
								y -= delta;
							} else if (e.keyCode == '65') {
								x += delta;
							} else if (e.keyCode == '68') {
								x -= delta;
						function Update() {
							var now = Date.now();
							if(lastTime === 0) {
								lastTime = now;
							delta = now - lastTime;
							lastTime = now;
						var fps = 60;
						var intervalId = setInterval(function() {
						}, 1000 / fps);
						document.onkeydown = keyDown;
			<img id="sprite" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwQAADsEBuJFr7QAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTFH80I3AAABDElEQVRYR8XOC27CMBBFUVbQNWVnzc4pZETGTk4+tiVa6UjtA9/p4/Xz/Gccv4njzjzPTdQ4wHGleAs1NzgudrHfn1t279AucFy0HD0y9A8o2EXtxDEo1kPtxDEo1kPtxDEo1kPtxDG0hVLbO45hGyn/PqO3xziGMjJC7cQxnMXu7uVnxtGhEboRODoyQjcCR0dG6Ebg6Ehp9PuJoyMjdCNwDAr1UDtxDIr1UDtxDIp9jHy3xjEo9qbPrr5/jGNQrIfaiWNSsIWaNY41he9Qa4+j6Yjo7TGOVh4oD2638s01jpVpmuL37cHS5rP1zTWOlXdsCZZHTqzfRws4VtYYjlH55hpH0zHRW3o8/wAvkCGGQzdTzQAAAABJRU5ErkJggg=="/>

In Topic: Drawing a ring that enlarges/expands away from the center.

29 October 2013 - 05:40 AM

You can't really draw a circle like that in code, round things are faked, you need to use trigonometry to plot each point.


Loop from 0 to 2π, for a rough circle, plotting points at:


x = cos(θ) * r + pos.x;

y = sin(θ) * r + pos.y;


pos is your offset or 0, as your radius increases it won't move since sin and cos go from -1 to 1.

In Topic: Snowballing and Turtling

04 September 2012 - 03:21 AM

This sounds quite fun. I think removing fog of war is okay, check out the Starcraft maps Zone Control, and also Starcraft Evolves UMS. I imagine it playing out something like this, with a giant brawl, and position being everything (except coordination will be more difficult because you have individual players for each units, rather than controlling a single army)

In Topic: Anybody develop (or interested in developing) games using SVG, Scalable Vecto...

29 August 2012 - 02:45 AM

Agreed Inkscape can do 16.7million colours too, just like Flash, or Illustrator.

While SVG's do have some use, making cartoony graphics with clean lines, or rescalable UI and buttons, this software doesn't appear to solve any problems? Not only is converting a photo to a vector relatively useless - why do you want to scale a photo up that much, you could just load more, most cameras take photos at a very high resolution - vectors are also very low performance compared to standard bitmap data. I don't see any GPU's out there that let you push SVG points.

Unless your photo is very repetitive, you are going to end up with an SVG rectangle for every pixel, making very little space gain (if not negative, SVG is stored in XML), and also reducing rendering performance.

Flash less interactive than your app? You could develop the Flash IDE in Flash theoretically.

In Topic: Making money with HTML5 games, thoughts?

25 August 2012 - 10:14 PM

Simon, you seem to be concentrating on multiplayer games only:

Even World of Warcraft has problems with people finding ways to modify the client. People cheating in PvP by removing walls \ doors from their local maps, making other characters heads much larger so they can be seen from a distance etcetera.

Yes this could be solved if they went ahead and did server-side collision checking, but apparently it's not worth the work and extra processing power required for that very large company. Imagine how much easier it would be to modify if they gave the whole client source to everyone? People already reverse-engineer 'private' servers for many of these pay-to-play games, but it does take months to years before they get released.

I see two issues.
- Modification and re-hosting (especially if they reverse engineer the server too), removing the need for users to spend money on the original game at all.
- Easier hacking & modification, now nothing can be calculated client-side. Your 'perfect solution' is at the level of rendering server-side and pushing through video, and just letting the client send input. (Not a solution that is going to work for Australian players)

You can say it is irrelevant and that the game has been designed incorrectly if something is dependent on client-side calculation, but I think it's just a reality in many games.