[HN Gopher] Libgodc: Write Go Programs for Sega Dreamcast
___________________________________________________________________
Libgodc: Write Go Programs for Sega Dreamcast
Author : drpaneas
Score : 188 points
Date : 2025-12-29 13:43 UTC (9 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| drpaneas wrote:
| I built a Go runtime that runs on the Sega Dreamcast, the 1999
| console with 16MB RAM and a 200MHz SH4 CPU.
|
| You can write games in Go with goroutines, channels, garbage
| collection, and all the language features you'd expect. It
| compiles using gccgo and runs on real hardware or emulators.
|
| The project includes 3 game examples Pong, Breakout and
| Platformer, input handling, audio support, and integrates with
| KallistiOS (the Dreamcast homebrew SDK).
|
| * Star Here: https://github.com/drpaneas/godc * Documentation:
| https://drpaneas.github.io/libgodc/ * Video Tutorial:
| https://youtu.be/ahMl0fUvzVA
|
| Happy to answer any questions about the implementation!
| danhau wrote:
| I just wanted to say how impressive your documentation is. I
| expected an average readme.md, but not only is your readme
| great (the performance table is wonderful), but the full
| documentation is awesome. It pretty much answers all questions
| I had. Nice job! I wish all projects were like this.
|
| I also dig the documentation / book styling.
| drpaneas wrote:
| thanks @danhau, much appreciated, indeed documenting the
| process felt like another project of its own, so I am very
| happy to hear that :D
| clktmr wrote:
| Hey panos! I only had a short look at this for now, and it
| looks impressive! I'll have to dust off my Dreamcast and get
| this running.
|
| I looked at gccgo when porting the runtime to n64, but at the
| time it wasn't updated since go1.18. Can we use Go Generics on
| the Dreamcast? I see that gccgo is obviously needed to support
| SH4.
| drpaneas wrote:
| Hey Timur, long time no see, I hope all is going well :) No,
| you cannot use generics, they are not yet supported by gccgo.
| pjmlp wrote:
| This is kind of cool, kudos for the effort.
| drpaneas wrote:
| you're very welcome :D Thanks!
| lagniappe wrote:
| You've made my entire WEEK! Thank you!
| drpaneas wrote:
| You've put a smile on my face reading your comment, thank you
| for your feedback, happy holidays :D
| simonw wrote:
| This is a beautiful thing to exist. Much respect for building
| this.
| phantasmish wrote:
| > Replaces the standard Go runtime with one designed for the
| Dreamcast's constraints: memory 16MB RAM, CPU single-core SH-4,
| no operating system.
|
| 24 total megabytes, with an M, of memory between system and video
| (another 8 there), single core 200mhz CPU, graphics chip runs at
| 100mhz. Shenmue runs on it.
|
| _Glares at Teams_.
| perching_aix wrote:
| Could implement a custom Teams client on top of that. My
| biggest concern would be TLS and media decoding, but could just
| proxy the traffic and roll a text only client.
|
| I mucked about with Microsoft Graph a bit before, didn't seem
| too bad.
| giancarlostoro wrote:
| It baffles me that Microsoft can build an entire OS, and build
| and rebuild GUI stacks, and they couldn't build the Teams UI
| using C#???
| mfro wrote:
| If they built Teams with a C# UI framework, it'd have to be
| rebuilt 4 times by now.
| federiconafria wrote:
| Microsoft applications always look and behave as if they were
| ported to windows...
| lexoj wrote:
| They needed true cross-platform consistence, so it had to be
| equally terrible everywhere.
| gethly wrote:
| > CPU single-core
|
| This does not fare well for Go though.
| c2xlZXB5Cg1 wrote:
| Paging Mythbusters
| lagniappe wrote:
| Huh?
| jerf wrote:
| It runs fine. It is perhaps a bit pricey for a 200MHz system,
| I'd certainly focus on having only a few of them and doing
| most of my work by looping over some sort of user-defined
| tasklet (or, in other words, "standard game architecture"),
| but it's not like Go requires multiple CPUs to work at all.
| awesome_dude wrote:
| Wouldn't it suit Go over some other architecture, because of
| goroutines being in userspace, the single CPU is effectively
| multithreaded when using Go
| Thaxll wrote:
| Most Go code on Kubernetes runs on a single core.
| pjmlp wrote:
| I really don't get how Teams gets developed, not even the worst
| offshoring projects I have been part of, have reached so low in
| quality.
| bttf wrote:
| Would happily take work chat, video conferencing in network-
| enabled Shenmue over Teams, Slack any day
| smrq wrote:
| As long as you don't work in the shipping industry. I hear
| it's next to impossible to get hold of any sailors over
| Shenmue
| donatj wrote:
| The "Effective Dreamcast Go" docs on this are fantastically well
| written. I've read much worse docs from major corporations.
| drpaneas wrote:
| Many thanks @dontaj much appreciated, indeed documenting the
| process felt like another project of its own, so I am very
| happy to hear that! The effective dreamcast Go was inspired
| from the old time classic https://go.dev/doc/effective_go :D
| karel-3d wrote:
| I thought that gccgo supports only some old go version? Or subset
| of features? I will need to refresh my memory for sure
| drpaneas wrote:
| I am using sh-elf-gccgo (GCC) 15.1.0 which is ok-ish I guess.
| But in general gccgo tries to be close to Go, but they do not
| implement all the features. e.g. generics are still missing for
| example.
| pjmlp wrote:
| It appears stale to me, there seems no one is driving it any
| longer, and Ian Lance Taylor has moved on anyway.
|
| Maybe eventually the same can be tried with TinyGo, just as
| an idea.
| drpaneas wrote:
| problem is TinyGo uses LLVM, which doesn't support SH-4.
| The only reason I went with gccgo is due to SH4 target. In
| any case, I learned a ton of things doing this project :D
| AdmiralAsshat wrote:
| > Who is this for? > ... > Anyone who enjoys the challenge of
| severe constraints
|
| Remembering what a powerhouse the Dreamcast was when it came out,
| and how amazing games like Soul Caliber and Shenmue looked, it's
| hard to think of the Dreamcast hardware as "severely contained".
| drpaneas wrote:
| yeah, been there, nostalgia hits hard. Dreamcast was a beast of
| its era, it even had Ethernet! Even the VMU was something
| extraordinary! Too bad SEGA had to cancel it :(
| jerf wrote:
| I find it a bit weird that I find it intuitive how things like
| the Super Nintendo did their work, and how modern games and
| systems work, but comparing the hardware specs of the
| Dreamcast/PS2/XBox/Gamecube era to the best of their output is
| where my intuition struggles the most. Not that the games of
| the era stand up to modern stuff, even when upscaled and
| texture-packed etc. in an emulator, but how they did it with so
| little oomph still amazes me.
| tclancy wrote:
| For anyone interested in the general topic, highly recommend
| https://en.wikipedia.org/wiki/Racing_the_Beam
| rpastuszak wrote:
| I love this. The documentation is great and I've even learned a
| thing or two about golang from it! The logo makes me want to port
| Icy Tower to DC.
| drpaneas wrote:
| thanks @rpastuszak, much appreciated :D
| Imustaskforhelp wrote:
| If someone is interested in running golang projects on niche
| hardware perhaps, one pro tip I can suggest but there is way to
| convert golang 100% into wasm (no js shim or anything required)
| and the only thing you would need is a wasm library
|
| You have to use golang from source (see the stackoverflow page
| https://stackoverflow.com/questions/76087007/golang-to-wasm-... )
|
| go install golang.org/dl/gotip@latest gotip download GOOS=wasip1
| GOARCH=wasm gotip build -o main.wasm
|
| Although the way I did it is going into the gotip folder and then
| the binary folder which would contain the go compiler binary and
| then just use that path with
|
| GOOS=wasip1 GOARCH=wasm ~/sdk/gotip/bin/go build -o main.wasm
|
| Note that I forgot the exact path but it was similar to this but
| the point being that its super easy and simple :)
|
| I tried to do it and I can tell you that it works and it works
| for even the most latest versions of golang, all you need is a
| wasmengine which I suppose can be ubiquitous.
|
| I have built a solution where golang code gets converted to wasm
| and then we run a ssh server which then runs that wasm all in
| sandbox to create sandboxed mini golang servers :p I really love
| it although its a more so prototype than anything
| gothink wrote:
| Looks like this is available (since Go 1.21 [0]), so no need to
| build from source anymore. Just did a quick 'hello world' test
| to verify and it worked: GOOS=wasip1
| GOARCH=wasm go build -o main.wasm main.go wasmtime
| main.wasm
|
| If you're interested in wasm/wasi and niche hardware with Go,
| you should check out TinyGo [1] if you haven't already.
|
| [0] https://go.dev/blog/wasi
|
| [1] https://tinygo.org/docs/guides/webassembly/wasi/
| Imustaskforhelp wrote:
| Oh wow thanks for telling me, looks like I was using gotip/
| source go for no reason but thanks for telling me this, this
| actually really simplifies a lot of things :p
|
| Tinygo is really awesome but I have heard that it has its
| differences so software written for golang won't really work
| ootb on tinygo and tinygo is really fascinating project too!
|
| I have a question but is it possible to create golang
| compiler itself within wasm itself. I tried doing it but it
| didn't really work out but I am curious if someone has
| thought of doing something like this or has already done it?
| nasretdinov wrote:
| Nice project! Having just 16Mb of RAM does indeed sound like a
| real challenge for stock Go (not the TinyGo variant)! Even hello
| world is a couple megs, although I imagine Dreamcast isn't
| 64-bit, so the instructions are probably much shorter.
| Interesting to see anything written in it :)
| drpaneas wrote:
| Thanks :D How about porting Diablo?
| https://x.com/PanosGeorgiadis/status/2005692695402955143
| steeve wrote:
| this is incredible
| drpaneas wrote:
| thanks @steeve :D
| tasa1969 wrote:
| amazing work! The "book" documentation is better than most of the
| books I have read and paid this year! Kudos!
___________________________________________________________________
(page generated 2025-12-29 23:00 UTC)