Recent

Author Topic: [SOLVED] Video game development with FPC — platforms support  (Read 4373 times)

furious programming

  • Hero Member
  • *****
  • Posts: 836
[SOLVED] Video game development with FPC — platforms support
« on: December 30, 2022, 06:10:11 pm »
I'm currently working on a video game, making it using FPC (Lazarus) and SDL2 (I'll switch to SDL3 in the future). Ultimately, this game will be exclusively for Windows, and I will consider supporting other platforms (mostly desktop) in the future. The first release will not take place earlier than in a few years (I plan to release in 2025, but these are only plans).

As far as I know, FPC also supports platforms such as Linux or macOS, so creating a port of my game to other desktop platforms is at least theoretically possible. What about other platforms (e.g. console platforms)? If I wanted to expand my "offer" as much as possible and release versions for PlayStation, XBox, Nintendo Switch, Valve Steam Deck, i.e. for game consoles, will I be able to do it, or will I be forced to rewrite the game, for example, into C language and use other tools than Lazarus and FPC?

Is there anyone here who deals with gamedev and tried to publish their games on different platforms (desktop and console)? I know FPC isn't a popular choice for more serious game development, but IMO it's pretty good at it, with capabilities similar to (or even greater than) C language.

I will be grateful for any helpful information in this matter.
« Last Edit: January 01, 2023, 03:07:39 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2006
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Video game development with FPC — platforms support
« Reply #1 on: December 30, 2022, 06:16:11 pm »
You can later expand Hardware acceleration for different Systems.
When creating, be sure to seperate logic from "what you see".
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Eugene Loza

  • Hero Member
  • *****
  • Posts: 656
    • My games in Pascal
Re: Video game development with FPC — platforms support
« Reply #2 on: December 30, 2022, 06:32:13 pm »
Castle Game Engine supports exporting to Nintendo Switch (a limited-access branch due to Nintendo's NDA), I know that games made with it also were tested and working on Steam Deck (it's a modified Debian-based Linux AFAIK). So this is most certainly possible.

And X-BOX runs on a modified Windows, so also should be not too many compilation issues except for packaging.

I also know there was a PS4 emulator written in FreePascal https://github.com/red-prig/fpPS4 so I believe something inverse is also potentially possible. PS4 runs on some sort of a modified Free BSD according to Internet, which is a valid target for FreePascal. PS5 seems to run on a significantly modified PS4 OS however, I'm not sure how big the changes are - if those can break compatibility with Free BSD or not.
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

furious programming

  • Hero Member
  • *****
  • Posts: 836
Re: Video game development with FPC — platforms support
« Reply #3 on: December 30, 2022, 06:38:15 pm »
You can later expand Hardware acceleration for different Systems.

Hardware acceleration and the entire backend for rendering, sounds, windows, and joysticks is all provided by SDL. And this library officially supports Windows, Linux and macOS.

Quote
When creating, be sure to seperate logic from "what you see".

I know how to write game code — I'm not asking how to write it.

I am asking if it is possible to compile code for console platforms using FPC, mainly platforms used by PlayStation, XBox and Nintendo Switch. I don't know what specific operating systems these consoles have and I don't know if anyone has dealt with such things before. But if any of you have already dealt with this, I'd like to know if it's possible or if there are any bigger problems with it.



Castle Game Engine supports exporting to Nintendo Switch (a limited-access branch due to Nintendo's NDA), I know that games made with it also were tested and working on Steam Deck (it's a modified Debian-based Linux AFAIK). So this is most certainly possible.

And X-BOX runs on a modified Windows, so also should be not too many compilation issues except for packaging.

So it looks like it's possible, given the current cross-platform support of FPC. Theoretically, if I decided to release anything on consoles, even PlayStation and XBox themselves would be a reasonable and sufficient extension, given their popularity.

I'm not very familiar with examples of large games written in Free Pascal, but one of them is Hedgewars, which also uses SDL and is available for download on Windows, Linux, FreeBSD and macOS. So support for desktop platforms is theoretically guaranteed, now it's just a question of whether it can be compiled for consoles.
« Last Edit: December 30, 2022, 06:44:42 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

loaded

  • Hero Member
  • *****
  • Posts: 824
Re: Video game development with FPC — platforms support
« Reply #4 on: December 30, 2022, 07:37:15 pm »
(I plan to release in 2025, but these are only plans).

Why is the release date 2025?
If your goal is just to write games, I recommend checking out Unity.   https://unity.com/
It's cross-platform too, write your game once and then compile the publishable version for windows, ios and android even virtual reality systems for you.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

Red_prig

  • Full Member
  • ***
  • Posts: 143
Re: Video game development with FPC — platforms support
« Reply #5 on: December 30, 2022, 07:52:58 pm »
For ps4, in addition to the official sdk from sony, there is a sdk from the communities: https://github.com/OpenOrbis/OpenOrbis-PS4-Toolchain which can be used as a start. It's probably possible to modify the freebsd fpc target in order to build elf for ps4.

