Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2018-05

FPC on gaming consoles: XBox One, PlayStation 4, Nintendo Switch

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michalis Kamburelis

Hi,

I am wondering about the possibility to port Castle Game Engine to modern gaming consoles.

Summary (TL;DR):

- Is it possible to use FPC to compile programs/libraries for one of the gaming consoles mentioned in the subject?

- If it is not possible *yet*, how easy it would be to add such support to FPC? (Note: We *could* sponsor such work.)

Details: (And apologies for writing such long email.)

From what I read, the modern consoles feature more "normal" hardware

and APIs, contrary to the past consoles that had incredibly specialized stuff (like PlayStation 3 with Cell).

Note that I'm thinking here about working with the standard OS available on the console, and distributing the game through the standard shop available on each console. So I'm not interested in solutions like installing Linux on a PlayStation 4.

Bear in mind that I do not have any personal experience developing on these consoles. I'm mostly a desktop gamer/developer :) So I'm just gathering knowledge now. Any information is appreciated.

Finally, if the answer to one of these platforms is like "it is possible, but it requires ~2 months of serious work", please tell me so (in public or private). We are in the business of making games using Castle Game Engine and FPC, and as such we may be able to pay the developer willing to port FPC to one of the console platforms. We are talking now with a 3rd party that could provide the funds -- things are not settled yet, but we keep our fingers crossed :)

The gaming console platforms I'm interested in:

1. XBox One. It uses an operating system based on Windows 10. As such, maybe compiling FPC programs for it is already possible (or is easy to add)? Maybe I can even just run a normal Windows exe on XBox One?

From what I read, all XBox versions use Direct X for rendering, so porting CGE to XBox would require adding a Direct 3D renderer. But that is very doable on my side, so I don't worry about it :) And in the meantime, we could use ANGLE (a library that provides OpenGLES API, using Direct X internally), thus we can render using OpenGLES on XBox One even today.

See wikipedia: https://en.wikipedia.org/wiki/Xbox_One , https://en.wikipedia.org/wiki/Xbox_One_system_software

2. PlayStation 4 has it's special OS (Orbis OS, based on FreeBSD 9). I don't know how close it is to normal FreeBSD supported by FPC.

It's main graphics API is GNMX, which is "mostly like Direct X 11". So, again, I don't worry.

See wikipedia: https://en.wikipedia.org/wiki/PlayStation_4 , https://en.wikipedia.org/wiki/PlayStation_4_system_software

As for CPU: From what I read, both XBox One and PlayStation 4 use https://en.wikipedia.org/wiki/Jaguar_(microarchitecture) , which has instruction set like AMD64 (x86-64). Am I right assuming that, as far as FPC is concerned, this is just a normal x86_64 CPU?

3. Nintendo Switch.

CPU: Octa-core (4×ARM Cortex-A57 & 4×ARM Cortex-A53), microarchitecture ARMv8-A. Does it mean it is the same instruction set as existing 64-bit ARM CPU, uses e.g. by 64-bit iOS? It is called "aarch64" by FPC.

OS is custom. I have not found much information about it. The "syscalls look similar to Nintendo 3DS", it seems,

