Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Crimson Wizard

#241
AGS has 2 commands:
1. File -> Autonumber speech lines
2. File -> Create voice acting script (should be run after speech lines are numbered)

Known editor plugin that further improve working with speech is a SpeechCenter plugin:
https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/editor-plugin-speech-center-version-2-2-0/
#242
AGS Engine & Editor Releases / Re: AGS 3.6.2
Sun 25/05/2025 13:48:51
Quote from: lafouine88 on Sun 25/05/2025 11:41:39I just have one quick question, on my rebuilt version of the game, the characters' speech are displaced to the far right of the screen for some reason. Is there some new option that has changed and I haven't seen?

No, there are no new options, and even if there were, AGS is supposed to keep old behavior when upgrading an older game.

I need to know how this speech was supposed to look like before, and how it's done in script.
#243
Quote from: Nine Toes on Sat 24/05/2025 07:06:35I have minimal understanding of C++; my background is mostly web languages. But by placing the asterisk immediately after the data type, I'm essentially saying "get the passed hotspot from the above function"?

There's no difference whether asterisk is right after data type or with a space in-between, AGS script (and also C and C++) treat these as the same thing. Where to place it in your code is only a matter of the code style.
In the above example this declaration sais "pass the hotspot INTO the function". If you would like to get the hotspot FROM the function, then that should be a return value instead, like:

Code: ags
Hotspot* getSomeHotspot()
#244
GetProperty and GetTextProperty work only with the custom properties, not standard ones. For standard ones there are explicit properties declared as a part of Hotspot type.

The property which is called "Description" in the Editor is actually called Name in script:
https://adventuregamestudio.github.io/ags-manual/Hotspot.html#hotspotname

So the code will be:
Code: ags
Display("You can't talk to the %s", theHotspot.Name);

