<p>I have started experimenting with go lately, and I've been considering trying to make an emulator for an older system with it (chip8, gameboy, NES). Library support seems somewhat lacking though, especially in the graphics department.</p>
<p>I've tried SDL, but that didn't work when launched through the debugger in VS Code. OpenGL seemingly works, but I don't think it's the right tool for the task, as it doesn't seem to be meant for operating on the screen pixel by pixel.</p>
<p>In short I need a library that'll graphically display images based on pixel data. It needs to be fast enough for 60 FPS to match consoles like the gameboy. Preferably easy to use, I don't need a lot of extra features.</p>
<p>And while we're at it I'll also need an input library and some kind of sound library. I'm not sure about the specifics yet because I haven't gotten that far into studying the older consoles, but if you have made an emulator in go I'd be happy to hear your recommendations for any of the above things!</p>
<hr/>**评论:**<br/><br/>computesomething: <pre><p>I think opengl is your best bet (or something wrapping opengl), as for 'pixel by pixel', I think you are confused. I can't imagine any emulator which does not render to a buffer, and then send that to the video card in the form of a texture to be rendered. You may build that buffer in a pixel by pixel fashion, but you won't call opengl or whatever pixel by pixel.</p>
<p>Anyway here are some emulators I'm aware of written in Go (there are a LOT of them, particularly gameboy):</p>
<p>CHIP8 emulator using gomobile (opengl) : <a href="https://github.com/bomer/chip8" rel="nofollow">https://github.com/bomer/chip8</a></p>
<p>Gameboy emulator which runs graphically in the terminal : <a href="https://github.com/dobyrch/termboy-go" rel="nofollow">https://github.com/dobyrch/termboy-go</a></p>
<p>Gameboy emulator uses 'shiny' : <a href="https://github.com/theinternetftw/dmgo" rel="nofollow">https://github.com/theinternetftw/dmgo</a></p>
<p>Gameboy emulator using opengl : <a href="https://github.com/drhelius/demo-emulator" rel="nofollow">https://github.com/drhelius/demo-emulator</a></p>
<p>NES emulator using 'shiny' : <a href="https://github.com/theinternetftw/famigo" rel="nofollow">https://github.com/theinternetftw/famigo</a></p>
<p>NES emulator using opengl : <a href="https://github.com/fogleman/nes" rel="nofollow">https://github.com/fogleman/nes</a></p>
<p>NES emulator using Azul3d (opengl) : <a href="https://github.com/nwidger/nintengo" rel="nofollow">https://github.com/nwidger/nintengo</a></p></pre>giovannibajo: <pre><p>I'm writing a <a href="https://github.com/rasky/ndsemu" rel="nofollow">Nintendo DS emulator in Go</a>. It supports both 2D and 3D (software 3D rasterizer), and I achieve decent performance. </p>
<p>I'm aggressively using goroutines, so each line is being drawn through multiple goroutines (one for each graphics layer) and then composed through the graphic mixer. This causes some performance problems as it's probably too much context switching.</p>
<p>I'm using SDL.</p></pre>neoasterisk: <pre><p>There's already a pretty good <a href="https://github.com/fogleman/nes" rel="nofollow">NES emulator in Go</a>. It might give you some ideas.</p></pre>uehtr23: <pre><p>I'll check it out. It's not the easiest to learn from due to the lacking documentation. Looks like it creates textures with image/draw and draws them via OpenGL. I figured that approach would be a little slow, but I guess it's performant enough anyway.</p></pre>driusan: <pre><p>You're trying to emulate a system that ran at a clock speed of less than 2Mhz. How slow do you think image/draw is?</p></pre>albatr0s: <pre><p>To add more alternatives: SFML and Raylib.</p></pre>qcoh: <pre><p>Try SDL again. If delve doesn't work through VSCode, you can still attach it to a running process (`dlv attach `pidof foo``).</p></pre>uehtr23: <pre><p>While that does work it's just too tedious for me. Graphical debugging is so much better, even just the small things like always having watchlists visible or breakpoints remembered through debugging sessions.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传