AGS 4.0 - Alpha 20 for public test

Started by Crimson Wizard, Thu 01/06/2023 14:00:59

Previous topic - Next topic

MrGreen

Hi!
Videos cannot be played with any other extension than ogv.
PlayVideo (still possible in 3.6), and the new VideoPlayer also doesn't play with other extensions.
Is this a bug or planned?

Crimson Wizard

Quote from: MrGreen on Tue 28/01/2025 21:45:55Hi!
Videos cannot be played with any other extension than ogv.
PlayVideo (still possible in 3.6), and the new VideoPlayer also doesn't play with other extensions.
Is this a bug or planned?

OGV is the only format that AGS supports since 3.6.0.

Previously AGS also supported MP3/AVI formats, but these were implemented using DirectShow interface (part of DirectX) and worked only if
- game is run on Windows
- necessary codecs are installed in the system.
that's why it was removed.

In order to support more formats we'd need to include other video decoding libraries into the engine, which is not in the immediate plans.
This may be addressed later though. Another option is implementing a support for plugins to decode videos.

MrGreen

Quote from: Crimson Wizard on Tue 28/01/2025 22:03:14In order to support more formats we'd need to include other video decoding libraries into the engine, which is not in the immediate plans.
This may be addressed later though. Another option is implementing a support for plugins to decode videos.

That sounds good.

Thank you for your reply, but you misunderstood me.
I know that only Theora code is supported. My question was only about the extension of the file name not the decoding. For example ".dat" (or whatever) instead of ".ogv" to "hide" the videos from the players.

Also, are there any plans to package all videos (or all external source material) into an uncompressed database in the future?

Crimson Wizard

#243
Quote from: MrGreen on Thu 30/01/2025 20:07:09I know that only Theora code is supported. My question was only about the extension of the file name not the decoding. For example ".dat" (or whatever) instead of ".ogv" to "hide" the videos from the players.

I thought that should work, I recall a few games that did that trick. Maybe there's an oversight in the player logic.
I will check this out later today.

EDIT: here's a fixed build:
https://cirrus-ci.com/task/5190246486245376


Quote from: MrGreen on Thu 30/01/2025 20:07:09Also, are there any plans to package all videos (or all external source material) into an uncompressed database in the future?

Videos are already automatically packaged into the main game pack (game.ags), if the Editor finds them in the game project folder (but for that they must have "ogv" extension). Any custom files may be also packaged into the main pack using an option in General Settings ("Package custom data folders").
https://adventuregamestudio.github.io/ags-manual/GeneralSettings.html#compiler

Are you asking about creating a separate pack for videos? Moving selected files into a separate pack is mostly a matter of providing a setup option, and telling engine where to look for.

Tarnos12

Hey, I have an issue with adding an event to the object:
https://gyazo.com/a37867db67a0b6312ba0484f1a56543f

I have to add it manually to the correct room in order for it to work.
Afterwards the "script module" will automatically fill with correct path(in my case Rooms\1\room1.asc)

This is on Version 14:
AGS Editor .NET 32-bit (Build 4.00.00.14) ** BETA VERSION **
v4.0.0, January 2025


Btw, I like the change with script modules!
Game Developer - AGS/Unity and more
Hire me at: https://www.fiverr.com/tarnos
Portfolio: https://tarnos.carrd.co/

Crimson Wizard

#245
Quote from: Tarnos12 on Sat 01/02/2025 09:20:23Hey, I have an issue with adding an event to the object:
https://gyazo.com/a37867db67a0b6312ba0484f1a56543f

So, the issue is that the object is not referencing a script module.
And this happens in 3.6.2 too!
For how long is this problem present, how come nobody reported this earlier?

EDIT: it fixes itself when you load the room for the second time.
I suppose this problem either appears when creating a new room from template, or upgrading an existing room to the new version.

EDIT: looks like this affects only room objects, other things like hotspots are fine. Maybe that's because these are allocated all at once when the room is created, and objects are created later.

Tarnos12

Quote from: Crimson Wizard on Sat 01/02/2025 09:31:28EDIT: it fixes itself when you load the room for the second time.
I suppose this problem either appears when creating a new room from template, or upgrading an existing room to the new version.


I couldn't make it work by reloading a room, in my case it's a regular room with blank template.
I have to manually create a script in a room.
Game Developer - AGS/Unity and more
Hire me at: https://www.fiverr.com/tarnos
Portfolio: https://tarnos.carrd.co/

Crimson Wizard

