Godot Engine port for SailfishOS

First, The link to old thread of this port on together.jolla.com

Godot Engine logo

Godot Engine

Homepage: https://godotengine.org

2D and 3D cross-platform game engine

Godot Engine is a feature-packed, cross-platform game engine to create 2D and
3D games from a unified interface. It provides a comprehensive set of common
tools, so that users can focus on making games without having to reinvent the
wheel. Games can be exported in one click to a number of platforms, including
the major desktop platforms (Linux, Mac OSX, Windows) as well as mobile
(Android, iOS and SailfishOS :smirk: ) and web-based (HTML5) platforms.

Known bugs

  • not work with jolla 1 (but it not supported any more)
  • screen blanks when you not touch them (i know how fix it using MCE dbus messages, but dont have time for this)
  • no GLESv3 support (GLESv2 only)

What is done

  • export templates for armv7hl, aarch64 and i486
  • builtin support export to SailfishOS from Godot Editor
  • with SDL version < 2.0.18 not work changing screen orientation ( while 4.4 it comming, i’ll try rebuild godot tempaltes with included SDL2 as static component )

How to port your game to SailfishOS

Here is instructions
In short:

P.S. this just mine old release, with some fixes for latest SaiflishOS (4.3.0.12 at this moment), if SailfishOS support GLESv3, maybe i’ll try update port to latest Godot 3.x with GLESv3 or to Godot 4 :open_mouth:
if you want, you can donate ( liberapay, paypal ) to me :smirk_cat:

my other interesting ports:

my open repos page

19 Likes

Just mentioning that OpenGL ES 3 support has been available in Sailfish OS since release 3.4.0. Also Vulkan API support is coming once I finish the libhybris test program for it.

5 Likes

awesome! thank you! :heart_eyes:

Thanks! I’ve been meaning to try your godot port for over a year! First, tuxracer :wink: debugging, though!

really good news!!! i’ll try GLES3 soon as possible )
and when vulkan avaliable, i’ll try port Godot 4 (its use vulkan as main render, and GLES3 for supporting old devices)

1 Like

strange thing with built in SDL2 … now, it wont send SDL_DISPLAYEVENT to application ( to Godot port ) , i cant now rotate device screen…
butold build of SDL2, which is linked statically yo Quake 2 works fine with this event, but now not work Application orientation hint ( its works on 3.x versions fine, not 4.x )

what happens with SialishOS SDL2 version& and where old SDL2 repo?

I have to pipe up and ask to. I haven’t had time to work on it, and so far my SDL2 prototypes still work (started with 3.4, not at 4.3.0.15) BUT I’m only using audio to this point … where can we track changes? I looked on github …

old sailfishos sdl2 repo was disappear some time ago, dont know what SDL version is used now (i think it main stream SDL2, without ay special SailfishOS patches), because mine old SDL2 with all sailfish patcher work better in quake2 port )

Source code for the SDL used in Sailfish OS is at https://github.com/sailfishos/libsdl the latest public release 4.3.0 has version 2.0.16 and next release will still have that version also. I will then update it latest version in the Sailfish OS release after that. There is one patch in the repo (in rpm folder) for Sailfish OS to bring back wl_shell support we still need.

2 Likes

@mal
but

sfdk engine exec sb2 -t SailfishOS-4.3.0.12-armv7hl -R zypper search GLES
[D] SOFT ASSERT: "!targetHasSnapshots" in file ../../../../sailfish-qtcreator/src/libs/sfdk/buildengine.cpp, line 722
Loading repository data...
Reading installed packages...

S  | Name                          | Summary                            | Type
---+-------------------------------+------------------------------------+--------
   | glesplash                     | GL splash screen                   | package
i  | mesa-llvmpipe-libGLESv1       | Mesa libGLESv1 runtime libraries   | package
i+ | mesa-llvmpipe-libGLESv1-devel | Mesa libGLESv1 development package | package
i  | mesa-llvmpipe-libGLESv2       | Mesa libGLESv2 runtime libraries   | package
i  | mesa-llvmpipe-libGLESv2-devel | Mesa libGLESv2 development package | package

no GLESv3 package in SDK …
EDIT:
hm… in /usr/include it has GLES3 folder
and

sfdk engine exec sb2 -t SailfishOS-4.3.0.12-armv7hl -R rpm -ql  mesa-llvmpipe-libGLESv2-devel
/usr/include/GLES2/gl2.h
/usr/include/GLES2/gl2ext.h
/usr/include/GLES2/gl2platform.h
/usr/include/GLES3/gl3.h
/usr/include/GLES3/gl31.h
/usr/include/GLES3/gl32.h
/usr/include/GLES3/gl3ext.h
/usr/include/GLES3/gl3platform.h
/usr/lib/libGLESv2.so
/usr/lib/pkgconfig/glesv2.pc

that mean in GLESv2 library it has GLESv3 too?

