AGS engine Linux port

Started by Crimson Wizard, Wed 02/02/2022 18:00:39

Previous topic - Next topic

Crimson Wizard

The old forum thread may still be found here. Please beware that it was started many years ago and may contain alot of outdated information.

This new thread is dedicated to discussing the Linux port of AGS engine. Following is a brief cover of the topic.



AGS engine runs on 32-bit and 64-bit Linux.
To run AGS games on Linux you need the Linux engine and a game data.
The same game data may be run by any engine port. Some ports require repacking it up in certain way (e.g. packing into APK for Android). For Linux this is not necessary.
Note that you may even use games created for e.g. Windows, because Windows version of a game is usually just an engine exe with game data appended to it. Normally any engine port can detect the game data in a file and load it up itself.

Currently the v3.x.x engine branch supports running games created with AGS 2.50 and higher.

If you have an engine executable coming with the game itself you may run it, or use a startup script supplied by the game authors.
If you have an engine installed on your system, all you have to do is to go into the game's directory and run the engine from there. Alternatively: run the engine, passing path to the game dir as a command line argument.

More information about command line args and runtime configuration may be found in our repository:
https://github.com/adventuregamestudio/ags/blob/master/OPTIONS.md



Building games for Linux in the Editor

When you compile your game using the Editor, it produces "raw" game data in Compiled/Data directory. These files alone may be enough to run a game using an engine port.

However, Editor also comes with an optional feature that lets you deploy for Linux using a prebuilt Linux engine and libraries. Please note that these will normally run only on Debian and related systems (Debian, Ubuntu, etc). For other systems you, or your users (players) would have to either build an engine from sources or get one from the system's maintainers (see more info below).
To use this feature make sure you have installed the "Linux build component" along with the editor. This creates a "Linux" subfolder inside the Editor's program folder. After that a "Linux" option will become available for selection in "Build targets" list in the General Settings of your game project. The compiled game for linux will be placed into Compiled/Linux folder.

KNOWN ISSUES

1. As of time of writing, because the linux files will be deployed on a Windows machine, the engine and launch scripts will loose their "executable" flags. The only known solution currently is to move these files onto the Linux machine and set this flag there before creating an archive. Alternatively, the users themselves may do that after your game's installation.

Following are commands that you must perform over the game distributive on a Linux machine:
Code: bash
chmod +x data/ags32
chmod +x data/ags64
chmod +x gamefilename
where "gamefilename" is the game's file name, and also the name of the launcher file in the root of game's package.

2. If your game uses any engine plugins, you MUST supply linux variants of these. If these are not available, the only workaround is to modify the script of your game specifically for Linux version to avoid relying on these plugins or using any plugin's commands. Otherwise the game won't run correctly, or at all.



Getting a stand-alone Linux engine

There are roughly 3 ways you may get a Linux engine onto your system.

1. Our build server makes engine binaries and Debian packages, runnable on Debian and related systems.These may be downloaded from Releases section of our repository:
https://github.com/adventuregamestudio/ags/releases

2. Some system maintainers may include ags engine into the official list of packages; in such case you may install the engine using your system software. Usually that may be found using a package manager on your OS, or asking system maintainers for information.

3. If nothing of above works, or you simply want to, you may build the engine yourself from the sources.
Our repository is: https://github.com/adventuregamestudio/ags
The information on Linux port may be found here: https://github.com/adventuregamestudio/ags/blob/master/debian/README.md

We have a Makefile, so if you prefer using make, then it may be as easy as
Code: ags
cd Engine
make
(assuming you have all the dependencies installed)

If you prefer CMake, then refer to https://github.com/adventuregamestudio/ags/blob/master/CMAKE.md

If you encountered bugs or have feature suggestions, you may open an issue in our tracker.



Any other useful information may be added to this post later.

cibersheep

Hi!
I'm helping the SST remake with a translation but we seem to get random output depending on the host machine.

I'm using Ubuntu 20.04, the developer of the game uses Windows. I send him the translation files and he compiles everything.

-When he plays on Windows translation to Catalan is full
-When I do the same with the same build on Linux, I get mixed untranslated/translated strings
-Same result (mixed strings) if I test the same build on the web engine.

