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).
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.
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.
> 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.
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.
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
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
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
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
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.
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 :)
> 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".
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.
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 :(
This is incredibly cool! How do you think these modern language features would have affected Dreamcast development back in the day? (I have no idea of how difficult the console was to develop.)
It was a dream relative to anything else on the market (until 2001, when the Xbox and GameCube were released), made even easier for some titles due to the optional Windows CE SDK. You still needed to do a fair bit of SuperH assembly programming to get reasonable graphics performance, but it was nothing like the nightmarish complexity of the PS2, despite having half the RAM. It's still one of the more popular homebrew targets.
I think Lua (yes you can code Dreamcast games with it) would be really awesome for kids, being able to make their own games, given the language is simple, like Python. But in general, for serious stuff C/C++ is still the preferred way.
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.
drpaneas|2 months ago
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|2 months ago
I also dig the documentation / book styling.
clktmr|2 months ago
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.
simonw|2 months ago
lagniappe|2 months ago
pjmlp|2 months ago
phantasmish|2 months ago
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.
pjmlp|2 months ago
giancarlostoro|2 months ago
bttf|2 months ago
perching_aix|2 months ago
I mucked about with Microsoft Graph a bit before, didn't seem too bad.
gethly|2 months ago
This does not fare well for Go though.
donatj|2 months ago
drpaneas|2 months ago
Imustaskforhelp|2 months ago
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|2 months ago
[0] https://go.dev/blog/wasi
[1] https://tinygo.org/docs/guides/webassembly/wasi/
nasretdinov|2 months ago
drpaneas|2 months ago
AdmiralAsshat|2 months ago
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".
jerf|2 months ago
drpaneas|2 months ago
RestartKernel|2 months ago
aj_hackman|2 months ago
drpaneas|2 months ago
XajniN|1 month ago
unknown|2 months ago
[deleted]
rpastuszak|2 months ago
drpaneas|2 months ago
karel-3d|2 months ago
drpaneas|2 months ago
tasa1969|2 months ago
drpaneas|2 months ago
kostas73|2 months ago
drpaneas|2 months ago
steeve|2 months ago
drpaneas|2 months ago
dcdev1999|2 months ago
[deleted]