Go for writing Emulators?

blov · · 581 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I have started experimenting with go lately, and I&#39;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&#39;ve tried SDL, but that didn&#39;t work when launched through the debugger in VS Code. OpenGL seemingly works, but I don&#39;t think it&#39;s the right tool for the task, as it doesn&#39;t seem to be meant for operating on the screen pixel by pixel.</p> <p>In short I need a library that&#39;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&#39;t need a lot of extra features.</p> <p>And while we&#39;re at it I&#39;ll also need an input library and some kind of sound library. I&#39;m not sure about the specifics yet because I haven&#39;t gotten that far into studying the older consoles, but if you have made an emulator in go I&#39;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 &#39;pixel by pixel&#39;, I think you are confused. I can&#39;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&#39;t call opengl or whatever pixel by pixel.</p> <p>Anyway here are some emulators I&#39;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 &#39;shiny&#39; : <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 &#39;shiny&#39; : <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&#39;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&#39;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&#39;s probably too much context switching.</p> <p>I&#39;m using SDL.</p></pre>neoasterisk: <pre><p>There&#39;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&#39;ll check it out. It&#39;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&#39;s performant enough anyway.</p></pre>driusan: <pre><p>You&#39;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&#39;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&#39;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

581 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传