The graphics API: Nintendo Switch seems to include support for OpenGL, OpenGL ES and even Vulkan (
https://wccftech.com/nintendo-switch-supports-vulkan/ ), which is very cool. In addition to their custom API NVN. So Castle Game Engine could just use modern OpenGL renderer on it.

See wikipedia: https://en.wikipedia.org/wiki/Nintendo_Switch , https://en.wikipedia.org/wiki/Nintendo_Switch_system_software .

Thanks for all the answers.
Regards,
Michalis

Reply by email

Michalis Kamburelis
to Michalis Kamburelis

The more I was reading about console development, the more I understood that the main problem are NDAs that seem to still "guard" the information about each consoles closed APIs.

This would mean that it is impossible to openly distribute an open-source code interfacing with e.g. PlayStation custom OS. Precluding open-source support from both FPC and Castle Game Engine for the consoles. Any code that uses some API covered by NDA must be closed-source, can be available only to people who also signed the NDA.

I do not know are the NDAs so drastic for all the modern consoles too (Xbox One, PlayStation 4, Nintendo Switch). Xbox One seems to be more open, with things like Universal Windows Platform openly documented.

Ogre3d was facing a similar problem, see
https://www.ogre3d.org/2006/01/08/official-support-for-game-consoles . That said, that post is from 2006, I'm hoping that things are better in 2018:)

Regards,
Michalis

Reply by email

Dmitry Boyarintsev
to Michalis Kamburelis

On Wed, May 9, 2018 at 9:38 PM, Michalis Kamburelis <

Show quoted text 8 lines
wrote: This would mean that it is impossible to openly distribute an open-source code interfacing with e.g. PlayStation custom OS. Precluding open-source support from both FPC and Castle Game Engine for the consoles. Any code that uses some API covered by NDA must be closed-source, can be available only to people who also signed the NDA.

Not sure how much of impact it is for a game engine and/or FPC as is. Unity engine is capable of compiling for PS4. Yet it's distributed freely.

Sure, it's a closed-source, but it doesn't mean that an open-source project couldn't support the closed-source system.
It just requires some company with the business interest in it.

The first step to be done is to have a big game product at the market, compiled with FPC.

thanks,
Dmitry

Reply by email

Marco van de Voort
to Michalis Kamburelis: I am wondering about the possibility to port Castle Game Engine to modern gaming consoles.

In our previous episode, Michalis Kamburelis said:

1. XBox One. It uses an operating system based on Windows 10. As such, maybe compiling FPC programs for it is already possible (or is easy to add)? Maybe I can even just run a normal Windows exe on XBox One?

As far as I know Xbox One uses UWP/WinRT binaries, so the same format as Windows "apps".

Reply by email

R0b0t1
to Michalis Kamburelis: The more I was reading about console development, the more I understood that the main…
Michalis Kamburelis wrote 5 lines
Hi, I am wondering about the possibility to port Castle Game Engine to modern gaming consoles.

Having tried to run my own code on these platforms for many years I have come to the conclusion that any interaction with the platforms you have listed is a commensurate waste of time. Your effort would be better spent targetting ARM based Android or Linux consoles that are seeing a rise in popularity.

Michalis Kamburelis wrote
The more I was reading about console development, the more I understood that the main problem are NDAs that seem to still "guard" the information about each consoles closed APIs.

That depends: https://en.wikipedia.org/wiki/Data_General_Corp._v._Digital_Computer_Controls,_Inc.

Data General Corp. v. Digital Computer Controls, Inc. was a 1971 case in which the Delaware Court of Chancery determined that widespread, confidential disclosure of trade secrets does not necessarily compromise their secrecy.

Show quoted text 6 lines
This would mean that it is impossible to openly distribute an open-source code interfacing with e.g. PlayStation custom OS. Precluding open-source support from both FPC and Castle Game Engine for the consoles. Any code that uses some API covered by NDA must be closed-source, can be available only to people who also signed the NDA.

If you contact MS they may get back to you. Sony or Nintendo not so much.

Cheers,
R0b0t1

Reply by email

Michalis Kamburelis
to Dmitry Boyarintsev: On Wed, May 9, 2018 at 9:38 PM, Michalis Kamburelis < Not sure how much of impact it is…

2018-05-10 4:05 GMT+02:00 Dmitry Boyarintsev :

Show quoted text 15 lines
On Wed, May 9, 2018 at 9:38 PM, Michalis Kamburelis wrote: > > This would mean that it is impossible to openly distribute an open-source > code interfacing with e.g. PlayStation custom OS. Precluding open-source > support from both FPC and Castle Game Engine for the consoles. Any code that > uses some API covered by NDA must be closed-source, can be available only to > people who also signed the NDA. Not sure how much of impact it is for a game engine and/or FPC as is. Unity engine is capable of compiling for PS4. Yet it's distributed freely. Sure, it's a closed-source, but it doesn't mean that an open-source project couldn't support the closed-source system.

The issue is that some console libraries (like PS4 GNMX, their rendering API) are not only closed-source. They are also covered by NDAs that prevent you from openly discussing their API. That is my understanding, from reading the
https://www.ogre3d.org/2006/01/08/official-support-for-game-consoles , confirmed explicitly by https://www.gamedev.net/forums/topic/666961-x/ , and the fact that you cannot find *any* documentation or examples about GNMX on the Internet.

This means that you cannot write open-source code (and distribute it publicly) that talks with GNMX. Such code must be kept secret, and distributed only to other PlayStation devs who signed the Sony's NDA.

Which is not a show-stopper... but it's a real hindrance. I can still write Castle Game Engine renderer targeting GNMX. But this renderer can only be shown to other PlayStations devs who signed the NDA. I cannot just place it in Castle Game Engine repository on GitHub.

Moreover: The developers using C or C++ get a working compiler from Sony, once they sign the NDAs. So they don't worry about interacting with Orbis OS (for stuff like reading files etc.) and generating code for the appropriate CPU. However, we cannot hope that Sony provides a working Pascal compiler tailored to work under PS4 operating system. We can only speculate that hopefully it remains compatible with FreeBSD (from which it was forked), and that FPC support for FreeBSD will work (or will only require minimal modifications).

It just requires some company with the business interest in it. The first step to be done is to have a big game product at the market, compiled with FPC.

I have such company. And we are working on such game :) https://store.steampowered.com/app/746750/The_Unholy_Society/