What would be the next steps to find the possible issue?

Crimson Wizard

Quote from: cibersheep on Sun 05/03/2023 16:02:58Hi!
I'm helping the SST remake with a translation but we seem to get random output depending on the host machine.

I'm using Ubuntu 20.04, the developer of the game uses Windows. I send him the translation files and he compiles everything.

-When he plays on Windows translation to Catalan is full
-When I do the same with the same build on Linux, I get mixed untranslated/translated strings
-Same result (mixed strings) if I test the same build on the web engine.

What would be the next steps to find the possible issue?

This is a strange issue, where translation not fully works or fully not works, but works only partially.

I don't have a lot of immediate ideas, but to start somewhere, there are few questions:

Are the non-working lines same all the time?
Can you compare the tra files (e.g. by size) to see if these are indeed identical in both windows and linux/web build?

If I understand correctly, you are using AGS 3.6.0 Editor (judging by the web port). Is your Text Format in this game Unicode or ASCII (may be found in Game Setiings)? What about the translation source format (TRS file)?

cibersheep

Quote from: Crimson Wizard on Sun 05/03/2023 19:27:02This is a strange issue, where translation not fully works or fully not works, but works only partially.

I know it is a bit difficult to debug.

Quote from: Crimson Wizard on Sun 05/03/2023 19:27:02I don't have a lot of immediate ideas, but to start somewhere, there are few questions:

Are the non-working lines same all the time?
Yes they are. Same lines every time I run the game, and between both engines linux and web

Quote from: Crimson Wizard on Sun 05/03/2023 19:27:02Can you compare the tra files (e.g. by size) to see if these are indeed identical in both windows and linux/web build?

It is the same file (we are sharing it) and it is available online (the windows build): https://emabolo.itch.io/super-star-trek-25th

and using the Linux engine from github: https://github.com/adventuregamestudio/ags/releases/tag/v.3.6.0.43

Quote from: Crimson Wizard on Sun 05/03/2023 19:27:02If I understand correctly, you are using AGS 3.6.0 Editor (judging by the web port). Is your Text Format in this game Unicode or ASCII (may be found in Game Setiings)? What about the translation source format (TRS file)?
The dev using Windows machine is using 3.6.0.43 editor indeed (is it a way to build the project in Linux? Or at least the translation trs<->tra?)

I have double checked: trs file is a plain text using utf-8 unicode and Windows end of lines

The most puzzeling fact is other translations (Czech for example) work as expected.

Thanks

Crimson Wizard

Well, the fact that the translation works on Windows means that tra is at least built correctly, as this data is used equally everywhere. (At least supposed to...)

Quote from: cibersheep on Sun 05/03/2023 21:00:32It is the same file (we are sharing it) and it is available online (the windows build): https://emabolo.itch.io/super-star-trek-25th

I might check that out. But I see that Linux version is not available for download yet, do you test the Linux build prepared in the Editor, or combine the game files with linux engine port by hand?

Also, could you please tell, how do I reproduce this problem on Linux; what is the easiest way to get there?

Crimson Wizard

Oh, I actually just spoke with the game author on AGS Discord, so I might also ask him some questions.

cibersheep

Quote from: Crimson Wizard on Sun 05/03/2023 21:45:28Well, the fact that the translation works on Windows means that tra is at least built correctly, as this data is used equally everywhere. (At least supposed to...)

I'm comparing the trs file from Czech (ascii/eol windows) vs Catalan (utf8/eol windows)

Czech looks more complete but also some of the strings are not translated only on Linux. I'm thinking: may the strings in the game and the strings in the trs be in different case? That would be ignore on Windows but not on Linux, right?

Quote from: Crimson Wizard on Sun 05/03/2023 21:45:28I might check that out. But I see that Linux version is not available for download yet, do you test the Linux build prepared in the Editor, or combine the game files with linux engine port by hand?

I combine the game files by hand

I did a zip file: https://we.tl/t-5wj68cxzUQ

Quote from: Crimson Wizard on Sun 05/03/2023 21:45:28Also, could you please tell, how do I reproduce this problem on Linux; what is the easiest way to get there?

