TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Writing space invaders with Go

179 点作者 dcu超过 7 年前

12 条评论

takumo超过 7 年前
Looks cool but really should mention early on that it doesn't use SDL or OpenGL to render the game but uses a specific feature of iTerm2 to render a series of images in the terminal, on other terminals it just shows a black screen.
评论 #16291067 未加载
评论 #16291145 未加载
masswerk超过 7 年前
It may be worth noting that the sprites are registered trademarks of Taito. So be careful…<p>(I learned this the hard way: I once had a rather poplar 404 page featuring a variant of the game [1], until I received a cease and desist letter from Taito…)<p>[1] Compare: <a href="https:&#x2F;&#x2F;gizmodo.com&#x2F;this-space-invaders-404-page-is-the-funnest-404-error-p-510768455" rel="nofollow">https:&#x2F;&#x2F;gizmodo.com&#x2F;this-space-invaders-404-page-is-the-funn...</a>
评论 #16292934 未加载
AndrewOMartin超过 7 年前
The invaders positions shouldn&#x27;t all be updated every cycle, they should be updated one at a time, or in a separate thread, this is what the arcade machine does and due to its limited processing speed this naturally leads to the aliens speeding up as fewer aliens remain.<p>This implementation starts with the aliens going at what might be considered &quot;full speed&quot;, and is probably much more difficult.<p><a href="https:&#x2F;&#x2F;www.giantbomb.com&#x2F;space-invaders&#x2F;3030-5099&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.giantbomb.com&#x2F;space-invaders&#x2F;3030-5099&#x2F;</a>
JayOtter超过 7 年前
For anyone interested in making little games in Golang, Termloop[1] is a terminal-based engine (though it uses text to render rather than this iTerm-specific feature).<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;joelotter&#x2F;termloop" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;joelotter&#x2F;termloop</a>
评论 #16291120 未加载
rileyphone超过 7 年前
My understanding is that Go&#x27;s ffi overhead[1] makes game development impractical at a certain level, due to the amount of opengl calls you have to make. Is this still the case?<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;dyu&#x2F;ffi-overhead&#x2F;blob&#x2F;master&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dyu&#x2F;ffi-overhead&#x2F;blob&#x2F;master&#x2F;README.md</a>
评论 #16292068 未加载
评论 #16294433 未加载
评论 #16292973 未加载
评论 #16293267 未加载
评论 #16292173 未加载
darethas超过 7 年前
This is awesome, and something I was doing as well for fun! Go&#x27;s image package has some pretty nice primitives. One thing I think would make this even simpler is you could simply sequence the individual sprites using image.NewRGBA and simply setting the Pix slice to the values to draw the appropriate images, then you can avoid going to the os at all!
crehn超过 7 年前
FWIW, here&#x27;s a single-file terminal snake in Go: <a href="https:&#x2F;&#x2F;github.com&#x2F;hoffa&#x2F;snake" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hoffa&#x2F;snake</a>
评论 #16291382 未加载
wmiel超过 7 年前
Here&#x27;s also a cool example of a game written in go, although using JS to display GUI: <a href="http:&#x2F;&#x2F;blog.u2i.com&#x2F;we-made-a-multiplayer-browser-game-in-go-for-fun&#x2F;" rel="nofollow">http:&#x2F;&#x2F;blog.u2i.com&#x2F;we-made-a-multiplayer-browser-game-in-go...</a>
JustSomeNobody超过 7 年前
As someone who is just learning Go, this is a really cool bite-size project to read and learn from.<p>Very cool!
JoeAltmaier超过 7 年前
Cool, and a great programming tutorial!<p>I was thinking I might see Go in a device-control application, but alas not. The program uses a modern computer&#x27;s video system. The original Space Invaders code likely had to shift pixels out to the video display in realtime. So a different programming feat entirely, but still cool!
评论 #16290995 未加载
评论 #16290951 未加载
shoshino超过 7 年前
<a href="https:&#x2F;&#x2F;github.com&#x2F;asib&#x2F;spaceinvaders" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;asib&#x2F;spaceinvaders</a> &#x2F; <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10078928" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10078928</a>
krapp超过 7 年前
Dupe - posted yesterday by the original project author, but with only two comments[0]<p>I think a moderator should consider merging this thread with the original, if possible.<p>[0]<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16287030" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16287030</a>