EDIT:
Other than that, this function declaration misses a argument type
Code: ags
function youCantTalkToThe(hotspotRef){

It should be:
Code: ags
function youCantTalkToThe(Hotspot* hotspotRef){
#245
The first expansion of the Shaders feature, is the support for attaching textures, which allows you to mix multiple input textures in a shader (up to 4).

PR: https://github.com/adventuregamestudio/ags/pull/2733
Download test build here: https://cirrus-ci.com/task/4706533503664128

New script command:
Code: ags
/// Sets a secondary shader's input texture, using a sprite number. Only indexes 1-3 are supported.
void ShaderInstance.SetTexture(int index, int sprite);

Note that you can only use indexes 1..3. Index 0 means primary texture, so it's not allowed here.
The sprite can be any sprite number, either regular or dynamicsprite, there's no difference.

Use in shaders:

In GLSL you must use hardcoded 'sampler2D' uniforms "iTexture2", "iTexture3" and "iTexture4".
In HLSL names are not hardcoded per se (although you may use the same), but the registers matter: the 'sampler2D' variables has to be appointed to registers "s0", "s1" and so on.

GLSL example:
Spoiler
Code: ags
#version 130
uniform sampler2D iTexture;
uniform sampler2D iTexture2;
uniform vec2 iTextureDim;

varying vec2 vTexCoord;

void main()
{
    vec2 uv = vTexCoord.xy;
    if (floor(mod(uv.x * iTextureDim.x, 2)) == 0 && floor(mod(uv.y * iTextureDim.y, 2)) == 0)
        gl_FragColor = texture2D(iTexture, uv);
    else
        gl_FragColor = texture2D(iTexture2, uv);
}
[close]

HLSL example:
Spoiler
Code: ags
// Pixel shader input structure
struct PS_INPUT
{
    float2 Texture    : TEXCOORD0;
};

// Pixel shader output structure
struct PS_OUTPUT
{
    float4 Color   : COLOR0;
};

sampler2D iTexture : register( s0 );
sampler2D iTexture2 : register( s1 );

const float2 iTextureDim:   register( c2 );

PS_OUTPUT main( in PS_INPUT In )
{
    PS_OUTPUT Out;                             //create an output pixel

    float2 uv = In.Texture;
    float4 outpixel;
    if (floor(fmod(uv.x * iTextureDim.x, 2)) == 0 && floor(fmod(uv.y * iTextureDim.y, 2)) == 0)
        outpixel = tex2D(iTexture, uv);
    else
        outpixel = tex2D(iTexture2, uv);

    Out.Color = outpixel;
    return Out;                                //return output pixel
}
[close]

Above examples simply interleave 2 sprites together where odd pixels come from one sprite and even pixels come from another.
#246
Since this is resurrected, it's worth mentioning:

1. If you are using AGS 3.6.0 and later then you might consider adding "acsprset.spr" to .gitignore so to not have a huge compiled spritefile in a repository. But only do so if you have all sprite source file in the relative project subdir; in such case you will be able to restore sprites from sources when checking out the repo.
This is not a rule, but a recommendation, decide this for yourself and for each individual project.

2. If you are using AGS 4.0, then the "room*.crm" should be added to .gitignore, because these are now output files, and room sources are inside Rooms folder.
#247
Quote from: DiegoHolt on Wed 21/05/2025 17:07:47I'm using version 3.6, and I have downloaded 4 but still haven't tried it out. Can I just open my 3.6 project in the new version and work there without any problem? What do you all recommend? Do I keep working on the old one or should I change? My game is about half way progress.

I recommend trying DynamicSprite.Rotate first in 3.6, as it may give an acceptable result with the certain effort.
AGS 4.0 is not nearly as stable and consistent as 3.6 now.

Quote from: DiegoHolt on Wed 21/05/2025 17:07:47
Quote from: Crimson Wizard on Wed 21/05/2025 13:06:12AGS 4.0 does not support rotating gui controls yet, because there were some complications with them when I first added object rotation, and later I forgot to address this problem again.

This may be worked around by placing screenshots on multiple GUIs or Overlays, and rotating them instead.

So, in your last sentence are you talking about 3.x or 4?

I was talking about AGS 4.0.
#248
AGS 4.0 does not support rotating gui controls yet, because there were some complications with them when I first added object rotation, and later I forgot to address this problem again.

This may be worked around by placing screenshots on multiple GUIs or Overlays, and rotating them instead.
#249
Quote from: eri0o on Wed 21/05/2025 03:32:06Hey, I wanted to play with this and had some ideas, but currently the only texture a shader instance can have access to, is the one it is attached to. I think this is due to how AGS works that it works with sprites, which may or may not have a texture associated.

I had this in future plans. Did not think the implementation through yet.

But the general idea was to assign a sprite number as an extra "texture source" to the ShaderInstance. When this is done, the engine would create and lock a texture for that sprite in a texture cache, and assign to DDB as an extra sample texture. Then this extra texture is attached to a shader during render. Might try making an experiment in a few days.
#250
Quote from: Peegee on Tue 20/05/2025 08:19:09It's strange, when I removed the outline of the font, the text took more space in width...

That is unexpected. Could you tell which version of AGS are you using, which font, and how the outline was made (was it using another font, or automatic outline, etc)?

Quote from: Peegee on Tue 20/05/2025 08:19:09Sorry, I didn't want to send my picture so as not to reveal my game (GOBLiiNS6), and it was just a parchment (with an illustration).

Well, I understand, but you could make a screenshot in some mockup scene in such situation, with just the text shown.
#251
We've been asking for a game screenshot, because that will let us to clearly see the problem with your text. "Rough and contrasting" may have a number of reasons. Some reasons may be solved by easier means.

For example, have you tried turning "Anti-alias TTF fonts" on? This option is located in General Settings -> Text output. (Or do you have it turned on already?)
What is your game resolution? This option works better in high resolutions than in low resolutions.

Another option that you may try is making speech text's overlay slightly transparent (using Transparency property of a Speech.TextOverlay).

Spoiler
Example:
Code: ags
function repeatedly_execute_always()
{
    // test if there's a blocking speech overlay on screen
    if (Speech.TextOverlay != null)
    {
        Speech.TextOverlay.Transparency = 10; // this value may be experimented with
    }
}
[close]

I'd try the "GUI above the text" as a last option. It's not difficult to do, but seems like an unusual solution.
#252
Right click cycle is done in "handle_room_click" within the Sierra template, but it's done using standard function "Mouse.SelectNextMode", which automatically switches to the next enabled mode.

What you should do instead is disable all modes that you don't need. Open each unnecessary cursors in the editor and set "StandardMode" to False.
#253
There are definitely 2 opposite use cases of drawing a text:
1. When you draw a text on a prepared space, where the text must fit in that space.
2. When you draw a text (maybe limiting by some width), but then adjust the "space" to the text.

DrawingSurface API suits for the first purpose, and I could not figure out if it's possible to use for the second, unless it's an internal call where you already precalculated text size. But when I think more about this, there's another issue with DrawFancyString, as well as AGS own DrawStringWrapped: there's no way to limit by height.

And DrawingSurface does not expose "Clipping" feature either, which seems like an oversight.

Which means that if one needs to limit an output text by height, then they either have to get a precalculated text size first (Fancy module seem to have a FancyState for this, but it does not expose this atm, unless I missed anything), or draw on a intermediate sprite first, and then manipulate that sprite (crop or whatnot).
#254
Quote from: Snarky on Mon 19/05/2025 16:59:59That sounds correct to me. Consider the case of a textbox that is resized to fit the text content: you don't want to center the text around the halfway point of the "max width," but around the halfway point of the actual longest line width.

There are 2 different cases:

Case 1. When the text is being drawn on a prepared surface of the fixed-sized text box. This is the case of DrawingSurface.DrawFancyString which we tried first, and that's what I reported above. In such case I expect it to center relative to the "max width" that I pass; because otherwise it does not make any sense. I do not have a way to know the width of the longest line beforehand, so that I could adjust the x position.

Compare it with DrawingSurface.DrawStringWrapped, which wraps in the "max width":
https://adventuregamestudio.github.io/ags-manual/DrawingSurface.html#drawingsurfacedrawstringwrapped

Quotewidth is the width of the virtual textbox enclosing the text, and is the point that the text will wrap at. You can use the alignment parameter to determine how the text is horizontally aligned.

Case 2. When the text is placed on a exclusive sprite, resized to fit just the text, which one may align with the text box as sees fit. This is the case of DynamicSprite.CreateFromFancyString, which we used in the end.
#255
There's another bad bug in the lasted alpha version, which prevents from creating new Fonts in game.
Following temp build has it fixed:
https://cirrus-ci.com/task/5147027429916672
#256
We figured this out on Discord, using DynamicSprite.CreateFromFancyString instead, which allows to know the width and height occupied by the text, which in turn lets to align the resulting text on the background as the user wants.
(somehow this reminds me SDL_ttf which creates a bitmap with the text)

Quote from: eri0o on Mon 19/05/2025 02:55:29I think that's fine since the width is adjusted before when it calculates the word wrapping.

If you are referring to the horizontal alignment, then it does not center it in the provided "max width", but (apparently) longest line's width? This makes the whole text aligned to some seemingly random horizontal point, which is not what a user would expect.

Quote from: eri0o on Mon 19/05/2025 02:55:29@Akril15 , from your code I don't understand what you are trying to do, afaict if you don't maintain a global dynamic sprite and overlay I can't understand how they would show on screen.

There's a character.Say call right after that, which blocks the game and keeps created overlay displayed.

The code overall does following:
- displays a background GUI with some extra elements, such as character's name.
- creates a dynamic sprite with a Fancy text on it, makes a overlay and aligns over the background GUI.
- calls character.Say, so that the default lip-sync (and maybe voice) could work, and game blocks until speech is done.
#257
I think there may be a mistake in the module.

If you look in fancy.asc, function called "_draw_tokens", there's a line:
Code: ags
int text_width = fs.TextWidth;

It probably should be:
Code: ags
int text_width = fs.MaxTextWidth;
#258
If you read the DrawFancyString method, it looks like:
Code: ags
void DrawingSurface.DrawFancyString(int x, int y, const string text, optional FancyConfig* config, optional int width);

There's "optional int width" as the last parameter.
#259
AGS Engine & Editor Releases / Re: AGS 3.6.2
Sun 18/05/2025 18:52:45
Quote from: blexx on Sun 18/05/2025 12:10:45What are your plans for AGS 3.x.x? I guess from now on there will only be bugfixes and you are focusing on version 4? Or will version 3 continue to receive major updates?

Yes, the plan currently is to focus on AGS 4.
SMF spam blocked by CleanTalk