Adventure Game Studio | Forums

AGS Support => Advanced Technical Forum => Topic started by: pell on Sat 21/03/2020 02:33:29

Title: Game file format specification/layout
Post by: pell on Sat 21/03/2020 02:33:29
Where can I find a specification or diagram for the AGS game file format (that is the file or set of files the engine loads)?

I'm looking to develop my own tools and workflow to develop AGS games on Linux without needing to run the editor in Wine (and if there's enough interest, it could become a publicly-released cross-platform editor). I've been going through the source code at the github site and looking at the project files for the editor running in Wine, but is there a diagram or document laying out the format for the AGS game file?

To clarify, I'm not trying to make my own version of the engine (like MonoAGS). I'm making an alternative way of creating a game to run on the standard AGS engine without having to use the Windows-only AGS editor.

Any advice on this will be much appreciated. Also, if this already exists (and is reasonably functional) I'd be happy to hear it.

Note: I don't know if this should go in "Other Engine & Editor Development", but the main topic of the thread is the file format, not the tools I'm working on.
Title: Re: Game file format specification/layout
Post by: Crimson Wizard on Sun 22/03/2020 14:35:04
Hello.

Building a cross-platform tools has been a request for a while, and there is a number of tasks planned currently to make this easier by splitting certain processes from existing editor into stand-alone tools (like moving compiler out, in which case it may also be made a cross-platform program). From what I know, there's currently on an on-going attempt to change source room file format into XML instead of a binary blob it is now (and only create binary data when compiling the game), which may also help making editing process more transparent and easier to hook alternate tools up.
A lot may have to be said about this, so I won't go into much detail now. Just thought I'd mention this, in case you may be interested to participate in that too.


Regarding your question, I am not aware if anyone ever created a specification for this format, so everything has to be uncovered from the code.

AGS engine reads data either from the package or directly from disk. In any case, there are various files of data, which have to be named properly, found either on disk or inside a "library" pack.

Library format is dealt with in the following code:
https://github.com/adventuregamestudio/ags/blob/master/Common/util/multifilelib.h
https://github.com/adventuregamestudio/ags/blob/master/Common/util/mutifilelib.cpp

The start is a "main game data" file, which is dealt with in this code:
https://github.com/adventuregamestudio/ags/blob/master/Common/game/main_game_file.h
https://github.com/adventuregamestudio/ags/blob/master/Common/game/main_game_file.cpp
This is also where Editor is writing "main game data" (in C#):
https://github.com/adventuregamestudio/ags/blob/master/Editor/AGS.Editor/DataFileWriter.cs

The room file code:
https://github.com/adventuregamestudio/ags/blob/master/Common/game/room_file.h
https://github.com/adventuregamestudio/ags/blob/master/Common/game/room_file.cpp

There are few additional ones, which I could've forgotten, but above is a main thing.
Title: Re: Game file format specification/layout
Post by: pell on Tue 24/03/2020 02:11:11
Thank you for the detailed response, Crimson Wizard. I had found the main_game_file.* in the engine code, but I hadn't gotten to DataFileWriters.cs yet. Hopefully the work I do here will be helpful in other projects. I'll post my progress as I go.
Title: Re: Game file format specification/layout
Post by: eri0o on Mon 20/04/2020 21:32:42
Hey, are you still alive doing this? I have a bunch of stuff I can share and point to you.
Title: Re: Game file format specification/layout
Post by: pell on Mon 20/04/2020 22:48:04
Quote from: eri0o on Mon 20/04/2020 21:32:42
Hey, are you still alive doing this? I have a bunch of stuff I can share and point to you.

Yes, although I'm doing my first AGS game for MAGS right now. I'm running the editor in Wine in a 32-bit version of Linux in an emulator. If I could package up a game file in the format the engine requires, I could develop games on Linux without need of the Windows editor. For starters I'd be writing scripts in a text editor, using Gimp for backgrounds and regions, and maybe some small programs to help manage all the configuration options. But if there's enough demand for a dedicated application like the AGS Editor, I might be willing to work on that.

I would appreciate any help you can give me on this.
Title: Re: Game file format specification/layout
Post by: Crimson Wizard on Mon 20/04/2020 22:59:37
Quote from: pell on Mon 20/04/2020 22:48:04If I could package up a game file in the format the engine requires, I could develop games on Linux without need of the Windows editor. For starters I'd be writing scripts in a text editor, using Gimp for backgrounds and regions, and maybe some small programs to help manage all the configuration options.

There is a number of problems that currently prevent user from compiling a game using a stand-alone script compiler (which already exists as a preliminary experiment).

To give an example: some parts of the script is currently generated by the editor: script API declarations, dialog scripts from Game.agf, plugin API, maybe something else if I forgot.

There's a project (kind of group of tickets) opened in our repository to track this kind of issues: https://github.com/adventuregamestudio/ags/projects/1

In general, we'd want to move to open (text based) source formats for everything (rooms, etc), resource files taken directly from directories instead of being cached in a binary blobs (like sprite file currently), and separate tools each doing its own small job, which could be chained in a compilation pipe to produce the game.

There may be other associated tasks, like storing compiled script in a slightly different way inside game package, to ease its update, as currently it's saved in the middle of the game data, and thus its address offset changes with every game format update.
Title: Re: Game file format specification/layout
Post by: pell on Mon 20/04/2020 23:20:02
Quote from: Crimson Wizard on Mon 20/04/2020 22:59:37
Quote from: pell on Mon 20/04/2020 22:48:04If I could package up a game file in the format the engine requires, I could develop games on Linux without need of the Windows editor. For starters I'd be writing scripts in a text editor, using Gimp for backgrounds and regions, and maybe some small programs to help manage all the configuration options.

There is a number of problems that currently prevent user from compiling a game using a stand-alone script compiler (which already exists as a preliminary experiment).

To give an example: some parts of the script is currently generated by the editor: script API declarations, dialog scripts from Game.agf, plugin API, maybe something else if I forgot.

There's a project (kind of group of tickets) opened in our repository to track this kind of issues: https://github.com/adventuregamestudio/ags/projects/1

In general, we'd want to move to open (text based) source formats for everything (rooms, etc), resource files taken directly from directories instead of being cached in a binary blobs (like sprite file currently), and separate tools each doing its own small job, which could be chained in a compilation pipe to produce the game.

There may be other associated tasks, like storing compiled script in a slightly different way inside game package, to ease its update, as currently it's saved in the middle of the game data, and thus its address offset changes with every game format update.

I had a feeling there were binary blobs to worry about. That's where I'll be focusing my attention when I get back to the source code. The editor also compiles the engine into the binary file, but I wonder if the engine would work without that.

Still, I know older games work with current engines. I played "5 Days a Skeptic" on the most reason version of the engine built from source.
Title: Re: Game file format specification/layout
Post by: Crimson Wizard on Mon 20/04/2020 23:30:23
Quote from: pell on Mon 20/04/2020 23:20:02
The editor also compiles the engine into the binary file, but I wonder if the engine would work without that.

Yes, it will work without merging exe with game data. This is how all ports work, but windows version can work very well too (as you pointed out).

For instance, current Editor creates a stand-alone game data in Compiled/Data first, before merging acwin.exe as a separate step.


PS. I also would like to note that there's a planned big meating of developers, where they want to discuss further development of the Editor and its main goals, so probably some decisions on above problems will also be taken.