#247
Quote from: Tarnos12 on Sun 02/02/2025 15:09:05I couldn't make it work by reloading a room, in my case it's a regular room with blank template.
I have to manually create a script in a room.

I just tested again, and it does work if you reload the room. But you need to actually reload it, not just close the tab and open again.
This has to be done each time there are new objects, because each new object won't have a script module reference, and reloading a room only fixes already created objects.

Tarnos12

Quote from: Crimson Wizard on Sun 02/02/2025 15:44:10I just tested again, and it does work if you reload the room. But you need to actually reload it, not just close the tab and open again.
This has to be done each time there are new objects, because each new object won't have a script module reference, and reloading a room only fixes already created objects.
How do I reload a room? Rebuild all files?
That seem to have worked but I still have to click 3 dots to add an event to actually add it.
It's probably faster to do it manually.
Game Developer - AGS/Unity and more
Hire me at: https://www.fiverr.com/tarnos
Portfolio: https://tarnos.carrd.co/

Crimson Wizard

#249
Quote from: Tarnos12 on Mon 03/02/2025 10:01:02How do I reload a room? Rebuild all files?

For example, open another room, then back the previous one.


There's a fixed version here:
https://cirrus-ci.com/task/6571235825418240

but it also contains some major rewrite in the engine, so if you use it, please keep an eye on anything strange.

Tarnos12

Quote from: Crimson Wizard on Mon 03/02/2025 10:38:02
Quote from: Tarnos12 on Mon 03/02/2025 10:01:02How do I reload a room? Rebuild all files?

For example, open another room, then back the previous one.


There's a fixed version here:
https://cirrus-ci.com/task/6571235825418240

but it also contains some major rewrite in the engine, so if you use it, please keep an eye on anything strange.

Is it possible to go back if something happens in this new version?
I will give it a go tomorrow since I need to make a build today and can't risk it :D
Game Developer - AGS/Unity and more
Hire me at: https://www.fiverr.com/tarnos
Portfolio: https://tarnos.carrd.co/

Crimson Wizard

Quote from: Tarnos12 on Mon 03/02/2025 20:00:09Is it possible to go back if something happens in this new version?
I will give it a go tomorrow since I need to make a build today and can't risk it :D

Yes, for now, because there are no changes to the project format since Alpha 18 release, only changes to how engine works.

Crimson Wizard

Updated to Alpha 19
(Please use download links in the first post)

Contains all the new features and fixes from 3.6.2 RC1 (excepts ones related to backwards compatibility).


Own changes:

Editor:
- When Room's background size is changed, adjust Edges according to the selected mask resize method as well (reset, keep or rescale positions).

Script API:
- Added Pathfinder.IsWalkableAt() and NearestWalkablePoint() functions.
- Added optional width, height and layer parameters to SaveScreenShot(). SaveScreenShot() now supports location tokens in file path.

Engine:
- Rewrote script interpreter, with the purpose to potentially allow certain features in the future. There must not be any changes in script behavior at the moment (but testers should keep an eye for any regressions).
- Fixed engine refusing to play video files if they have a non-standard extensions (e.g. in case when game author wants to hide their nature).

Baguettator

Hi !

I'm just testing the new color system in AGS 4.0. I'm using AGS 4.00.00.14, and I don't know how to draw something transparent on a drawing surface ? Before the new system, I used DrawingColor=COLOR_TRANSPARENT, but it doesn't work now.

What I did before :

