Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Targeting Librem 5!

A topic by Macoy created Jun 06, 2024 Views: 589 Replies: 17
Viewing posts 1 to 13
Submitted

Hi all!

I am planning on targeting the Librem 5 using Wayland, EGL/OpenGL, and C. This should be a real lean-and-mean setup for experienced devs or those interested in seeing what’s at the “bottom” of a Linux game engine.

If anyone else is interested in going this route, I can share my initial setup code.

I like to encourage game development without engines, which is why I’m posting this.

I’m excited to see the theme and what we all end up doing!

Submitted (1 edit)

iIf time permits I’ll go for haptics (vibration) as well. I forgot about sound, so I’ll have to do some research on what the lowest API is for it on the Librem 5.

Needless to say, the game will use the touch screen via Wayland’s touch API.

I’m definitely interested in seeing your initial setup code and workflow (do you have a Librem already or are you going to be using the emulator?)

I’m not sure if I’ll actually use it since I already had plans to this jam as a chance to use my PortableGL but maybe I can use it directly with Wayland instead of just going with my default of SDL2 and your setup code might help with that. Either way it should be fun to force myself to actually finish a game and release it for once, even if I plan on a relatively simple 2D one atm.

Also are you going to be using Cakelisp or C directly? Or both?

Submitted

I’ll link to my code here once I write it! I have a Librem 5.

Isn’t your PortableGL a software renderer? If so, you can directly create a pixel buffer from Wayland.

When I was writing a keyboard for the Librem 5 I made this file which will be what I base the game’s Wayland code off of. At the very bottom of the file it shows a nice workflow thing, which is generating the headers from the protocol XML as part of the Cakelisp build process.

I will be using Cakelisp, but because it transpiles to C I can share the transpiled results for others to use. I will of course be using some 3rd party C headers/libraries as well. I usually reach for SDL2 but lately I’ve wanted to move away from it for startup performance, reduction of dependencies (my holy grail is a 100% static linked 3D accelerated application), and for learning purposes.

Deleted post

Perhaps a bit of a presumptuous ask, but would anyone happen to have experience with programmatic use of the camera on the Librem 5? I was wanting to incorporate photo capture into my game, but I've immediately run into a bit of a roadblock testing the gphoto2 python library. Attempting to run the capture-image example file spits out a bunch of "-6 Unsupported operation" errors. If anyone has any suggestions on alternative methods, I'd be happy to try anything, since even a complex solution is probably less effort than reworking my game idea.

Thanks in advance and sorry if I'm not supposed to be hijacking the thread like this.

Submitted

I think Millipixels is the camera application on Librem 5. Check the ReadMe and refer to the code there. Otherwise, I’d ask the community/librem-5 room on Matrix.

Submitted

I am excited to see it!
I too plan on targeting the L5, but I have ZERO game dev experience and am going the easy route with PyGame, I think.

If the worst thing that comes out of this game jam is a few silly games to try on my phone, I would consider it a success :).

Submitted

An update: I was going down the rabbit hole of trying to static link the entire game. It’s proving to be about as hairy as one would expect–I’ve got Musl LibC static linked, now I’m attempting to build Mesa and LibDRM from source to avoid the libGL dynamic load.

For now, I’m going to focus on making the game, and then come back to the lean setup. I need to make sure I have something worth playing before I work on what it’s built on.

I have a “Platform SDL” that wraps all the SDL code, and I hope near the end of the jam to replace it with a “Platform Wayland Static”. If I run out of time on that I’ll still have a game which uses SDL and runs on the phone.

Deleted post

I'm going to make a web game playable on desktop and phones. The Firefox ESR browser that ships with Librem 5 seems to think it's running on a laptop computer, but other than some ugly device-sniffing, I'm hopeful things will work out..

Submitted

I had to convert all my shaders to support GLSL ES 1.0, and then made some small tweaks to my API calls. The most unfortunate was not having glDrawArraysInstanced, which is unfortunate both for a convenience as well as performance. It didn’t get introduced until well after GL ES 2.0.

But I did manage to get everything rendering after that, and so far performance has been good. I’m still on my SDL “platform”, but I think it’s now essential that I get rid of it on account of how many weird things happen with the window manager:

  • If I switch to another application and then switch back, the software keyboard opens, resizing the game to a tiny window. I tried setting SDL “hints” about this to no avail.
  • I can’t get a fullscreen window to be the correct resolution. It always seems to be the “low DPI” mode, despite my telling SDL high-DPI is supported and passing 1440x720 to the create function.
  • SDL doesn’t seem to have any working way to set landscape or portrait modes. I want to force landscape for the game, but it’s not possible to do so without collaborating with the window manager.

I am confident using Wayland directly will solve these problems.

Deleted post
Submitted

I didn’t end up having time to develop straight against Wayland/EGL/etc., so my submission stuck with SDL.

Overall the Librem 5 wasn’t too bad to develop for. There are three things that created more work than a regular Linux desktop:

  • The portrait/landscape/fullscreen never quite worked how I wanted it to. I ended up just telling the user “Turn your device to landscape” rather than doing the too costly refactor of the game to work in portrait.
  • OpenGL ES 2.0 is a bit limiting. I had to de-instance my GL code as well as port my GLSL to GLSL ES. Framerate seemed to be okay; when the models are large on-screen the librem dips to 50 hz, but normally it sticks to 60hz.
  • The phone gets hot very fast while the game is running. I would love to hear what the Purism devs suggest I do on my end to fix this. I could frame-cap to 30 hz instead, which would be worth it if it makes the game playable for long periods rather than overheating in maybe 15-20 minutes.
Deleted post
Submitted

I did release my game, it’s Bunny Semiconductor. I also had big delays from life that took most of my week 3.

Deleted post
Submitted(+1)

Oh, and a gripe about the Linux/Gnome experience: Why is it so hard to run an executable? It would be nigh impossible for any non-technical user to download and run the games submitted here.

Mine is misinterpreted as a shared object, so clicking it from the file explorer (Nautilus? Something else?) in PureOS opens a dialog “No application is installed to open shared objects”. However, I also tried another submission which is somehow understood by the file explorer to be an executable. Humorously, the dialog then says “No application is installed to open executables”. That’s right, no app is installed because the operating system itself does that!

Then there’s also the “open properties, permissions, mark as executable”, which also is difficult for non-techies. On Librem 5 the file browser is still pretty hard to use (e.g. I can hold to open the context menu, but can’t seem to tap on Properties once it is open), so I didn’t even attempt to go through this process.

I don’t expect us to solve any of this here, I just wanted to vent.