⚠️ Malware / Trojaner / VirenPC Security Channel: Undetected Steam Malware: Sent by Viewer(28.08.2026 um 21:00 Uhr)
🕵️ SicherheitslückenSecurity Weekly - A CRA Resource: What AI Researchers See Beyond AI(01.09.2026 um 15:00 Uhr)
🕵️ SicherheitslückenSecurity Weekly - A CRA Resource: AI Security Findings Aren’t Proof(02.09.2026 um 19:00 Uhr)
🕵️ SicherheitslückenSecurity Weekly - A CRA Resource: Linux Threat Hunting - PSW #942(03.09.2026 um 23:14 Uhr)
⚠️ Malware / Trojaner / VirenPC Security Channel: Undetected Steam Malware: Sent by Viewer(28.08.2026 um 21:00 Uhr)
🕵️ SicherheitslückenSecurity Weekly - A CRA Resource: What AI Researchers See Beyond AI(01.09.2026 um 15:00 Uhr)
🕵️ SicherheitslückenSecurity Weekly - A CRA Resource: AI Security Findings Aren’t Proof(02.09.2026 um 19:00 Uhr)
🕵️ SicherheitslückenSecurity Weekly - A CRA Resource: Linux Threat Hunting - PSW #942(03.09.2026 um 23:14 Uhr)

26 🕛 kürzlich 4 Min Lesezeit CVE-RADAR
0

I Built 2 Browser Puzzle Games from Scratch A deep-dive into building Color Sort Puzzle and Block Blast

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




I Built 2 Browser Puzzle Games from Scratch This Week 🎮



As part of my ongoing project — 7x.games — I'm building 150+ original,

SEO-optimized browser games. This week I shipped two puzzle games:




  • 🧪 — place Tetris-style blocks on an 8×8 grid, clear rows & columns



No game engines. No canvas libraries. Just React, and CSS.



Here's what I learned building both.







🧪 Color Sort Puzzle



The mechanic seems trivial but the solver logic is not.



The key challenge was level validation — generating a solvable puzzle

every time. I built a backtracking solver that simulates valid pour sequences

before presenting a level to the player.




CODE
// A pour is valid only if:
// - Source tube is not empty
// - Target tube is not full
// - Top color of source matches top color of target (or target is empty)
const isValidPour = (from, to) => {
if (from.length === 0) return false
if (to.length === TUBE_SIZE) return false
if (to.length > 0 && to[to.length - 1] !== from[from.length - 1]) return false
return true
}






Other interesting bits:




  • Undo stack with full state snapshots

  • Auto-win detection after each pour

  • 50+ difficulty-scaled levels generated algorithmically









🧱 Block Blast



This one was trickier on the interaction side.






Drag-and-Drop with Proximity Snapping



Standard drag-and-drop maps your cursor to the grid. But on a crowded board,

being 1px off means you miss the gap entirely.



I implemented a 3×3 proximity search — the game scans a neighborhood

around your finger and snaps to the closest valid placement:




CODE
for (let dr = -1; dr <= 1; dr++) {
for (let dc = -1; dc <= 1; dc++) {
const r = baseRow + dr
const c = baseCol + dc

if (canPlaceBlock(grid, shape, r, c)) {
const dist = Math.sqrt(dr * dr + dc * dc)
if (dist < minDistance) {
minDistance = dist
bestPos = { row: r, col: c }
}
}
}
}






This made the game feel 10x more playable on mobile immediately.






Web Audio Sound Effects — Zero Dependencies



Instead of loading audio files, I synthesized all sounds via the Web Audio API:




CODE
const playSound = (type) => {
const ctx = new AudioContext()
const osc = ctx.createOscillator()
const gain = ctx.createGain()
osc.connect(gain)
gain.connect(ctx.destination)

if (type === 'clear') {
osc.type = 'triangle'
osc.frequency.setValueAtTime(523.25, ctx.currentTime) // C5
osc.frequency.linearRampToValueAtTime(1046.50, ctx.currentTime + 0.3) // C6
gain.gain.setValueAtTime(0.2, ctx.currentTime)
gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.3)
osc.start()
osc.stop(ctx.currentTime + 0.3)
}
}






Three sounds (place, clear, game over) — 0 bytes of audio assets.






Mobile Scroll Freeze During Drag



The tricky part: you want the page to scroll normally, but freeze the moment

the user grabs a block.



React's synthetic touch events are passive by default, so preventDefault

doesn't work inside them. The fix: register a non-passive listener on

mount using a ref that updates synchronously:




CODE
const isDraggingRef = useRef(false)

useEffect(() => {
const blockScroll = (e) => {
if (isDraggingRef.current && e.cancelable) e.preventDefault()
}
// { passive: false } is KEY — allows preventDefault to work
window.addEventListener('touchmove', blockScroll, { passive: false })
return () => window.removeEventListener('touchmove', blockScroll)
}, [])

// Then on touchStart of a block:
isDraggingRef.current = true // synchronous — no state lag






Using useState here would fail because the state update is async

the browser already starts scrolling before React re-renders.









SEO Integration



Both games are pre-rendered static pages in Next.js with:




  • Full metadata object + OpenGraph tags in layout.js


  • VideoGame + FAQPage JSON-LD structured data via next/script

  • Registered in sitemap.xml automatically via the games registry

  • Long-form strategy articles on each game page for topical authority









What's Next



I'm continuing to build original games for 7x.games — the goal is 150+

fully SEO-optimized, original browser games. Each game is a standalone

Next.js static page with its own schema, metadata, and content strategy.



🔗 Play both games:




  • Color Sort →



🔗 Follow the build: https://www.instagram.com/buntynamberdar



Drop a ❤️ if you found the non-passive touch trick useful — took me longer than I'd like to admit to figure that one out! 😅

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 39%
🟡 In Evaluierung 24%
🟢 Keine Auswirkung 12%
Spannende Innovation 25%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Fixing Software Weaknesses Rather Than Just Finding More Flaws - ASW #398
1 Quelle
What AI Researchers See Beyond AI
1 Quelle
The CAPTCHA Is Actually the Attack
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten I Built 2 Browser Puzzle Games from Scratch A deep-dive into building Color Sort Puzzle and Block Blast

Thematisch verwandte Begriffe: Built, Browser, Puzzle, Games · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...