-Download the file
-unzip the content

and do one of those

-edit data/acsetup.cfg editing line
Code: ags
translation=
to
Code: ags
translation=Catalan
and save file
-double click on startgame

or

-open a terminal and do:
Code: ags
./startgame --translation=Catalan


cibersheep

Once in game (after introductory text, which looks half translated) tap on Energy (center top of the screen)

On Windows looks translated


On Linux looks in English

Crimson Wizard

#8
Quote from: cibersheep on Sun 05/03/2023 22:09:46I'm comparing the trs file from Czech (ascii/eol windows) vs Catalan (utf8/eol windows)

Czech looks more complete but also some of the strings are not translated only on Linux. I'm thinking: may the strings in the game and the strings in the trs be in different case? That would be ignore on Windows but not on Linux, right?

You are probably referring to the differences in name case in filesystems? There's no relation to this, the TRS must have lines 100% identical to the lines in script, including letter case. This is the internal engine logic, it does not depend on platform you're running on.

EDIT: again, supposed to... unless there's some error there.

Crimson Wizard

#9
So, I found a bug in the engine, which happens when:
1. You have a ASCII format game and UTF-8 format translation.
2. You're running on system where original game's ANSI locale is not supported (or maybe the locale's name is not correctly defined for that particular system)*
In such case the engine makes a mistake an randomly corrupts some of the translation keys.

I'll be fixing this bug soon.

condition 2 - that's an issue on its own, and we'll hopefully look into this later; but it only matters if you are using extended ASCII/ANSI characters in your original game text.

Also, if this is a game you're making in 3.6.0, my recommendation is to convert to Unicode format anyway, which would help to avoid all these problems altogether.

eri0o

@cibersheep , can you test if it's solved in the new AGS release for you (3.6.0.44 release) ?

cibersheep

Quote from: eri0o on Mon 06/03/2023 13:38:26@cibersheep , can you test if it's solved in the new AGS release for you (3.6.0.44 release) ?

It works perfectly on Linux. Thank you!


cibersheep

I have tested also with the web engine. It works as well :)

eri0o

Thank you @cibersheep !! If you find any problems, please let us know!

Crimson Wizard

Can someone please remind me, what are the commands that you must use to mark game executable for Linux?
I noticed that this information is missing in the first post here.
(Also it's still missing in the manual, which is unfortunate).

Is this it, or am I missing anything:
Code: ags
sudo chmod +x data/ags32
sudo chmod +x data/ags64
sudo chmod +x gamename

eri0o

#15
It's that but I think it should work without sudo.

But if you intend to ship the game to someone else after only doing that you need to use something like tar.gz that would preserve the executable bit flag.

If you are shipping without packaging using something like Steamworks , then I believe Steamworks defaults to 755 for all files - alternatively you can specify using it's packaging language.

eri0o

#16
Just wanted to give a small note here for Gamedevs using Steam, it appears there is a new pane in Steamworks, since docs haven't been updated I will just explicitly write about it here

Steamworks -> Apps & Packages -> Select your game -> Installation -> Linux Runtime (this is new!)
Now you can set your mapping between the Linux Runtime and the branch of your App

The Linux Runtime is a container (like?) environment where the Linux game runs and one thing it does is it enable you to compile your game in a container and then have the game run in the same container in the user machine. AGS Linux binaries are built using a very old Debian Jessie container, for both 32-bit and 64-bit builds.

By using the containers you could have AGS (and plug-ins) built using a newer compiler and having access to newer libraries.

https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/container-runtime.md

This lowers pressure in AGS side to keep compatibility with really old debian, I think, but this also requires the Gamedevs to pay attention to how these runtimes work.

The default if you as a dev do nothing is that Steam will use Scout, which is the Ubuntu 12.04 compatible container - it is compatible with the current Linux binaries we deliver so there is no need to rush to do anything right now. It is a twelve years old distro though, so we can think later about upgrading to something newer that has compatibility with a newer container - but it would require Gamedevs to configure this on release since it seems Valve isn't going to change the default soon.

SMF spam blocked by CleanTalk