Regards,
Michalis

Reply by email

Michalis Kamburelis
to Marco van de Voort: In our previous episode, Michalis Kamburelis said: As far as I know Xbox One uses…

2018-05-10 4:08 GMT+02:00 Marco van de Voort :

Show quoted text 9 lines
In our previous episode, Michalis Kamburelis said: > > 1. XBox One. It uses an operating system based on Windows 10. As such, > maybe compiling FPC programs for it is already possible (or is easy to > add)? Maybe I can even just run a normal Windows exe on XBox One? As far as I know Xbox One uses UWP/WinRT binaries, so the same format as Windows "apps".

Aha, so it would be a new target for FPC, right?

Do I understand correctly that at least UWP/WinRT is normally documented by MS, and implementing it in FPC just waits for a contributor who has time to do it? There are no legal hurdles around it?

Thank you everyone for the answers. Keep them coming:)

Regards,
Michalis

Reply by email

Sven Barth
to Michalis Kamburelis

Michalis Kamburelis schrieb am Do., 10. Mai
2018, 05:47:

Show quoted text 18 lines
2018-05-10 4:08 GMT+02:00 Marco van de Voort : > In our previous episode, Michalis Kamburelis said: >> >> 1. XBox One. It uses an operating system based on Windows 10. As such, >> maybe compiling FPC programs for it is already possible (or is easy to >> add)? Maybe I can even just run a normal Windows exe on XBox One? > > As far as I know Xbox One uses UWP/WinRT binaries, so the same format as > Windows "apps". > Aha, so it would be a new target for FPC, right? Do I understand correctly that at least UWP/WinRT is normally documented by MS, and implementing it in FPC just waits for a contributor who has time to do it? There are no legal hurdles around it?

If they are indeed merely using UWP there, then yes, it's "merely" a new target and we'd benefit from it aside from the Xbox as well.

Regards,
Sven

Reply by email

Sven Barth
to Michalis Kamburelis: I am wondering about the possibility to port Castle Game Engine to modern gaming consoles.
Michalis Kamburelis wrote
Hi, I am wondering about the possibility to port Castle Game Engine to modern gaming consoles.

For PlayStation and Nintendo Switch regarding the GPL/NDA stuff you might want to ask them directly:

Sony: https://partners.playstation.com/apex/PO_AccountAppliPTR?lang=en (mentioned at the end of the "Before Applying" paragraph)

Nintendo: https://developer.nintendo.com/web/development/contact (paragraph "Developer Questions")

In contrast Microsoft seems to be indeed very laid back regarding that...

Regards,
Sven

Reply by email