I draw an image on a dynamicsprite
Then I draw a transparent rectangle in the middle of that dynamicsprite
So that I can see "behind" this dynamicsprite in this rectangle (this dynamicsprite is used for a GUI's background, this GUI is like a "mask" for another GUI that appears in the transparent rectangle).

Here's my code :

Code: ags
fondexpedition=DynamicSprite.CreateFromExistingSprite(176); // 176=image's slot
    fondexpedition.Crop(0, 0, 1920, gBoutonsExpedition.Height); // Just adjust the image for the GUI's background
    DrawingSurface *dess=fondexpedition.GetDrawingSurface();
    dess.DrawingColor=COLOR_TRANSPARENT;
    dess.DrawRectangle(this.x, this.y, this.x+750, this.y+750); // rectangle in the middle
    dess.Release();
    gBoutonsExpedition.BackgroundGraphic=fondexpedition.Graphic;

As it, the result is the GUI's background is fully covered by the image, and there isn't the transparent zone in the middle. I think the new system makes that the transparent rectangle no longer erases the pixel where it's drawn, it's just that I put something transparent on the image, so I see the image again... It seems it worked differently in the old AGS 4.0 versions.

So should I code it another way ? Like drawing each side of the image separately, so I don't draw anything where I would have the transparent zone ?

Crimson Wizard

#254
Quote from: Baguettator on Sat 22/02/2025 22:19:58I'm just testing the new color system in AGS 4.0. I'm using AGS 4.00.00.14, and I don't know how to draw something transparent on a drawing surface ? Before the new system, I used DrawingColor=COLOR_TRANSPARENT, but it doesn't work now.

This is something that is missing in the new system. Unfortunately, nobody who observed and tested my changes noticed or mentioned that this option is missing either.

The new system uses alpha blending of colors by default, which means that if drawing color is translucent, then it's drawn translucent over a surface mixing with the colors underneath, and if drawing color is transparent, then it draws nothing.

I think we might need a separate operation switch between blending and copying pixels for that to work again (or special "blend mode" that sais "copy source pixel" instead of blend with dest).
I don't know whether similar effect may be accomplished using other existing blending modes (I am not fully understanding their uses).


Baguettator

I don't know anything in coding for engine, but it may be a color value "ERASER" that if we use it, it clears the pixels under the surface and gives transparent pixels instead ?

Like :

Code: ags
DrawingSurface *d=mydynamicsprite.GetDrawingSurface();
d.DrawingColor=ERASE;
d.drawrectangle(0, 0, 100, 100);
d.Release();

=> will erase the pixels included in a rectangle in the middle of the dynamicsprite.

Crimson Wizard

#256
Quote from: Baguettator on Sun 23/02/2025 05:59:02I don't know anything in coding for engine, but it may be a color value "ERASER" that if we use it, it clears the pixels under the surface and gives transparent pixels instead ?

That won't work, because the color value is interpreted as AARRGGBB now, and it does not have space for "special" values without conflicting with some color value. COLOR_TRANSPARENT is 0x00000000.

MAYBE I could make COLOR_TRANSPARENT, or any color with 0 alpha to always act as a copy, since in theory it does not make sense to draw a fully transparent color. That would be inconsistent though. And then there will still a question of whether we may require an operation that draws with a half-transparent color by replacing underlying pixels.

Alan v.Drake

This could be the use case for that eBlendReplace which was considered times ago. To simply overwrite destination without any actual blending operation.


- Alan

Snarky

I think making COLOR_TRANSPARENT clear the part it is drawing on is probably OK. If you're constructing the color value manually it might mean you have to add a separate check to make sure you're not inadvertently wiping out part of the sprite, but that's easy to add, and people who are calculating color values probably have a good idea of what they're doing.

As for adding another API to overwrite without blending, I don't think I've ever experienced a need for it, but maybe it might come in useful. I suggest DrawingSurface.Clear...() (ClearCircle, ClearLine, ClearRectangle, ClearTriangle, ClearPixel, and possibly ClearString), to work consistently with the existing DrawingSurface.Clear().

Baguettator

#259
Hi there, I need to know how dynamic sprites are managed in AGS 4.0. Because I can't figure out what's wrong in my code...

So, how are they managed ? Are they sorted in something like a dynamic array ?

If I create 10 dynamicsprites, then I delete the fourth and the sixth of them, do their graphic value changes (for the others remaining) ?

Because, I can't explain why, but it's almost what I am doing, using dynamic arrays of dynamic sprites, sometimes deleting the arrays to create them again from scratch, and when I delete an array and recreate the dynamicsprites for my buttons, they get dynamicsprites from other arrays of my game... For really no reason.

The situation could be :

DynamicSprite *a[];
DynamicSprite *b[];

I create 10 dynamicsprites for *a, then 20 dynamicsprites for *b. Then, I delete *a, recreate 10 dynamicsprites for it, and make them normalgraphic for some buttons. And it seems, some buttons get some graphics from *b instead of *a...

I'm trying to find what's wrong in my code, and if I see more details, I'll report them here.

EDIT : Well, I think I have a clue... What happens when I delete a dynamicsprite, if a button had it as its normalgraphic ? Which value the button gets for its graphic ? It seems they take a value that is not -1 as I expected.

EDIT2 : seriously, I think there is a problem in how dynamic sprites are managed. It seems that deleting them when they are assigned to a button gives the button another graphic that is from other dynamicsprites. Really weird... I can't give a code for now because it would need too much time that I haven't got tonight, but as soon as I can...

SMF spam blocked by CleanTalk