A project log for Dodo: 6502 Game System

Handheld Game System featuring the 6502

peter-noyesPeter Noyes 09/15/2016 at 05:038 Comments

I am back! I had to take a hiatus from working on this project for the past several months, but over the past few weeks I have been busy. My most recent advancement is a playground!

The playground is a web application that simplifies developing games for Dodo by having an IDE and Simulator that run as a hosted service. For everything developed there is a shareable link that is generated.

For instance here is a a link to the game 0xDEADBEEF

0xDEADBEEF in Playground

Note that it is not playable on a mobile device at the moment

The playground was a concept that I wanted to pursue since the beginning of the project. I thought it would be awesome to bring 6502 development into the cloud era. Having a Web IDE with an integrated simulator lowers the barrier to entry to get people to experiment with the project, and for my own development it seriously improves the speed at which I can iterate.

The first step was to write a simulator, which I did a while back in the language Go. The initial simulator ran as a console application. I then developed a web version that used Websockets to stream the graphics from a backend server to the client in real-time. The approach of running the simulation in the cloud worked, but it just consumed too many resources and scaling it would be difficult.

The solution would need to have the simulator run locally on the client. I put the playground on the backburner because I really wanted to stick with Go as a language, porting to JavaScript is not my idea of fun. Thankfully, I randomly stumbled across the project GopherJS which transpiles Go code into JavaScript so that it can run locally in the browser. I could stick with Go! Using GopherJS wasn't competely seamless, because the simulator ran painfully slow at first. Also, my orginal code relied on multi-threading and JavaScript is single threaded. It took several passes at optimizing the code to achieve a playable framerate in most browsers. Chrome works the best.

The development language for Dodo is 'C' and it is compiled using cc65. The playground works by hosting cc65 in the cloud.

Here is roughly how the whole system works:

With this design the heavy lifting is mostly done by the client. The server just has to compile the code. This is also scaleable.

I also made some advancements with the simulator. Because there is an easy to use Audio API in most browsers, I was able to get sound simulated fairly easily. I also pulled it into its own library so it could be embedded in other contexts.

Here are some other playground links:

Slide puzzle from last post

Proof of concept of bird version of space invaders 'Poovaders'

Hello World

Here is the repository on Github


Ed S wrote 09/16/2016 at 05:32 point

Brilliant! Please do post about this on the forums - if you don't, I will! Both the simulation and the game API are good ideas which should be more widely used.  (Very nice idea for a minigame too!)

  Are you sure? yes | no

Peter Noyes wrote 09/16/2016 at 15:52 point

Thanks Ed!

I posted it here:

  Are you sure? yes | no

Yann Guidon / YGDES wrote 09/15/2016 at 10:33 point

Wow, that's a lot of work !

Maybe there are tricks I could reuse for the rewrite of #YGWM Whygee's JavaScript Window Manager ...

  Are you sure? yes | no

Peter Noyes wrote 09/15/2016 at 12:47 point

Thanks! That window manager is cool! At some point I want to have the playground use a proper reactive framework to restructure things into components and to clean things up. There are a bunch, React, Vue and for GopherJS there is Vecty. This might be the way to go for your project too

  Are you sure? yes | no

FloppidyDingo wrote 09/15/2016 at 05:48 point

I broke the playground program for 0xDEADBEEF already. After I got a score higher than ten, the score counter stopped showing numbers and instead showed letters, then gave up and showed random tiles.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 09/15/2016 at 10:32 point

oh, that is... unexpected :-D

  Are you sure? yes | no

Peter Noyes wrote 09/15/2016 at 12:42 point

Thanks for playing! I will fix that one of these days. I now understand why donkey kong has the "kill screen"

  Are you sure? yes | no

FloppidyDingo wrote 09/15/2016 at 22:23 point

This has confirmed me being the king at breaking games. But I don't know what my high score is.....sadface

  Are you sure? yes | no