TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Tetris clone written in Zig running on WebGL and WebAssembly

215 pointsby Hoppetosseabout 6 years ago

22 comments

jedisct1about 6 years ago
So much cutting edge technology for something that could have been written in BASIC running on a Z80 :)<p>That being said, Zig is an interesting, well-deigned language. Despite being young, it already has tons of features. And compatibility with the C ABI is a big plus.
评论 #19838699 未加载
评论 #19842584 未加载
ktpsnsabout 6 years ago
Didn&#x27;t know the Zig Programming language before, but its website <a href="https:&#x2F;&#x2F;ziglang.org" rel="nofollow">https:&#x2F;&#x2F;ziglang.org</a> is really an outstanding example how a programming language should be presented: Many examples, comparisons with other language, and even more examples. Code code code.
评论 #19838020 未加载
new4thaccountabout 6 years ago
It looks like Zig has some decent documentation (something I treasure), but it looks like file I&#x2F;O is missing. I&#x27;m sure it assumes the user is at least intermediate with C (I can only get by with lots of googling). I&#x27;ll give Zig a try if someone can put up an example of reading a .CSV file (something I do a lot and wish I had faster tools to do) and if it is less of a hassle than C&#x2F;C++.<p><a href="https:&#x2F;&#x2F;ziglang.org&#x2F;documentation&#x2F;master&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ziglang.org&#x2F;documentation&#x2F;master&#x2F;</a><p>The install seems to also be a lot more straightforward than many of the other low level languages that I have tried.
评论 #19838116 未加载
kebmanabout 6 years ago
The web page bobs around when pressing the buttons, when the game area is smaller than the window. Is there any way to make that stop aside from making the area smaller, so that it fits the window?
评论 #19837648 未加载
评论 #19842879 未加载
anon777778about 6 years ago
What is surprising to me is that adding the shadow of an element (ie. where exactly it will land) made the game more difficult to me because I constantly felt like running out of time.
评论 #19837491 未加载
评论 #19837835 未加载
评论 #19839887 未加载
评论 #19837642 未加载
pcr910303about 6 years ago
Hmm... [Error] TypeError: null is not an object (evaluating &#x27;gl.viewport&#x27;) (env.js:17) [Error] Unhandled Promise Rejection: TypeError: import env:consoleLog must be an object promiseReactionJob<p>Looks like not working in Safari 12.1 in macOS High Sierra :-(
评论 #19837732 未加载
alfonsodevabout 6 years ago
would you consider implementing a tetromino bag like the one described here[1], I think is common among the most popular tetris implementations, it affects a lot the game strategy, I think would make it more enjoyable.<p>[1]<a href="https:&#x2F;&#x2F;tetris.fandom.com&#x2F;wiki&#x2F;Random_Generator" rel="nofollow">https:&#x2F;&#x2F;tetris.fandom.com&#x2F;wiki&#x2F;Random_Generator</a>
评论 #19841701 未加载
VMGabout 6 years ago
<p><pre><code> Uncaught TypeError: Cannot read property &#x27;viewport&#x27; of null at env.js:17</code></pre> (anonymous) @ env.js:17<p><pre><code> Uncaught (in promise) TypeError: WebAssembly.instantiate(): Import #0 module=&quot;env&quot; error: module is not an object or function Chromium Version 74.0.3729.108 (Official Build) Arch Linux (64-bit)</code></pre>
评论 #19837930 未加载
评论 #19837664 未加载
krecoabout 6 years ago
Great work, I wanted to know a way to play with WebAssembly and Zig. This is perfect.<p>Do you know how easy&#x2F;difficult would it be to make a desktop version of it ?<p>One of my long term goal is to make it cross platform.
评论 #19838902 未加载
giornogiovannaabout 6 years ago
Do random rows get pushed from the bottom on purpose? It looks like a bug.<p>It&#x27;s still fun though. :)<p>Edit: It&#x27;s definitely on purpose.
评论 #19837340 未加载
评论 #19837376 未加载
评论 #19837333 未加载
评论 #19842901 未加载
tejuisabout 6 years ago
Bug report: The game mostly work, but sometimes it builds bogus rows on the bottom. Makes it more difficult to get high points. Debian Linux with Chrome...
评论 #19839329 未加载
hu3about 6 years ago
55.4kb gziped main.wasm including graphics! Impressive!<p>Works smoothly.
rambojazzabout 6 years ago
Is there a LICENSE file or license header somewhere?
评论 #19842931 未加载
评论 #19839046 未加载
z1r011about 6 years ago
Nice in Firefox, but my Chrome (Version 73.0.3683.103 (Official Build) (64-bit)) on MacOS does not show the game &quot;frame&quot;.
Aardwolfabout 6 years ago
Works on mobile except for the keyboard input :)
jstimpfleabout 6 years ago
How is the compilation to WASM&#x2F;WebGL realized here? Asking out of curiosity, but don&#x27;t have a lot of time to research.
评论 #19838852 未加载
评论 #19838861 未加载
NavekMabout 6 years ago
I noticed a bug where you cannot rotate an item next to a wall if you have not previously rotated it.
waspozaabout 6 years ago
Not working on Firefox?
评论 #19842317 未加载
downtideabout 6 years ago
How do I run this?
hestefiskabout 6 years ago
Nice work.
xlzrsabout 6 years ago
666
评论 #19838474 未加载
codesushi42about 6 years ago
Really great.<p>Do you know of any good resources for 2d game programming in WebAssembly?
评论 #19837631 未加载
评论 #19837461 未加载