strange situation. i was built SDL2 using script from spec, link it as static, and it send SDL_DISPLAYEVENT_ORIENTATION as should, but if i link SDL2 as dynamic lib from repo, its not send orientation events ( and orientation of screen in Godot not change! )
i share my simple SDL2 application for testing this
to build test application binary:

# for static link (SDL2 folder are in same directory as main.cpp
sfdk sfdk engine exec sb2 -t SailfishOS-4.3.0.12-armv7hl g++ -I`pwd`/SDL2/include -lpthread -lwayland-client -ldl -lpulse -lGLESv2 -o sdl2bug main.cpp `pwd`/SDL2/build/libSDL2d.a
# for dynamic link
sfdk sfdk engine exec sb2 -t SailfishOS-4.3.0.12-armv7hl g++ -I/usr/include -lpthread -lwayland-client -ldl -lpulse -lGLESv2 -llibSDL2-2.0 -o sdl2bug main.cpp 

UPD: sample updatedm now screen clear color changed when we rotate phone

1 Like

In most cases, like in Sailfish OS, OpenGL ES 3 support is included together with OpenGL ES 2 support because version 3 is backwards compatible with version 2 so there is no need to have two separate libraries and mesa only has one pkgconfig file for both versions 2 and 3 so development package is also the same for both.

About the display orientation events, support for SDL_DISPLAYEVENT_ORIENTATION events was added to wayland backend in SDL 2.0.18 (https://github.com/libsdl-org/SDL/commit/5cc23868ed335b581c5716e8fb8313495a678ba4) and Sailfish OS 4.3.0 still has 2.0.16 as I mentioned earlier (and unfortunately also 4.4.0 will probably have that version) so if you need support for those events you will need to build your own SDL.

2 Likes

that is sad …
ok. now i’ll just build SDL2 from sailfishos repo, and link is statically to godot…

and, another question, i think you should know answer =)
in Quake2 port, i was use SDL_SetHint(SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION,"landscape"); to set orientation of sailfish system (for right gestures) - and it not work any more (with own build SDL2, where it work on previous versions of Sailfish 3.x )
UPD: sorry, wrote strange thig here berfore, removed! MCE dbus names work as should =)

It was decided that SDL 2.0.18 will be in next release (4.4.0) so you’ll only need to build it yourself for 4.3.0.

About that orientation hint, unfortunately that way is now broken (I have been thinking if there is some way to fix that) but there is another way to set content orientation which I have used in one SDL based game

#include <SDL2/SDL_syswm.h>
SDL_SysWMinfo info;
SDL_VERSION(&info.version)
SDL_GetWindowWMInfo(sdl_window, &info);
wl_surface *sdl_wl_surface = info.info.wl.surface;
wl_surface_set_buffer_transform(sdl_wl_surface, WL_OUTPUT_TRANSFORM_270);

where the parameter WL_OUTPUT_TRANSFORM_270 is one of the values shown here wayland-client-protocol.h source code [include/wayland-client-protocol.h] - Woboq Code Browser and used here https://github.com/sailfishos/qtwayland/blob/mer-5.6/src/compositor/wayland_wrapper/qwlsurface.cpp#L526 but I think that as seen from Qt code it might need to take into account the native display orientation (which probably could be obtained getting the display orientation and display mode information and comparing the width and height) when selecting the value but I have only seen such on some tablets but I haven’t yet tested how the above code would behave on such a device.

4 Likes

another question, now i cant find some dependencies in SDK

sfdk engine exec sb2 -t SailfishOS-4.3.0.12-armv7hl -R zypper search libudev
Loading repository data...
Reading installed packages...
No matching items found.

need libudev-devel for using controllers inside Godot engine … dont want to rewrite this to SDL2 =)

In Sailfish OS systemd-devel package provides libudev-devel package and in it the needed development headers and systemd-libs provides libudev. Maybe zypper doesn’t support searching for the provided names of packages or something but it should work if you add to the spec file “BuildRequires: pkgconfig(libudev)”

1 Like

@sashikknox I edited the orientation hint code example in the earlier comment, it was missing one important line. Please update any code you might have made already.

1 Like

Is the orientation hint broken due to changes at the SDL2 side or changes on the Wayland compositor side? This commit

shouldn’t have broken it, right? Because I am the one who suggested it, I believe.

It is broken because one old custom commit was removed from Sailfish OS qtwayland during an update. That commit used to add back support for the already removed set_content_orientation request (replacing the normal behavior, set_orientation_update_mask which was added at some point to qtwayland and then the old set_content_orientation was removed) of qt_extended_surface interface of qtwayland wayland surface_extension. The old request only allowed one value as parameter so the commit you linked fixes SDL to match normal qtwayland behavior, unfortunately the set_content_orientation_mask request of that interface is not working in Sailfish OS.

1 Like

So if I’m not mistaken, SDL2 should now use set_orientation_update_mask on newer Sailfish OS versions to work properly? If not, what should I change in SDL to get it working again?

So SDL2 should be modified to use

if I’m not mistaken.

1 Like