Castle Game Engine supports Nintendo Switch!

Posted on

Escape from the Universe on Nintendo Switch - design
Escape from the Universe on Nintendo Switch - in CGE editor

Castle Game Engine now supports compiling your games to the Nintendo Switch console ! A modern, succesfull, indie-friendly console from Nintendo.

It is a full integration, really 100% of the engine works on Nintendo Switch. From the developer point of view, you just write cross-platform Pascal code using CGE units, and then you can recompile the application using the Castle Game Engine build tool with --target=nintendo-switch.

Note that the integration code with Nintendo Switch is not public and not open-source. It cannot be, as we are covered by Nintendo NDA agreements and we cannot disclose the technological details about how Nintendo Switch works. To develop on Nintendo Switch, you have to:

  • Become a Nintendo Developer yourself, and sign the necessary NDA agreements between your company and Nintendo. You will most likely want to buy a developer version of the console, as well.
  • Contact me (Michalis Kamburelis) through the non-public Nintendo developer forum. I can then share with you the necessary code that adds Nintendo Switch integration on top of the open-source CGE core, through the Nintendo forum, so Nintendo can confirm it’s legally OK with them. Of course you get this for free. The integration code cannot be open-source, but I still want to give it to everyone for free.

Enjoy a truly cross-platform game engine in Pascal!

Notable Replies

  1. Networking will need special wrappers (and they are not ready yet).

    In general, anything that requires OS access requires special wrappers. In case of using CGE API, those wrappers are of course ready:

    • E.g. you can open data files using standard CGE Download function (and any higher-level CGE method, e.g. TCastleScene.Load or LoadImage, they all use Download underneath), using “castle-data:/…” protocol ( https://castle-engine.io/manual_data_directory.php ). You should not open files using standard FPC means, like Pascal file or TFileStream.

    • To read time, CastleTimeUtils provides Timer, ProcessTimer, CastleNow and more, these work on Nintendo Switch already. You should not use standard Now or GetTickCount64.

    Other than that, things that don’t communicate with the OS work out-of-the-box. E.g. reading XML or JSON using standard FPC units is not a problem. (Although CGE has XML helpers in CastleXMLUtils, but these are not necessary.) You can use anything from any units like SysUtils and Classes that doesn’t access OS, e.g. TStringList or Exception or such work as expected. All the units available on Android/Aarch64 are available on Nintendo Switch – you just have to watch out to not use something that calls OS.

  2. FPC supports the CPU on Nintendo Switch (Aarch64), as it turned out (it is public information that it’s Aarch64, https://en.wikipedia.org/wiki/Nintendo_Switch ).

    For OS access (like getting the file contents, or reading the current time) we have our own code that “glues” CGE routines (like stuff from CastleDownload and CastleTimeUtils units) with Nintendo Switch specifics.

    IOW, FPC itself still does not exactly support Nintendo Switch OS (unfortunately, one cannot support Nintendo Switch in an open-source fashion, since Nintendo wants their API to be secret, covered by NDA; the fork of CGE that supports Nintendo Switch also cannot be open-source, but I promise to give it freely to anyone who also signed Nintedo NDA). But you can “work around” this on CGE level.

Continue the discussion at Castle Game Engine Forum

2 more replies

Participants