Zath

  • Sr. Member
  • ****
  • Posts: 391
Re: Video game development with FPC — platforms support
« Reply #6 on: December 31, 2022, 01:00:26 am »


I'm not very familiar with examples of large games written in Free Pascal, but one of them is Hedgewars, which also uses SDL and is available for download on Windows, Linux, FreeBSD and macOS. So support for desktop platforms is theoretically guaranteed, now it's just a question of whether it can be compiled for consoles.

The earliest game I know, written in Delphi Pascal, is Legend of Mir 2, a 2D MMO. Written by Koreans in 1999-2001 and is still updated and played by thousands of people in Korea and China. The European servers failed due to money issues, corruption of staff and hacking etc.
It was totally Delphi and used their own code entirely. Graphics used DirectX and also their own component packages for bmp manipulation etc.

Delphi now has it's younger brother in the form of Firemonkey. This is a more recent incarnation using Pascal but is far better suited for modern requirements such as mobile and cross platform. You can write one code and compile for Windows, Android, MacOS, Linux and more.
I know this isn't exactly what you're after for Free Pascal but it's proof that Pascal can do the job.

furious programming

  • Hero Member
  • *****
  • Posts: 836
Re: Video game development with FPC — platforms support
« Reply #7 on: December 31, 2022, 01:06:43 am »
Why is the release date 2025?

Because it's going to be a big game that requires a lot of work. Developing such a project alone, three years is still an optimistic assumption.

Quote
If your goal is just to write games, I recommend checking out Unity.   https://unity.com/

No, my goal is not just to write a game, my goal is to create a masterpiece. Everything I want to do, I can do with Free Pascal right now — implement everything I need, write code the way I want, and optimize it the way I need to achieve the best result and the best performance.

On the other hand, I don't know Unity at all — I've never used it, I have no idea how to create anything in it. Learning all this, i.e. the use of the Unity editor and the programming language used by Unity, will take me months, if not years. The use of a different technology than the one I use every day for over a dozen years is the best solution for me. Not only I can write efficient game code itself and optimize it freely, but I can also use the same technology to create the necessary tools (LCL). If I changed technology and went towards Unity, I would only lose my time.



@Zath: I know that in Delphi it is also possible, that there is Firemonkey, etc. My point is that the entire hardware backend is supported by SDL, on many platforms, so I don't have to program anything myself. I'm just asking if Free Pascal is capable of generating executables for platforms like PlayStation, XBox, Switch, etc.
« Last Edit: December 31, 2022, 01:14:12 am by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

loaded

  • Hero Member
  • *****
  • Posts: 824
Re: Video game development with FPC — platforms support
« Reply #8 on: December 31, 2022, 07:43:33 am »
Because it's going to be a big game that requires a lot of work. Developing such a project alone, three years is still an optimistic assumption.
Understood; You are very ambitious. I wish you lots of patience and success.

Is it possible for you to present a screenshot of your favorite work or a demo if you have one?

I'm also someone who usually uses Pascal for everything. However, sometimes it may be necessary to use different tools.
I used to work with Unity a little bit, my impression is that by taking some time, you can easily handle great works.
I'm writing this because it might be of interest to someone else looking at this post someday.
By the way, a work done by the Unity demo team;
https://youtu.be/-S6J8zm_w1E

Note: I should especially point out that I am not a Unity fan.
« Last Edit: December 31, 2022, 08:01:59 am by loaded »
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

furious programming

  • Hero Member
  • *****
  • Posts: 836
Re: Video game development with FPC — platforms support
« Reply #9 on: December 31, 2022, 01:03:31 pm »
Is it possible for you to present a screenshot of your favorite work or a demo if you have one?

Not yet, because all the work until recently was related to programming things that are not visible on the screen.

So far, I have programmed the handling of windows (maintaining aspect ratio for displaying game frames); display devices and their display modes (windowed, maximized, fullscreen and exclusive video mode support); handling of pointing devices, typing devices and any joysticks (additionally a virtual stick, controlled by a mouse). I also wrote a complex mapper that allows assigning players, any number of input devices and freely configure the controls; plus support for events that update various subsystems of the game; an advanced main loop, performing a constant number of updates per second, supporting a fixed or variable framerate (VSync support) and performing performance calculations. I currently have around 20k lines of code.

Only recently have I been working on the actual game engine, right now on the octree-like structure to store objects in the world. The game will be pixelart, but the world will be three-dimensional, so it will be possible to change the camera (four views, along the two main axes). I don't know how long it will take to program the engine, but once I have something to render in the game window, then I will start my YouTube channel and share information about the progress of work. I already have prepared a channel on YouTube, Twitter and Discord server, so it's only a matter of time before I start using them. I'll let you know when the machine starts.

