adventuregamestudio / ags

AGS editor and engine source code
Other
707 stars 159 forks source link

Game building tools (master ticket) #2316

Open ivan-mogilko opened 10 months ago

ivan-mogilko commented 10 months ago

This is a master ticket for tasks related to decoupling game compilation from the Editor. The final goal is to have a minimal set of standalone tools enough for compiling a game data package from the game project sources. The previous ticket on this topic: #872, it contains a discussion and records first steps in this direction. The general consensus was to write standalone command-line programs in C++, as that's something that may be compiled and run almost everywhere without big dependencies, and may reuse parts of the existing engine's code. There have been a number of tools created since (see Tools dir in our repo), pretty much enough for compiling the game scripts, but not covering all required tasks for creating game data. Several tools more have to be done, and some of the existing ones may need adjustments.

Please note that this ticket is dedicated to writing tools, not replacing a build process in the Editor. That should be a separate task. In theory, replacement may be done in steps too, so long as that is convenient; but that's a topic for another discussion.

All the sub-tasks for this goal are assigned to a "Minimal standalone tool set" milestone. There's also a github "project" created, as an experiment for tracking the related tasks: https://github.com/adventuregamestudio/ags/projects/1 A wiki page I wrote, with a table of all the build steps, input and output data, which may help understanding the building process: https://github.com/adventuregamestudio/ags/wiki/AGS-Game-Build-process-(3.5.*)

Above explains ags3 workflow, ags4 may have certain changes, primarily due to change in room format.

Following are lists of required tasks, separated into categories.


Priority tools (required for both ags3 and ags4)

These are must have for building a game from a source.

Secondary tools

These are tools that may be skipped when just building the game from "full" project state, but they are still required in order to get the project into this "full" state.

Tools specific for ags4

Above lists may be amended if more tasks are required.

Auxiliary tasks

There's an issue of extra dependencies of game structs declared in Common dir. These structs, and their serialization functions presumably should be reused by the tools in order to avoid code duplication. But there's a number of things these structs are connected to, which ideally should not be linked in tools.

First of all, this is Bitmap class, that is used for drawing, and which brings a large part of Allegro graphics library. There are two ways of dealing with this (that I see):

  1. [DONE in #2435] Introduce a simpler struct that would hold image metrics and pixel data, but won't have any drawing methods. E.g. "BitmapData". Use this struct in image loading/saving functions. Make it so that Bitmap class is constructed by either copying pixel data from BitmapData, or wraps it; in the latter case Allegro's BITMAP struct should be initialized by us, having its pixel array pointers directed to BitmapData's contents.
  2. [NOT NEEDED ANYMORE?] Write a separate variant of Bitmap class which drawing methods do nothing, and include & link it in programs that do not need full drawing support.

Then, some classes, such as GUIs, have methods that are meant for runtime: drawing and update. These will be useless in tools, and again bring more dependencies. Possibly, we could have structs containing only GUI and GUI control's serialized fields, as suggested in this draft on engine refactor: https://github.com/adventuregamestudio/ags/wiki/AGS-4-Draft:-major-engine-refactor#game-data-classes

For related problems see also: #1833, #1834, #2058.

ericoporto commented 2 months ago

In the auxiliary tasks, the bitmap data task was done in https://github.com/adventuregamestudio/ags/pull/2435