Thursday, October 17

Porting SBCL to the Nintendo Switch

For the previous 2 years Charles Zhang and I have actually been dealing with getting my video game engine, Trial, operating on the Nintendo Switch. The main difficulty in doing this is porting the underlying Common Lisp runtime to deal with this platform. We understood entering into this that it was going to be hard, however it has actually shown to be a fair bit more difficult than anticipated. I ‘d like to detail a few of the difficulties of the platform here for posterity, though please likewise comprehend that due to Nintendo’s NDA I can’t enter into excessive information.

Existing Status

I wish to begin with where we are at, at the time of composing this short article. We handled to port the runtime and compiler to the point where we can assemble and carry out approximate lisp code straight on the Switch. We can likewise user interface with shared libraries, and I’ve ported a range of running system mobility libraries that Trial requires to work on the Switch.

The above image reveals Trial’s REPL example operating on the Switch devkit. Trial is establishing the OpenGL context, handling input, designating shaders, all that great things, to get the text revealed on screen; the Switch does not provide a terminal of its own.

It likewise crashes soon after as SBCL is attempting to engage its trash collector. The Switch has some distinct restraints in that regard that we have not handled to work around rather. We likewise can’t output any audio yet, because the C callback system is likewise broken. And obviously, there’s possibly a great deal of other problems yet to rear their head, particularly with concerns to efficiency.

Whatever the case, we’ve gotten quite far! This work hasn’t been totally free. While I’m great not paying myself a reasonable wage, I can’t in great conscience have Charles invest a lot of his important time into this for absolutely nothing. I’ve been paying him on a regular monthly basis for all the work he’s been doing on this port. Up previously that has cost me ~ 17’000 USD. As you might or might not understand, I’m self-employed. All of my earnings comes from sales of Kandria and contributions from generous advocates on Patreon, GitHub, and Ko-Fi. On an excellent month this amounts to about 1’200 USD. On a bad month this totals to about 600 USD. That would be tough to manage in an inexpensive nation, and it’s almost difficult in Zürich, Switzerland.

I handle to get by coping with my moms and dads and being fairly economical with my own individual expenditures. Whatever I in fact make and more returns into working with individuals like Charles to do cool things. Now, I’m seemingly a video game designer by trade, and I am dealing with a presently unannounced task. Games are really pricey to produce, and I do not have sufficient reserves to bankroll it any longer. It has actually ended up being really tough to choose what to invest my minimal resources on,

» …
Learn more