Reflecting on room crm files and question

Started by eri0o, Wed 27/09/2023 14:46:59

Previous topic - Next topic

eri0o

I have been thinking on the design of room CRM files.

For some reason room files uses sprites stored in itself instead of reading the spritefile, these are the masks (Walkable areas, Regions, Hotspots and Walkbehinds) and the room backgrounds (up to 5). My guess is this is made so it's easy to share them and directly use them as room templates.

Is it better for resource management in the engine side to keep these in the room file instead of the spritefile (you never need the background/mask from one room in the other room)?

Now for a more practical question.

Recently Deflate was added as a compression option for sprites. Let's say I select deflate in the general setting. Are the sprites in the room files using deflate or do they use something else? Is it possible to detect if any of these room sprites is just empty black with all zeroes and instead store a hint there?

Crimson Wizard

#1
Quote from: eri0o on Wed 27/09/2023 14:46:59Recently Deflate was added as a compression option for sprites. Let's say I select deflate in the general setting. Are the sprites in the room files using deflate or do they use something else? Is it possible to detect if any of these room sprites is just empty black with all zeroes and instead store a hint there?

The rooms historically use LZW for backgrounds and RLE for masks.
I've been thinking that rooms could use Deflate for backgrounds too now since it's supported for sprites, but that slipped out of my mind.
That would require adding an compression type info into the CRM, because CRM is self-described, and should work separate from the game settings too.

eri0o

About the room file format, it would be nice if it could include a 32x32 icon or if there was an easy way to read it and generate some sort of thumbnail for it (maybe with multiple rectangles overlapping), just thinking it would be nice to have an alternative view to browse game rooms through images, even if very small that only hints the colors used in it, as a visual reference to which room is it. Perhaps this is something that can be done through the editor. This would be useless for non adventure games or games that use other strategies for their scenes but for adventure games using rooms it would give a nice overview of what the game has.

About the icon for the room, I was thinking about what is shown when creating a new room from a template, so that if your template has a background it would get picked up as icon too. But these ideas are not fully formed.

Crimson Wizard

#3
From technical side, the CRM format consists of "chunks", each with its own metadata (ID, size), which allows to add anything inside.

Whether it's convenient to store things like "thumbnails" inside CRM itself is an open question.
As engine today does not have a mechanic of "preloading" anything from a room file, therefore it's more convenient to have "preview" data as separate assets, either custom asset files or sprites.

The room template (*.art) is a standard ags package (CLIB type), so it already may include additional files, similar to game templates.
BTW this reminds me that in ags4 the room templates should contain Room folders instead.

Personally, I think that it's more beneficial to move towards having 1 package layer (clib format, or else) with assets as files inside, and support subfolders which let group related assets together (for example: room data as file 1, room script as file 2, and any additional data as their own files).

eri0o

Uhm, yeah, perhaps such thumbnail is best stored outside so it's easy to get all of them and present fast.

The thing with rooms that I have been thinking about is that it's a little hard in projects with lots of rooms to navigate and have a grasp of how your game "map" is looking. I usually maintain external images where I copy paste all rooms backgrounds in either Gimp or PureRef so I can get a feeling of the general of the game. I don't expect this overview map if generate in AGS to have the same flexibility but I was thinking what could be done on the cheap that would enable you to click and load a room but also have a general overview of how the game is coming together.

Of course I don't have an answer for this, I thought about looking into the room script object to collect all ChangeRoom calls and see if they point a number and also to create a three color palette of the most used colors on each room and then using distance between colors and the change rooms that happens to use direct numbers to estimate how to best position the rooms in such overview. But this looks hard to pull in algorithms and expensive to calculate and keep updated. So I am leaning towards just icons in squares side by side in room number order.

Anyway, went really away from the original thing, just because I have been thinking about this for some time now and haven't got any ideas.

Alan v.Drake

Quote from: eri0o on Thu 28/09/2023 12:47:17Of course I don't have an answer for this [...]

I made a node-like system where I declare all doors and which rooms they link, and it's all simple textual data in a TSV file, which could be used to generate a graph.

I ended up needing that both to track position/direction when arriving from another room, and tracking door locked status for the minimap.
It's tempting to link rooms directly, but then you may stumble into the case of having multiple entrypoints between two rooms, and then everything falls apart.

- Alan

SMF spam blocked by CleanTalk