Quote
I'm also someone who usually uses Pascal for everything. However, sometimes it may be necessary to use different tools.

I thought about all this before I started working on the game. Quite quickly, however, I came to the conclusion that the best solution for me is to use Free Pascal and Lazarus. I want to be able to do low-level programming, so Free Pascal and SDL are perfect for that (same as C+SDL, which is a common choice). SDL is easy to use, I already knew Free Pascal, so I was able to start programming right away, practically without having to learn anything.

The game will initially be exclusively for Windows, later I will consider a version for Linux and macOS, and possibly for PlayStation and XBox (rather only the latest versions). The game will require physical input devices (keyboards, mice or controllers) to operate, so I'm not considering mobile platforms with touch screens at all. The more so that the controls will consist of over a dozen of actions and that the game will support single player mode and local co-op mode for two players (two players on the same screen or one player per screen), so smartphones are out anyway. The best input device to play will be a gamepad similar to PS or XBox controller (with analog sticks and many buttons).

Quote
I used to work with Unity a little bit, my impression is that by taking some time, you can easily handle great works.

Sure, but Unity is a huge piece of software that requires a lot of learning to do everything you need to do and understand how it all works (which is extremely important). Making a game in Unity without understanding how it all works will end badly sooner or later.
« Last Edit: December 31, 2022, 01:18:07 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

loaded

  • Hero Member
  • *****
  • Posts: 824
Re: Video game development with FPC — platforms support
« Reply #10 on: December 31, 2022, 02:49:25 pm »
The game will initially be exclusively for Windows, later I will consider a version for Linux and macOS, and possibly for PlayStation and XBox (rather only the latest versions). The game will require physical input devices (keyboards, mice or controllers) to operate, so I'm not considering mobile platforms with touch screens at all.
I get it, since you put so much effort into it, I hope you get a lot in return for your efforts. The fastest and easiest money in the game industry is on mobile. I think you should consider that too. Still, you know, I wish you good luck in the new year. Respects.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

furious programming

  • Hero Member
  • *****
  • Posts: 836
Re: Video game development with FPC — platforms support
« Reply #11 on: January 01, 2023, 03:06:26 pm »
The fastest and easiest money in the game industry is on mobile. I think you should consider that too.

It's sad, but unfortunately it's true. However, what I care about is a decent product and money earned honestly, not with the help of annoying ads and other infamous mechanisms known from modern game development, which only irritate and make it difficult for players to have fun. I want to create my game in the good old style, without ads, lootboxes, notorious security, and in return give high quality, a lot of content and as much fun as possible. A long time ago it was the standard, today gamedev is incredibly broken.

Despite everything, I still do not take mobile platforms into account, due to the specificity of the controls (to which touch screens do not completely match) and the potential support for cooperative mode (couch co-op on one or two screens).

Quote
Still, you know, I wish you good luck in the new year. Respects.

Thank you very much, and so do you.  8)



In conclusion, from what you wrote, FPC can be used to compile executables for both various desktop and console platforms. So I can safely continue my work without worrying too much about the future. Thank you all for your answers and all the best in 2023!
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8744
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: [SOLVED] Video game development with FPC — platforms support
« Reply #12 on: January 02, 2023, 12:14:52 pm »
Find your favorite console here. Most consoles today are just glorified PCs, they no longer use exclusive architecture, only the OS is different. And even that, it's not that different from desktop OS in terms of binary format.

But yes, please use Castle Game Engine and support it. It's the only one that I see keep progressing rapidly after years of development.

furious programming

  • Hero Member
  • *****
  • Posts: 836
Re: [SOLVED] Video game development with FPC — platforms support
« Reply #13 on: January 06, 2023, 01:52:14 pm »
But yes, please use Castle Game Engine and support it. It's the only one that I see keep progressing rapidly after years of development.

My game may be specific and may require special/unusual optimizations, I need to have full control over it, so I decided to write the engine from scratch, instead of using ready-made solutions. In addition, there will be no need to learn how to use the engine and it will exclude dealing with limitations, which should give me time gain.
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

Paul_

  • Full Member
  • ***
  • Posts: 143
Re: [SOLVED] Video game development with FPC — platforms support
« Reply #14 on: February 01, 2023, 08:14:47 pm »
How many games on Playstation or Xbox are programmed in FPC? That's the real answer to your question.

SDL does not support Playstation and another consoles. There is only port for Nintendo switch and it doesn't mean you can use it out of the box. Only official tools (paid) work there, there is only official chain how develop and publish titles. It's MSVC world. You must use officials libraries.

Even the big tools like Unreal engine or Unity are not very multi-platform friendly.

Edit: PS is Clang, Xbox is MSVC
« Last Edit: February 01, 2023, 09:22:42 pm by Paul_ »

 

TinyPortal © 2005-2018