I'm not gonna lie, I got an email from Amazon saying that if I give Amazon Q CLI a try, I can get a free T-shirt, so here it is.
Using Q felt like working with a helpful dev buddy. The trick? Be clear and specific:
"> I would like to build a single player game, where user controls a tank and try to defeat enemy's tank fleet, very
similar to Battle City on NES system if you know it"
"> Can you remove the turret base and make treads turned as the tank goes to another direction?"
"> The game also has other things like rivers (tank cant pass through, but bullets can), indestructible rock (tank and bullet cant pass though), and tree (tank can pass through but it is harder to see the tank like it somewhat covers the tank), can you add them?"
As long as you explain clearly what you want to achieve, and preferrably in small chunk, Amazon Q will most likely get it right.
I dabbled with game making a while back, and there are a few typical challenges that all game makers usually have to solve. But thankfully, Amazon Q took care of them pretty efficiently.
Q CLI generated a bunch of things, well okay, all the things:
Took me about 3 hours typing some prompts, while I'm pretty sure it may take me weeks to produce this clone.
Amazon Q itself thinks the drawing for tank explosion is pretty cool, because it "simulates realistic particle physics".
draw() {
// Save context state
ctx.save();
// Set global composite operation for glow effect
ctx.globalCompositeOperation = 'lighter';
// Draw explosion center glow
const gradient = ctx.createRadialGradient(
this.x, this.y, 0,
this.x, this.y, 30 * this.size * (1 - this.frame / this.maxFrames)
);
gradient.addColorStop(0, `rgba(255, 255, 200, ${0.8 * (1 - this.frame / this.maxFrames)})`);
gradient.addColorStop(0.4, `rgba(255, 120, 50, ${0.6 * (1 - this.frame / this.maxFrames)})`);
gradient.addColorStop(1, `rgba(255, 20, 0, ${0.1 * (1 - this.frame / this.maxFrames)})`);
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(this.x, this.y, 30 * this.size * (1 - this.frame / (this.maxFrames * 1.5)), 0, Math.PI * 2);
ctx.fill();
// Draw particles
for (const particle of this.particles) {
if (particle.life <= 0) continue;
const alpha = particle.life / particle.maxLife;
ctx.fillStyle = particle.color + Math.floor(alpha * 255).toString(16).padStart(2, '0');
ctx.beginPath();
ctx.arc(
this.x + particle.x,
this.y + particle.y,
particle.size * alpha,
0,
Math.PI * 2
);
ctx.fill();
}
// Draw shock wave
if (this.frame < this.maxFrames / 2) {
ctx.strokeStyle = `rgba(255, 255, 255, ${0.5 * (1 - this.frame / (this.maxFrames / 2))})`;
ctx.lineWidth = 2;
ctx.beginPath();
ctx.arc(this.x, this.y, this.frame * 2 * this.size, 0, Math.PI * 2);
ctx.stroke();
}
// Restore context state
ctx.restore();
}
Giving my understanding of how complex game making is, and Amazon Q actually got it done pretty nicely, I think it really opens up possibilities. Maybe I will try to create a minigame site with Amazon Q's help!
Destroy enemy tanks and protect your base!