adventuregamestudio / ags

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

Proposal: add default Region and Walk-area settings to the Room #2129

Open ivan-mogilko opened 10 months ago

ivan-mogilko commented 10 months ago

This idea came to me when thinking about some setting that could be applied either globally for the whole game, or per room, or per walkable area.

AGS currently has certain properties applied to Regions and Walkable areas. I don't mention hotspots and walk-behinds, because hotspots are there only for interaction, and don't affect anything else, and walk-behinds are simply bg cut-outs. But Regions and Walkables affect Characters and Objects standing on them, with properties such as: light level, tint, scaling.

There may be situations when one would like to have whole room applying same effects to characters, or whole room except few places. If there are many areas, it may become a chore to assign identical settings everywhere. But things will become more complicated with continuous scaling property, for example, because if you have a lot of areas you would need to calculate bottom and top scaling levels correctly. And this becomes even more annoying if these areas have complex shapes.

So, what I'd like to propose for discussion is this idea:

This would refer to both in Editor and Script API properties.

Note: at first I've been thinking about using area 0 for this, but technically it's also a valid area, which may apply its settings when character stands on it. At least the walkable area 0 does (I don't remember about region 0).

ericoporto commented 10 months ago

So currently when a character is outside the room area and I want to slide the character in I first scale them to whatever is needed to match the scale of the first pixel they will match once their x,y position is the same as the scaling for what is set in the walkable area. After this change, does the set of default applies continuously to the character outside the walkable area, or only once and I can override by re-setting it?

ivan-mogilko commented 10 months ago

After this change, does the set of default applies continuously to the character outside the walkable area, or only once and I can override by re-setting it?

What I'm proposing is a default that works for the whole room, so long as particular area don't have their own settings. The default room settings would be applied continuously of course, just like areas apply them.

In the above example, using room settings for this purpose may not be suitable at all times, as the room settings would apply to anything in that room that is not getting settings from walkable area, not just one character.

Of course this raises a concern about convenience of working with these settings, because right now if area has scaling 100, that would mean an explicit setting already. If the settings would be inherited from the parent (Room), and optionally overridden in areas, then there would have to be an explicit "enabling" property on each area. This is something I am not certain about.

ivan-mogilko commented 10 months ago

Actually... maybe we should move to factor multiplication instead of override in ags4.

Similar to how audio volume is a multiplication of factors: system volume clip volume, or object volume animation volume The scaling could be: room scaling area scaling * character scaling.

Right now, if you want to give particular character a scaling in addition to the area scaling, you would have to make it manual, and calculate in script. With the system above it will be possible to apply one effect to another in chain.

ericoporto commented 10 months ago

Just to explain the issue of outside of room

image

Usually when moving a character from outside of the room inside the room, the character will be big (or just at different scaling) until the middle of the feet hit the first walkable area pixel inside the room. Ideally, would be nice if the last pixel at right and first pixel at left were assumed to be the same for things out of room borders. Right now, the solution is to pre-set the character scaling manually, and then move it into the room - it will only start to active scale after being scaled once manually once it hits the pixel of the walkable area in room borders.

ivan-mogilko commented 10 months ago

Ideally, would be nice if the last pixel at right and first pixel at left were assumed to be the same for things out of room borders.

Oh, right, so imagine that walkable areas stretch infinitely behind the room borders.

Yes, this may be a good idea, but it's best to open a separate ticket for this.

AlanDrake commented 10 months ago

imagine that walkable areas stretch infinitely behind the room borders.

I like this idea too. It's simple and fixes all common annoyances.

morganwillcock commented 10 months ago

Does that also imply that the pathfinding is aware of and takes into account the bleed area? What happens if the shortest distance is through the bleed area?

ivan-mogilko commented 10 months ago

Does that also imply that the pathfinding is aware of and takes into account the bleed area?

I did not think so, why do you think that may be necessary?

EDIT: I see, my wording was wrong. By "walkable areas stretching" I did not mean them literally stretching. I meant their scaling etc effects are applied there. Same could be done for regions with tints probably.

EDIT2: I don't know if this is the same method as @ericoporto had in mind, or he actually wanted to have that area walkable too.

ericoporto commented 10 months ago

No, not walkable, my worry is currently if one wants to make a character enter the room from outside of it, currently you set the scaling, and tween them in, and then make the character walk as soon as they are in a walkable area (0<x<Room.Width&&0<y<Room.Height), but if there's some "default" scaling and it's applied to characters that are not in any walkable area (outside), this won't work anymore.

ivan-mogilko commented 10 months ago

Ermmm I am bit confused right now, I thought this was a feature suggestion about continuing area's effect beyond the room borders. Not sure anymore if I imagined this.

But regarding your concern:

  1. If there's a "ignore area scaling" flag, and you are setting it per character, then this overrides anything anyway.
  2. About the "default" scaling, at first I thought an override mechanic, where area overrides room if it has explicit scaling set, and character overrides area if manual scaling is set. But, as I mentioned in one of the comments above, I am now leaning to multiplicative factors, yet still with optionally letting to let individual characters and objects ignore the room's effect. I would like to think more about how this may be configured, but in any case, the ability to have completely overriding scaling should be preserved.

EDIT: In regards to setting up scaling beyond the background edges. To make it clear, my idea about "perfect" solution is actually to have a "theoretically infinite" room where you may draw areas beyond room background. But such thing would require to make serious changes in editor and engine, and script api. So we could also have something simpler for starters.