Adventure Game Studio

AGS Support => AGS Engine & Editor Releases => Topic started by: Crimson Wizard on Thu 01/06/2023 14:00:59

Title: AGS 4.0 - Early Alpha 10 for public test
Post by: Crimson Wizard on Thu 01/06/2023 14:00:59
AGS 4 - Early Alpha 10
Full release number: 4.0.0.5

ACHTUNG!
(http://i.imgur.com/3gHhXIz.png)

This is a EARLY ALPHA version of AGS 4.
This is a WIP version, and must go through extensive testing.
Use at your own risk. Please back up any games before opening them in this version of AGS.
New settings in this version WILL make your project files unusable in previous versions after saving with this version.

Download AGS 4.0 Early Alpha installer (https://github.com/adventuregamestudio/ags/releases/download/v4.0.0.5/AGS-4.00.00.05-Alpha10.exe)
Download AGS 4.0 Early Alpha as a .zip archive (https://github.com/adventuregamestudio/ags/releases/download/v4.0.0.5/AGS-4.00.00.05-Alpha10.zip)

For Engine/Editor developers
Spoiler
AGS 4 source branch (https://github.com/adventuregamestudio/ags/tree/ags4)
Debug symbols database (for analysing crash dumps) (https://github.com/adventuregamestudio/ags/releases/download/v4.00.00.05/AGS-4.00.00.05-pdb.zip)
[close]


Last updated: 6th May 2024



This release is brought to you by:

- Alan v.Drake
- Crimson Wizard
- eri0o (joystick & gamepad support, other improvements)
- fernewelten (new script compiler)
- ChamberOfFear, aka persn (open room format, Editor improvements)
- Matteo Piovanelli (some improvements)



What is AGS 4

AGS 4.0 is an upcoming version which is currently in experimental stage. The primary idea of this version is a complete removal of the deprecated functionality: game settings and script functions. AGS 4 will no longer be able to run older 2.* or 3.* games. It will only guarantee the import of the latest 3.* game projects (such as 3.6.0). This means that if you want to update your existing game to AGS 4, then you'll have to first import and save it in 3.6.0. If your game is using any of the deprecated settings or script commands - you'll have to replace these, as 4.0 will no longer have necessary "backwards compatibility" switches in General Settings.

It is still in works, and there is a number of large changes planned.
But what are the ready major new features of AGS 4?

Open Room format

The new room format made by @ChamberOfFear now stores rooms as a collection of directories with room data split into multiple files. The room properties are stored in XML, which make it possible to read and even edit by hand outside of the editor. Room backgrounds and region masks are stored as separate PNG images.

This improves the safety of working with rooms, allows to change things externally, and simplify teamwork to some degree.

New script compiler with new syntax features

The new compiler was written by @fernewelten, and it grants a whole bunch of syntax improvements to the AGS script, such as nested structs, multi-dimensional arrays, dynamic arrays have `Length` pseudo-property, and so on.

The full cheat-sheet of the new features may be found here:
https://github.com/adventuregamestudio/ags/wiki/New-compiler%27s-end-user-cheat-sheet
If anyone is curious, here's the more "technical" version, explaining things in depth:
https://github.com/adventuregamestudio/ags/wiki/Features-of-the-new-Script-Compiler

Managed pointers inside managed structs

These are also allowed now (this is not related directly to the script compiler, but also to how engine handles dynamically created objects). This feature finally opens full potential of structs referencing each other with pointers, and allow you to create virtually any kind of data storage in script.

To give an example:
Code (ags) Select
managed struct Item; // pre-declaration

managed struct Person {
    Item* items[];
};

managed struct Item {
    Person* owner;
};

Here's a LinkedList module I wrote for a test:
https://www.dropbox.com/s/sxur2bsccsvaqmr/ags399-LinkedList.zip?dl=0

Advanced object features

The game objects have two new features worth mentioning up front: Blend Mode and Rotation.
* BlendMode property lets you change the way object is drawn, selecting one of the 10 classic modes (Add, Subtract, Dodge, etc). This gives you ability to make more visual effects in your game.
* Rotation property (called GraphicRotation in some) lets you to rotate the object by a number of degrees. Most standard things have this, and even Cameras, so you may, for example, rotate the whole room view, and characters in it individually. Rotation is hardware accelerated (in Direct3D/OpenGL mode) and does not slow things down, unlike rotating dynamic sprites. Engine correctly detects clicks on rotated objects, so for example, rotated GUI will be fully functional.

What else is PLANNED for AGS 4?

Here's the milestone proposal:
https://github.com/adventuregamestudio/ags/issues/1298

It's not clear at the moment whether all of these features will be a part of the first 4.0 release, but at least some of these will hopefully be.

How safe is this WIP version currently?

It is relatively stable, and there are few people who were already using it to make games for a while: Alan Drake is one of them, and I suspect that fernewelten was also using it sometimes for his games because of his new compiler (but I may be mistaken).
The biggest problem with this is that this version will be updated further, so some things may not be final. Project format may also change in the next updates. We'll try to keep things upgradeable (so that the previous projects made in this WIP version won't just break).
And it surely it will benefit from more testers.



The full changelog follows:

Contains all improvements and fixes from AGS 3.6.1 RC5, except ones made for backwards compatibility.

Common:
- Most of the deprecated functionality (game settings and script API) is cut out from both Editor and Engine, and is no longer supported. The Editor guarantees to import the projects saved by AGS 3.6.0 and later. The Engine may run games compiled in 3.6.0, but only so long as they don't use any deprecated settings or script commands.
- Completely removed Global Messages and Room Messages.
- Removed built-in support for Game Score, including related game settings and GiveScore script command. Users are advised to script their own score counter if they need one.
- Removed support for '[' as a linebreak character in text.

Editor:
- Open room project format: rooms are now saved as subfolders in "Rooms" folder, where each component has its own separate file (room data, backgrounds, masks and scripts).
- Support room backgrounds and masks as PNGs.
- Translation sources are now saved in PO format.
- General panel look enhancements.
- More panes in the Editor are DPI-aware (rescale well with the system font scaling).
- Support built-in Base Color Themes that have the custom themes applied over them.
- Game template selection now displays template's description right in the dialog.
- F2 is now a hotkey for editing labels in the Project Tree. "Game statistics" are now displayed by Ctrl + F2.
- Editor tabs now display icons indicating their contents (may be disabled in Editor Preferences).
- Room panel tabs now display room names.
- Support reordering folders in Project Explorer with drag & drop.
- Support importing plain script files: ash, asc or both, - besides script modules (*.scm).
- Added "Controls transparency" slider to GUI edit pane.
- Do not alter or clamp palette for 8-bit sprites imported in a 16/32-bit game.
- Script editor supports "word wrap" mode.
- In General Settings added "Use extended compiler" option that lets to choose a new script compiler for your game (see list of changes in related section below).
- Added Enabled and Visible properties to Characters, Enabled property to Room Objects.
- Added BlendMode property to Characters, GUI and Room Objects.
- Added FaceDirectionRatio property to General Settings, Room and Walkable Areas.
- Added readonly Length property to AudioClips, for the reference.
- Fixed faulty double-click on project items in case user dragged the cursor away.
- Fixed double warning message when trying to close the Editor while a game test is running.

Compiler:
- The new extended script compiler is available. Almost all of the new Scripting features are only supported when using the new script compiler.
- Optimization to the bytecode generation: same scripts may now work faster at runtime.

Scripting:
- Support for having regular structs inside any structs (regular or managed); there's no nesting limit.
- Support having managed pointers inside managed structs.
- When declaring a pointer to managed struct you may now omit "*" sign.
- When writing struct's function's code you may now omit "this" keyword when addressing current struct's member (variable, attribute or function).
- Extender attributes; similar to extender functions, but these define a pair of get_ and set_ functions.
- Multi-dimensional regular arrays. They may have any positive number of dimensions.
- Multi-dimensional dynamic arrays, also known as "jagged arrays". These are arrays of arrays, where each parent array's element has to be created separately, but may be of any independent length.
- Regular arrays of dynamic arrays: that is a regular array where each element is a pointer to a dynamic array of the same type.
- Dynamic arrays of regular structs.
- Dynamic arrays now have Length pseudo-attribute used to retrieve their length.
- Global variables may now be declared right after struct's or enum's declaration, between the closing bracket and closing semi-colon.
- Functions now may call any other function from within same script, regardless of their order of declaration.
- Compiler can now evaluate integer or float expressions at compile time whenever result is actually constant and can be calculated at compile time.
- "const" keyword now may be used to define compile-time "int" and "float" constants.
- "readonly" keyword now may be used to declare non-modifiable variables (local or global) and function parameters.
- Added "fallthrough" keyword, which is used to hint that switch's case does not require a break statement. This is only to clarify coder's intent and prevent compiler's warnings.
- Support pre-increment and pre-decrement operators (++x, --x).
- Support bitwise negation operator (~x).
- Support addressing members of the function return values in one expression. This lets chain multiple commands including function calls, e.g. GetObject().MyVariable...and so on.
- Two sequenced string literals ("text" "text") are now automatically concatenated.

Script API:
- Most of the deprecated API is now removed completely, except those that have no equivalent.
- Added SCRIPT_EXT_AGS4 macro which tells whether extended script syntax is supported by the compiler. This may be used to know whether the script is being compiled by the old or new compiler.
- Added SCRIPT_EXT_NESTEDPOINTERS macro which tells whether nested managed structs are supported by the compiler.
- Added Joystick struct, meant to work with joystics and gamepads in script.
- Added VideoPlayer struct, which provides means of playing non-blocking videos rendered onto a sprite that may be displayed on any game object.
- Added WalkableArea and Walkbehind structs which let work with these region types in OO-style.
- Added BlendMode enum.
- Added Character.Enabled and Visible properties, added Object.Enabled property, Character.on is deprecated.
- Added Character.BlendMode, GUI.BlendMode, Object.BlendMode, Overlay.BlendMode.
- Added Character.UseRegionTint and Object.UseRegionTint, deprecated Character.IgnoreLighting.
- Added Character.MoveStraight(), complementing WalkStraight().
- Added Camera.Rotation, Character.GraphicRotation, GUI.Rotation, Object.GraphicRotation, Overlay.Rotation.
- Added Game.FaceDirectionRatio, Room.FaceDirectionRatio, WalkableArea.FaceDirectionRatio and Character.FaceDirectionRatio.
- Added Character.MoveStraight() complementing WalkStraight().
- Added DrawingSurface.BlendImage() and DrawingSurface.BlendSurface() functions.
- Added File.Rename().
- ListBox.FillSaveGameList(), RestoreGameDialog() and SaveGameDialog() now let define a range of save slots for display.
- Added String.Join(), String.Split() and String.Trim() functions.
- Added MoveSaveSlot() which renames a savegame.
- Added System.GetEngineInteger() and System.GetEngineString() for returning diagnostic information about engine's runtime state. Possible arguments are defined by EngineValueID enum.
- Added "walkarea[]" and "walkbehind[]" global arrays.
- Global arrays of game objects (Characters, GUIs, etc) are now declared as arrays of object *pointers*. From the user's perspective this is a mere formality, as working with these arrays will be syntactically same, but this makes it easier for the engine to handle these arrays and objects internally.
- Removed "hasAlphaChannel" param from DynamicSprite.Create() and CreateFromExistingSprite().
- Removed HasAlphaChannel property from DialogOptionsRenderingInfo.
- Removed "transparent" param from Overlay.CreateGraphical() and CreateRoomGraphical().
- Removed Object.MergeIntoBackground() function as redundant, and complicating Object's logic.

Engine:
- Support joystick and gamepad input.
- Implemented more accurate Character movement. The movement direction is now more precise and diagonal movement speed no longer may exceed MovementSpeed setting.
- Camera will not follow a disabled player character.
- Animated buttons now display flipped frames correctly.
- AudioChannel.Position and PositionMs no longer return a very large value while skipping cutscene.
- Both blocking and non-blocking videos are buffered and played on a separate thread.
- Overlay.X and Y properties of special screen overlays, such as blocking speech, now treat assigned values correctly as screen coordinates and return values set by user consistently. They also always return the assigned values without any offsets for textual overlays created using a TextWindow (having extra borders and padding).
- DeleteSaveSlot() no longer causes highest save to be renamed to fill a gap in saves.
- Added FLAC support for music, speech and sound effects.
- Added "--no-plugins" command-line argument that denies loading any plugins; also added respective config option.
- Added "--print-rtti" command line option which prints script RTTI table to the log.
  (RTTI stands for "runtime type information", and is used for handling of certain advanced
  script features, such as nested managed structs.)

Title: Re: AGS 4.0 - Early Alpha (WIP) for public test
Post by: Crimson Wizard on Thu 01/06/2023 14:26:24
KNOWN ISSUES

[FIXED]1. Some room backgrounds may become fully transparent after the project import. Their RGB colors persist, but alpha channel becomes 0 in every pixel.
The workaround currently is either to reimport background from the original source, or to open a bg png in the Rooms dir and fill alpha channel with opaqueness (if you graphic editor allows that).



2. There are couple of functions which now have less arguments compared to the previous versions of AGS.

These functions are:
- DynamicSprite.Create and DynamicSprite.CreateFromExisting, they no longer have "has alpha" argument, as in 32-bit games all sprites are considered to have usable alpha channel now. (This is actually under question, and may change again to e.g. have an argument that defines a pixel format)
- Overlay.CreateGraphical does not have "transparent" arg, as it was useless all the way.

This is an unusual case (commonly arguments are added). This may cause script errors if you import a project or a module.

The solution for a quick fix, when you don't want to manually fix all these function calls in your game, is to create a script module on the top of the scripts list, and place helper extenders there which wrap actual function calls, like this:

Code (ags) Select
DynamicSprite* Create(static DynamicSprite, int width, int height, bool unused)
{
    return DynamicSprite.Create(width, height);
}

static DynamicSprite* DynamicSprite.CreateFromExistingSprite(int slot, bool unused)
{
    return DynamicSprite.CreateFromExistingSprite(slot);
}

Overlay* CreateGraphical(static Overlay, int x, int y, int slot, bool unused, bool clone)
{
    return Overlay.CreateGraphical(x, y, slot, clone);
}

Overlay* CreateRoomGraphical(static Overlay, int x, int y, int slot, bool unused, bool clone)
{
    return Overlay.CreateRoomGraphical(x, y, slot, clone);
}
Title: Re: AGS 4.0 - Early Alpha (WIP) for public test
Post by: Eon_Star on Fri 02/06/2023 22:12:38
Hi,

I tested this version. When in room editing window the background PNG was not visible (Gray Background). In the game window however it was ok. Thanks for your efforts.
Title: Re: AGS 4.0 - Early Alpha (WIP) for public test
Post by: eri0o on Sat 03/06/2023 00:44:22
Could you share the PNG?
Title: Re: AGS 4.0 - Early Alpha (WIP) for public test
Post by: Crimson Wizard on Sat 03/06/2023 09:35:24
Quote from: Eon_Star on Fri 02/06/2023 22:12:38I tested this version. When in room editing window the background PNG was not visible (Gray Background). In the game window however it was ok. Thanks for your efforts.

Hello, this is a known issue that I'm currently looking at. The background does not actually become grey, it becomes fully transparent with alpha channel = 0. It's visible in the game because the engine forces room bgs to be rendered opaque.

The workaround currently is either to reimport background from the original source, or to open a bg png in the Rooms dir and fill alpha channel with opaqueness (if you graphic editor allows that).
Title: Re: AGS 4.0 - Early Alpha (WIP) for public test
Post by: Eon_Star on Sat 03/06/2023 11:28:47
Thank you Crimson Wizard. I think this version will be great. :-D
Title: Re: AGS 4.0 - Early Alpha (WIP) for public test
Post by: Crimson Wizard on Sun 04/06/2023 04:55:59
The fixed update may be downloaded here:
https://cirrus-ci.com/task/5237373961764864
Title: Re: AGS 4.0 - Early Alpha (WIP) for public test
Post by: Eon_Star on Thu 15/06/2023 21:02:51
I did dowload the fixed version. Keep up the good work and stay healthy. ;-D
Title: Re: AGS 4.0 - Early Alpha (WIP) for public test
Post by: Crimson Wizard on Tue 27/06/2023 15:24:49
Updated to Alpha 2
(Please use download links in the first post)

Contains updates and fixes from 3.6.1 Beta 3.

Other changes:

Editor:
- Fixed room backgrounds with color depths < 32-bit (like 24-bit rgb) could display fully transparent in the Editor after project upgrade.
- (possibly) Fixed incorrect "script was modified externally" message occuring when it was not actually modified externally.

Compiler:
- Fixed `++` and `--` operators could be used wrongly as a binary op (like `a ++ b`), and compiler did not detect any error.

Engine:
- Fixed character/object scaling not working at all, because of a typo in code.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Crimson Wizard on Sun 30/07/2023 20:20:12
Updated to Alpha 3
(Please use download links in the first post)

Contains updates and fixes from 3.6.1 Beta 6.

Other changes:

Common:
- Removed support for '[' as a linebreak character in text.
  Please use a standard '\n' from now on.

Editor:
- Support loading PNGs with transparent chunks as Room Masks.

Engine:
- Fixed flipped button frames displayed without transparent parts.




You might have noticed that there was not much of new additions to AGS 4 updates besides than merging 3.6.1 updates in. There are currently couple of major changes in works:
- Translation migration from classic AGS TRS format to a more widespread PO format, which should make working with translations safer, and make adding further translation features easier.
- Joystick/Gamepad script API.

I believe these two will be introduced in the next AGS 4 Alpha update.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Baguettator on Sun 06/08/2023 08:42:21
Just a big congrats to all of you who are still working on this incredible free  and rich program !! I will test AGS 4.0 as soon as I can !

I have a question that could be (or not) a suggestion for AGS development : is it possible to create during runtime new buttons or GUICOntrols or things like that ? I mean : the game could manage new buttons that have not been created in the editor, but created during playing the game ?

My idea is that I'm making a "map editor" for something, so I have to place tokens (tiles, events, starting zones, objectives, characters etc...) to create a map. I can't imagine doing this another way than using GUIControls (or characters, or room objects) to represent tokens, to easily be able to manage clicks on them to delete, rotate, move etc...

The problem is that it will necessary limit the possibilities, the number of tokens "available" because I can't have infinite GUIControls. I have to create 100 GUIControls, and I can't add more than 100 tokens for a map (for example).

So, the idea would be to be able to create new Buttons in runtime. Each time I create a token, it creates a Button that could be a copy of another one (for the scripts functions attached to them for example), and then act on them (change the graphic, the orientation etc...).

Is it a limitation of AGS Engine ? Or a limitation of engines in general ? Or something like that could be possible ?

Probably my question is stupid, as I'm not an expert like you. But perhaps... :)

Also, I hope my post is at the right place, as I thought it was a "development consideration", but sorry if it's not the case, I can delete it if necessary.

Anyway, congrats for AGS workers that make it possible to have such a program !
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Crimson Wizard on Sun 06/08/2023 12:42:36
Quote from: Baguettator on Sun 06/08/2023 08:42:21Is it a limitation of AGS Engine ? Or a limitation of engines in general ? Or something like that could be possible ?

This is the current limitation of the AGS engine. But frankly this is more of a design issue rather than a technical one. In other words, it's not too hard to create a button at runtime, it may be complicated to logically bind this with how the engine treats the objects created in the editor.
This is further complicated by AGS not supporting linking functions to events in script, which means that even if you create a button in script, you won't be able to receive click events from it.

Supporting doing this is theoretically in TODO (for a long time).

Quote from: Baguettator on Sun 06/08/2023 08:42:21My idea is that I'm making a "map editor" for something, so I have to place tokens (tiles, events, starting zones, objectives, characters etc...) to create a map. I can't imagine doing this another way than using GUIControls

For the purpose of having unknown number of objects on screen there are 3 existing options:
1. DrawingSurface. This is a traditional method. You may drawing anything, but you will have to store all the object properties in your custom structs, including their positions.
2. Overlays. They are not limited anymore since 3.6.0. The benefit of these for the map editor is probably that you don't have to script redrawing a map when moving/deleting these, and they may use fast scaling & rotation (may be not exactly important for the map editor).
3. Using a pool of objects. Will limit number of simultaneous objects on screen, so probably not the best solution for the map editor.

With the first two options you have to detect clicks yourself. How this is done depends on your use of them. If this is a "tiled" map editor that might be rather simple, since you can calculate which tile the player clicked on and proceed from that. Overall this is a big technical topic, which I won't like to cover in this forum thread.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Snarky on Sun 06/08/2023 14:38:41
@Baguettator, you may want to check out the ImGi module (https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-imgi-0-4-2-guis-with-script-and-overlays/), which allows you to create GUI Controls in script (though they're not "real" Controls, but a reimplementation using Overlays). Though since what you're trying to do isn't actually to create a GUI, you may be better off just implementing what you're trying to do yourself, as CW explains.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: eri0o on Sun 06/08/2023 15:20:18
Hey, my ImGi module started as using Overlays but it quickly changed to be based to Drawing Surface with it's own hashed-dirty-rects system due to the limitations of Overlays at the time - like, there was no sorting of overlays at the time.

There is still one limitation that makes it rather tricky to rewrite it as hardware accelerated that is there is no clipping in an Overlay, and this makes something like scrolling a bit hard to do - like, I would need to make things hardware accelerated and selectively degenerate things as software drawn when they were clipped, which is a bit hard. If there was some hardware accelerated clipping, than it could be done easier. Alternatively, some sort of Camera system in the GUI space would also work - although much harder to manage from a scripting perspective, "clippable " overlays would be far easier.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Baguettator on Sun 06/08/2023 22:13:28
Thanks for answers ! I didn't expect that it was a limitation of AGS engine, but something not too hard to update. So good news ! Even if it will take time to be achieved, I think the best thing is to wait and sometimes push the idea to ags developers :D

Thanks for the solutions and for erioo's module, it's what I thought about (I've never worked with overlays, but sounds great !). For now I'll stay with Guicontrols, as I have already implemented many things with it and it's easier to script. When Ags will be ready... I'll change :)

So, good news ! I hope to test AGS 4.0 soon !
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Baguettator on Sun 06/08/2023 22:26:38
EDIT : Crimson Wizard, you told that it's not complicated to create a button at runtime ? The biggest problem to link it to functions in script ? But does that mean that we could have AGS able to create buttons at runtime, and then we could interact with buttons using the "mouse_onclick" function, something like :

function onmouse_click ()
{
  GUIControl *g=GUIControl.GetAtScreen(mouse.x, mouse.y);
  if (g.Graphic==12)
  {
    //I know which token it is, so I do that
  }
}

It could be as simple as it, waiting for a long time if one day it could be possible to do more complex thing, attaching functions dynamically to controls by script. But if that simple case could be possible... could be great, isn't it ? :)
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Crimson Wizard on Sun 06/08/2023 22:30:55
Quote from: Baguettator on Sun 06/08/2023 22:26:38EDIT : Crimson Wizard, you told that it's not complicated to create a button at runtime ? The biggest problem to link it to functions in script ?

That is not the first problem. There's a number of things that have to be decided and changed in the engine to make supporting this convenient. I would have to go into more detail to explain, but I do not want to do this in this forum thread.

But, besides, if the button is not bound to events, then what's the point of creating it? It's easier to create an overlay.
Overlays are simpliest graphical objects in AGS, they are fast, flexible, may exist both on GUI and Room layer, and already support more graphic effects than buttons (e.g. scaling in 3.6.0 and rotation and blend in ags 4). This actually makes them superior to buttons, at least at the moment, if you excuse the lack of an automatic reaction to clicking.

You may do almost same thing in on_mouse_click with overlays as you do with buttons, except you need to write your own GetAtScreen for them.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Baguettator on Sun 06/08/2023 22:54:52
Yeah, but scripting an overlay to detect mouse clicks would be harder, isn't it ? I thought having a button is easier to detect that it's a button and I click on that, even if it doesn't have any function linked to it.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Crimson Wizard on Sun 06/08/2023 23:58:08
Quote from: Baguettator on Sun 06/08/2023 22:54:52Yeah, but scripting an overlay to detect mouse clicks would be harder, isn't it ?

Supposedly, but that's a typical problem, and has its solutions for a script.

EDIT:
It's also possible to add GetAtScreenXY for overlays too, I did not add that at a time because I wanted to keep its API simple, but guess it was a wrong idea.
The problem this is coupled with is that currently GetAtScreenXY works simply by iterating over all objects of the type and testing the coordinates. This will become slow with the large number of objects created, so some kind of an optimized algorithm would be prefered, like space partitioning. But same goes to anything else that would support dynamic creation.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: vga256 on Tue 15/08/2023 23:39:26
I am beginning AGS4 testing on a game that requires the new features offered by the new data structures. Please let me know if there are specific features or functions the team would like to see tested as I work.

Although I know this is not the proper place for this - I am also among those who needs support for runtime-generated/dynamic GUIs. Scripting workarounds to emulate this (e.g. spawning dozens of empty GUI elements and then showing/hiding them at runtime) is currently extremely painful as a developer.

For the time being, GetAtScreenXY for Overlays alone would be hugely useful for projects like mine.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Crimson Wizard on Wed 16/08/2023 04:08:27
Yes of course, having dynamically created objects would be an important and useful functionality.
But there is a number of problems and design questions that have to be resolved first. Especially if we don't want to push another set of ugly hacks into the engine. I need to gather up the information about everything that has to be solved, and write a ticket about this.

At the moment the dynamic creation of objects is not even in the first ags4 milestone draft:
https://github.com/adventuregamestudio/ags/issues/1298

There's always something else that has to be worked on. Always more and more tasks, problems and requests stacking up, and for some reasons their numbers are not diminishing, but rising in time. From all the tasks that I've been scheduling for a period of time, I accomplish around 50%, or less, and am constantly changing plans due to urgent requests. It's going like this for years.

This project has always been lacking a proper project manager who would work on setting up priority tasks and keep team focus on them.
As well as more help, at least to deal with minor tasks.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: eri0o on Wed 16/08/2023 14:27:31
About dynamically created objects we need to first have either delegates (#1409) (https://github.com/adventuregamestudio/ags/issues/1409) or pointer downcast (#2018) (https://github.com/adventuregamestudio/ags/issues/2018), so we can pass a function/action object from script to a function/attribute that "links" the necessary interactions. Since any of these will probably be exclusive to the new compiler and ags4 is meant to have both the old and the new compiler for a while, we can't do it there until the old compiler is let go - assuming the new dynamic creation will be the only way. So I don't see this making into ags4 without big changes (possibly breaking).

About AGS dev, I honestly think a lot of the problem is lack of people, for development. See this example from scummvm (https://github.com/scummvm/scummvm/pull/5188), there is like 5 people doing tests and trying different code ideas to solve a problem (our old FreeType dependency due to breaking changes in font metrics). A PM would be nice, but they would have trouble scoping with the limited resources - one more senior ags dev would be ideal, as I think only CW is senior among the contributors. Unfortunately I don't know how to get more devs or make the project more approachable.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: vga256 on Wed 16/08/2023 23:00:56
Quote from: eri0o on Wed 16/08/2023 14:27:31About dynamically created objects we need to first have either delegates (#1409) (https://github.com/adventuregamestudio/ags/issues/1409) or pointer downcast (#2018) (https://github.com/adventuregamestudio/ags/issues/2018), so we can pass a function/action object from script to a function/attribute that "links" the necessary interactions. Since any of these will probably be exclusive to the new compiler and ags4 is meant to have both the old and the new compiler for a while, we can't do it there until the old compiler is let go - assuming the new dynamic creation will be the only way. So I don't see this making into ags4 without big changes (possibly breaking).

Thanks for pointing out these challenges. As I'm not familiar with the compiler architecture, it helps to know this isn't a simple fix. From my perspective as a game developer, I can write "I wish AGS had..." type requests all day  :wink:
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: abstauber on Fri 25/08/2023 08:53:06
Just a small observation while I've been tinkering around with this: AGS 3.6.1b7 is quite a bit faster.

My testgame draws almost everything directly on a room surface and is quite heavy on the scripting side. In AGS 3.6.1b7 I get around 517 FPS, whereas in AGS4a3 it's 'just' around 310 FPS. But apart from this and the 16-bit graphics issue, it appears to be pretty stable indeed.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Crimson Wizard on Fri 25/08/2023 09:26:29
Quote from: abstauber on Fri 25/08/2023 08:53:06My testgame draws almost everything directly on a room surface and is quite heavy on the scripting side. In AGS 3.6.1b7 I get around 517 FPS, whereas in AGS4a3 it's 'just' around 310 FPS.

This is a serious difference, and is quite unexpected. Could you send us your test game for analysis?

Also, were you using old or new script compiler? We still support both, and old one is chosen in General Settings by default when you import old game, because the new one has stricter syntax rules. But new compiler is known to produce more efficient compiled script.

It's General Settings -> Compiler -> Use extended script compiler
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: abstauber on Fri 25/08/2023 09:59:48
The extended compiler is not too happy with all my legacy stuff going on, especially the tween module seems to need an update.
Anyhow the game starts and the difference is now a bit lower.

AGS361
(https://i.imgur.com/oY3DOqF.png)

AGS4
(https://i.imgur.com/UAZYAXS.png)
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: Crimson Wizard on Fri 25/08/2023 22:23:33
Quote from: abstauber on Fri 25/08/2023 09:59:48The extended compiler is not too happy with all my legacy stuff going on, especially the tween module seems to need an update.

I do recommend upgrading eventually, the new compiler provides much more useful syntax features, and possibly old one will be dropped at some point.

EDIT: Hm, actually, I notice that it compiles fine the project that you sent me. It prints warnings, some of them may be ignored (ones regarding default values), but others point to actual logical mistakes.
Title: Re: AGS 4.0 - Early Alpha 3 for public test
Post by: abstauber on Sat 26/08/2023 21:15:08
Thanks a lot for looking into this. Updating the code of my "game" for AGS4 is actually a great idea - and it's a good opportunity to get familiar with it once again.
Title: Re: AGS 4.0 - Early Alpha 4 for public test
Post by: Crimson Wizard on Fri 01/09/2023 21:33:53
Updated to Alpha 4
(Please use download links in the first post)

This is AGS 4.0 Early Alpha 4.

Contains updates and fixes from 3.6.1 Beta 7 and 8.

Other changes:

Editor:
- Translation sources are now saved in PO format.
- Fixed room data xml was saved without linebreaks and indentation.
- Fixed all room images (backgrounds, masks) were rewritten on disk each time a room is saved, even if they are not modified.

Compiler:
- Fixed forward-declared but unresolved function not reported correctly.
- Fixed accessing dynamic arrays with a numeric literal index was not tested for "out of bounds" mistake.
- Fixed multidimensional array index delimiters (",") were confused with function parameter delimiters in call to a function.

Script API:
- Added Joystick struct, meant to work with joystics and gamepads in script.

Engine:
- Support joystick and gamepad input.
- Fixed DynamicSprite.CreateFromSaveGame producing invisible screenshot sprites.
- Fixed an attempt to read screenshot from a save with no screenshot could cause engine to crash.
- Fixed 16-bit sprites in 32-bit games turning completely transparent.



WARNINGS:

1. SpeechCenter plugin will stop working with this AGS 4 update. It won't crash, but won't see translated strings. This is because Translation storage had changed in the Editor. The plugin will have to be updated to work with AGS 4.

2. AGSJoy plugin will not compile with AGS 4, because its Joystick struct will conflict with the AGS own Joystick struct. The solution is to either disable newest script API level (by lowering to v3.6.1, but that will also disable anything else), or adjust the code to work with the new Joystick API. The API is relatively simple, so upgrading should not be a huge problem. The plugin is no longer needed after that.
Title: Re: AGS 4.0 - Early Alpha 4 for public test
Post by: nightmarer on Sat 02/09/2023 16:57:02
Hello, I tried to open my project with this version and I got the following error.

https://imgur.com/vJpzMms (https://imgur.com/vJpzMms)
https://imgur.com/rJtGzU3 (https://imgur.com/rJtGzU3)

Error: El intervalo solicitado se extiende más allá del final de la matriz.
(This means: the interval requested is extended beyond the end of the array).
Version: AGS 3.99.107.0

System.ArgumentOutOfRangeException: El intervalo solicitado se extiende más allá del final de la matriz.
   en System.Runtime.InteropServices.Marshal.CopyToNative(Object source, Int32 startIndex, IntPtr destination, Int32 length)
   en AGS.Editor.BitmapExtensions.SetRawData(Bitmap bmp, Byte[] rawData, PixelFormat pixelFormat)
   en AGS.Editor.ObjectsEditorFilter.Paint(Graphics graphics, RoomEditorState state)
   en AGS.Editor.RoomSettingsEditor.bufferedPanel1_Paint(Object sender, PaintEventArgs e)
   en System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
   en System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   en System.Windows.Forms.Control.WmPaint(Message& m)
   en System.Windows.Forms.Control.WndProc(Message& m)
   en System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   en System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Title: Re: AGS 4.0 - Early Alpha 4 for public test
Post by: Crimson Wizard on Sat 02/09/2023 17:08:37
Quote from: nightmarer on Sat 02/09/2023 16:57:02Hello, I tried to open my project with this version and I got the following error.

Please tell, does this happen all the time, in any room, or in particular room?
Title: Re: AGS 4.0 - Early Alpha 6 for public test
Post by: Crimson Wizard on Fri 03/11/2023 17:30:25
Updated to Alpha 6
(Please use download links in the first post)

This is a small update, mostly to catch up with 3.6.1. Not many changes specific to AGS 4.

Contains updates and fixes from 3.6.1 Beta 9 to 12 (except ones related to backwards compatibility).

Other changes:

Common:
- Completely removed Global Messages and Room Messages.
- Removed built-in support for Game Score, including related game settings and GiveScore script command. Users are advised to script their own score counter if they need one.

Editor:
- Fixed "section" dropdown list in the script editor was getting broken by custom Color Themes.

Compiler:
- Accept constructor-like syntax (`T *o = new T();`), but skip the parentheses and do nothing, as AGS script does not really support constructors at this point. The purpose of this is to make it easier for users who have C++ or C# habits.
- Fixed "autoptr" struct's modifier required "builtin", should require only "managed".

Engine:
- Implemented more accurate Character movement. The movement direction is now more precise and diagonal movement speed no longer may exceed MovementSpeed setting.
Title: Re: AGS 4.0 - Early Alpha 6 for public test
Post by: Crimson Wizard on Sat 04/11/2023 01:56:11
@vga256,

Quote from: vga256 on Tue 15/08/2023 23:39:26For the time being, GetAtScreenXY for Overlays alone would be hugely useful for projects like mine.

I've been thinking about potential issues for a while, and came to a realization that this would not be useful at all, at least not in the current circumstances.

Suppose the engine will find an Overlay under cursor and give it to you, how do you tell which overlay that is?
You see, other objects have IDs, they have ScriptName property, some have custom properties, or interactions which you may run.
But Overlays do not have IDs, or anything at all to report their meaning (at least not in a direct sense), or connection with anything. What would you do with this random Overlay?

The way I see this, searching for an overlay under cursor is almost pointless, as it's nothing but a sprite on a screen. That would have more sense to search in custom script data instead, which in turn "owns" Overlay as its visual representation. Then we'd probably need an opposite kind of test: not Overlay.GetAtScreenXY() that finds some overlay under the coordinates, but Overlay.HitTest() that tells whether a particular overlay is under coordinates. But then, it may be easier and faster to test for a bounding rectangle right in script, unless your overlay is shape-transformed (rotated etc) or you need a pixel perfect test.

I suppose this requires a good forethought to investigate the use case and potential usability issues.

Besides this, ther's a number of problems regarding performance and object validation when doing GetAtScreenXY(). I'll put them under the spoiler:

Spoiler
1. Performance
The engine does not have any "magic" to spot overlays under the cursor, so it has to do some kind of a search. The most primitive method is to iterate all existing overlays and test each one's bounding box. That could work as a simple formal solution.
But given Overlays are not limited anymore, the game may have many thousands of them, and then this search will become slow. So this will not work as a general solution.

This problem may be countered by introducing object groups, where each group is limited by certain portion of the screen, and maybe even by z-order range (so x,y,z position). This would mean that the engine should be ready to move overlay between these groups whenever overlay changes its position or size.
Note: if this system is created, then this has to be done regardless of whether game script has a call to Overlay.GetAtScreenXY() ever or not at all.
Then, @eri0o has a concern that any changes to overlays update will make overlays "less fast", and he's being using them in many thousands in his games, and put an effort to make this work as fast as possible. I don't know and cannot tell beforehand how impactful such "grouping" system could be to the existing performance. But it's definite that such system has to be well designed and performance tested first.
On another hand, popular engines seem to separate objects that support hit detection and those which do not. This lets reduce number of objects that may be searched for. This may be done through type hierarchy, or components. For instance, iirc, Unity 3D requires an object to have a "collider" component in order to be detected by a hit test. Possibly only those "colliders" are involved in a object search mechanics. Is this also a way to go with Overlays in AGS, by making a distinct interactable type derived from them? i cannot tell, and this problem is also complicated by AGS being generally "clunky" when it comes to type hierarchy in script (lack of proper pointer casting, and so forth).

2. Validation
Then there's something else: engine does not know how do you use Overlays, and what for. But you do.
This means that you may have better idea on how to separate wanted and unwanted overlays for your search.
Look at this example: you are using Overlays to generate dynamic GUI controls, so you store them in arrays and describe their relations using pointers. If you are doing a click test - then first you may find out which parent GUI is under cursor, and then search in its children. This may be faster than searching all existing overlays.
If you are using overlays to create a tilemap, then you may narrow search down to a certain visible portion, or group of tiles close to coordinates, if these tiles would store pointers to overlays on top of them, for instance.
Not only your own search may be more optimal than engine's but also it may be more valid. As engine will search for any overlays at all, including standard ones like character speech, while you may want to limit the search to overlays that serve particular purpose in your game.

[close]
Title: Re: AGS 4.0 - Early Alpha 6 for public test
Post by: Exkodius on Mon 06/11/2023 01:52:24
Hi! I'm a long time lurker to these here forums and thought that i had to finally register to give a little heads up about a bug i found in trying out the early aplha 6 version.

In my project i work with 8-bit 256 colors. Sadly it seems that this version of the editor really does not like that, as it refuses to import my room backgrounds as anything other that 32-bit.

The new room subfolder structure is new to me so i might have missed something important. I did try to manually convert the image in the subfolder back into 256 colors and change the value of <ColorDepth>32</ColorDepth> to <ColorDepth>8</ColorDepth> in data.xml to no avail. I do get it to compile and run, but the colors are a garbled mess.

Any advice would be appriciated and a big thanks for still going strong after all these years!
Title: Re: AGS 4.0 - Early Alpha 6 for public test
Post by: Crimson Wizard on Mon 06/11/2023 03:17:56
Quote from: Exkodius on Mon 06/11/2023 01:52:24Hi! I'm a long time lurker to these here forums and thought that i had to finally register to give a little heads up about a bug i found in trying out the early aplha 6 version.

In my project i work with 8-bit 256 colors. Sadly it seems that this version of the editor really does not like that, as it refuses to import my room backgrounds as anything other that 32-bit.

Hello.
I guess nobody tested the new version with 8-bit games yet. I'll try this and open a bug ticket.

EDIT:
https://github.com/adventuregamestudio/ags/issues/2218
Title: Re: AGS 4.0 - Early Alpha 7 for public test
Post by: Crimson Wizard on Fri 22/12/2023 04:53:56
Updated to Alpha 7
(Please use download links in the first post)

Contains updates and fixes from 3.6.1 Beta 13 to 15 (except ones related to backwards compatibility).

Other changes:

Editor:
- Fixed occasional crash when scrolling the room in the editor.
- Fixed room not getting recompiled with a new content if a background or a mask was modified externally.

Scripting:
- Multi-dimensional dynamic arrays, also known as "jagged arrays". These are arrays of arrays, where each parent array's element has to be created separately, but may be of any independent length.
- Regular arrays of dynamic arrays: that is a regular array where each element is a pointer to a dynamic array of the same type.
- Dynamic arrays of regular structs.



This update contains a wonderful addition to scripting by @fernewelten : multidimensional dynamic arrays. Also known as "jagged arrays", because each sub-element may have its own length.

In these each element of all dimensions except last one is a pointer to another dynamic array, and elements of last dimension are values of the array's type. All sub-arrays must be created individually, but also may have a independent length.

First you must create the "parent" array, then you may create sub-arrays for each of its elements. Each nesting level the sub-array has one dimension less. When you create actual arrays, only the first dimension must have a fixed size, and following dimensions still have undefined size.

About like this:
Code (ags) Select
// declare a 3-dimensional array
int dyn_arr[][][];
// create 3-dimensional array of size 10
dyn_arr = new int[10][][];
// for the 5th element of the first dimension,
// create a 2-dimensional array of size 20
dyn_arr[5] = new int[20][];
// for the 6th element of the first dimension,
// create a 2-dimensional array of size 25
dyn_arr[6] = new int[25][];
// for the 15th element of the 5th element,
// create a 1-dimensional array of size 40
dyn_arr[5][15] = new int[40];
// finally we may access the actual integer values
dyn_arr[5][15][35] = 100;


Regular arrays of dynamic arrays are also supported, and also may be of any number of dimensions. For instance, you could have this "mixed" array:
Code (ags) Select
int overcomplicated_array[10][20][][];

Here first upper dimensions are fixed in script memory, and the two last ones are dynamic.

Code (ags) Select
overcomplicated_array[5][15] = new int[100][];
overcomplicated_array[5][15][50] = new int[200];
Title: Re: AGS 4.0 - Early Alpha 7 for public test
Post by: Rulaman on Tue 02/01/2024 19:57:57
After a short Test with the AGS4 alpha 7 version I found some problems.

The conversion (from AGS 3.6.12 beta 13) was ok, but the crm files did not get deleted. (I expected this)

And I could not display any rooms objects

QuoteError: Der angeforderte Bereich geht über das Arrayende hinaus. <- Index out of bound
Version: AGS 4.00.00.02

System.ArgumentOutOfRangeException: Der angeforderte Bereich geht über das Arrayende hinaus.
 bei System.Runtime.InteropServices.Marshal.CopyToNative(Object source, Int32 startIndex, IntPtr destination, Int32 length)
 bei AGS.Editor.BitmapExtensions.SetRawData(Bitmap bmp, Byte[] rawData, PixelFormat pixelFormat)
 bei AGS.Editor.BitmapExtensions.SetRawData(Bitmap bmp, Byte[] rawData)
 bei AGS.Editor.ObjectsEditorFilter.Paint(Graphics graphics, RoomEditorState state)
 bei AGS.Editor.RoomSettingsEditor.bufferedPanel1_Paint(Object sender, PaintEventArgs e)
 bei System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
 bei System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
 bei System.Windows.Forms.Control.WmPaint(Message& m)
 bei System.Windows.Forms.Control.WndProc(Message& m)
 bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)
 bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
 bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
 bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


I debugged the error to the following function

Quotepublic static void SetRawData(this Bitmap bmp, byte[] rawData, PixelFormat pixelFormat)
{
    BitmapData data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, pixelFormat);
    int pixelCount = Math.Abs(data.Stride) * data.Height;
    Marshal.Copy(rawData, 0, data.Scan0, pixelCount);
    bmp.UnlockBits(data);
}

The bitmap size is 14x20
the pixelCount 1120
and the rawdata length is 560

I think there is some problem with the conversion.

When I get back in the callstack, i get the sprite info which is Format16bppRgb565
but this will be put over a Format32bppArgb image.

Quoteusing (Bitmap sprite = Factory.NativeProxy.GetBitmapForSprite(obj.Image))
using (Bitmap sprite32bppAlpha = new Bitmap(sprite.Width, sprite.Height, PixelFormat.Format32bppArgb))
{
    sprite32bppAlpha.SetRawData(sprite.GetRawData());
    graphics.DrawImage(sprite32bppAlpha, xpos, ypos, spriteSize.Width, spriteSize.Height);
}


The code tags looks very ugly.
Rulaman
Title: Re: AGS 4.0 - Early Alpha 7 for public test
Post by: Crimson Wizard on Wed 03/01/2024 04:40:04
Quote from: Rulaman on Tue 02/01/2024 19:57:57The conversion (from AGS 3.6.12 beta 13) was ok, but the crm files did not get deleted. (I expected this)

The crm files are still used in a compiled game, but they are strictly output files now. They are updated when you do Build game and put inside game data. On another hand, when the game is run from editor in "Test run" mode, the game files are not packed and engine reads these files directly from disk. This makes game test launch faster. They are never deleted for the same reason: to make things faster if you re-run test game repeatedly.
This may be a good idea to move these into some "intermediate output" folder though, so to not confuse people.

Quote from: Rulaman on Tue 02/01/2024 19:57:57And I could not display any rooms objects

<...>

I think there is some problem with the conversion.

When I get back in the callstack, i get the sprite info which is Format16bppRgb565
but this will be put over a Format32bppArgb image.

Quoteusing (Bitmap sprite = Factory.NativeProxy.GetBitmapForSprite(obj.Image))
using (Bitmap sprite32bppAlpha = new Bitmap(sprite.Width, sprite.Height, PixelFormat.Format32bppArgb))
{
    sprite32bppAlpha.SetRawData(sprite.GetRawData());
    graphics.DrawImage(sprite32bppAlpha, xpos, ypos, spriteSize.Width, spriteSize.Height);
}

So your object sprite is 16-bit but it tries to interpret its pixel data as 32-bit? I will test this myself too and open a bug ticket.


Quote from: Rulaman on Tue 02/01/2024 19:57:57The code tags looks very ugly.

If you have problems with these please mention this in "Site & Forum Reports", the forum and website is not something that AGS developers are responsible for:
https://www.adventuregamestudio.co.uk/forums/site-forum-reports/
Title: Re: AGS 4.0 - Early Alpha 7 for public test
Post by: Kastchey on Mon 29/01/2024 20:28:32
Not sure if this is intended, but DialogOptionsRenderingInfo seems to have lost .HasAlphaChannel property in 4.0.

AGS 3.6:
(https://i.postimg.cc/FRtL65v3/ags36.png)

AGS 4.0:
(https://i.postimg.cc/LsgPv4cm/ags4.png)
Title: Re: AGS 4.0 - Early Alpha 7 for public test
Post by: Crimson Wizard on Tue 30/01/2024 02:32:08
Quote from: Kastchey on Mon 29/01/2024 20:28:32Not sure if this is intended, but DialogOptionsRenderingInfo seems to have lost .HasAlphaChannel property in 4.0.

Yes, it's been cut out, as well as from DynamicSprite and DrawingSurface.
In AGS 4.0 we decided that all 32-bit sprites and surfaces assume valid alpha-channel, because having this property complicated the engine behavior.

This is mentioned in the changelog in the first post.
Quote- Removed "hasAlphaChannel" param from DynamicSprite.Create() and CreateFromExistingSprite().
- Removed HasAlphaChannel property from DialogOptionsRenderingInfo.


EDIT:
I must clarify, the normal transparent color also works, both when importing a sprite, or when drawing with COLOR_TRANSPARENT in script, because it has alpha 0. In the future we plan to support full RGBA color definition in color properties and script drawing.
Title: Re: AGS 4.0 - Early Alpha 7 for public test
Post by: Kastchey on Tue 30/01/2024 11:32:22
Ah I see, sorry I missed that in the changelog then. I was looking at the help files within the editor which still list the property as included.
Title: Re: AGS 4.0 - Early Alpha 7 for public test
Post by: Crimson Wizard on Tue 30/01/2024 12:34:44
Quote from: Kastchey on Tue 30/01/2024 11:32:22Ah I see, sorry I missed that in the changelog then. I was looking at the help files within the editor which still list the property as included.

Unfortunately, we do not have a proper manual for 4.0 yet. No one have bothered to write articles about new features yet, and also our manual source currently has a problem that it's somewhat inconvenient to have version branches. Hopefully this will be resolved.
Title: Re: AGS 4.0 - Early Alpha 7 for public test
Post by: Kastchey on Tue 30/01/2024 12:36:05
Understandable, and noted. Thanks!
Title: Re: AGS 4.0 - Early Alpha 8 for public test
Post by: Crimson Wizard on Wed 21/02/2024 07:38:32
Updated to Alpha 8
(Please use download links in the first post)

Contains updates and fixes from 3.6.1 Beta 16 to RC5 (except ones related to backwards compatibility).

Other changes:

Editor:
- Added Enabled and Visible properties to Characters, Enabled property to Room Objects.
- Added FaceDirectionRatio property to General Settings, Room and Walkable Areas.

Script API:
- Added WalkableArea and Walkbehind structs which let work with these region types in OO-style.
- Added Character.Enabled and Visible properties, added Object.Enabled property, Character.on is deprecated.
- Added Game.FaceDirectionRatio, Room.FaceDirectionRatio, WalkableArea.FaceDirectionRatio and Character.FaceDirectionRatio.
- Added File.Rename().
- ListBox.FillSaveGameList(), RestoreGameDialog() and SaveGameDialog() now let define a range of save slots for display.
- Added MoveSaveSlot() which renames a savegame.
- Added "walkarea[]" and "walkbehind[]" global arrays.
- Global arrays of game objects (Characters, GUIs, etc) are now declared as arrays of object *pointers*. From the user's perspective this is a mere formality, as working with these arrays will be syntactically same, but this makes it easier for the engine to handle these arrays and objects internally.
- Removed Object.MergeIntoBackground() function as redundant, and complicating Object's logic.

Engine:
- AudioChannel.Position and PositionMs no longer return a very large value while skipping cutscene.
- DeleteSaveSlot() no longer causes highest save to be renamed to fill a gap in saves.







The new WalkableArea and Walkbehind structs are declared as:
Code (ags) Select
builtin managed struct WalkableArea {
  /// Gets the walkable area at the specified position on the screen.
  import static WalkableArea* GetAtScreenXY(int x, int y);
  /// Returns the walkable area at the specified position within this room.
  import static WalkableArea* GetAtRoomXY(int x, int y);
  /// Gets the drawing surface for the 8-bit walkable mask
  import static DrawingSurface* GetDrawingSurface();
  /// Changes this walkable area's scaling level.
  import void SetScaling(int min, int max);
  /// Gets the ID number for this area.
  import readonly attribute int ID;
  /// Gets/sets whether this walkable area is enabled.
  import attribute bool Enabled;
  /// Gets this walkable area's minimal scaling level.
  import readonly attribute int ScalingMin;
  /// Gets this walkable area's maximal scaling level.
  import readonly attribute int ScalingMax;
  /// Gets/sets the optional y/x ratio of character's facing directions, determining directional loop selection for each Character while on this area.
  import static attribute float FaceDirectionRatio;
};

builtin managed struct Walkbehind {
  /// Gets the walk-behind at the specified position on the screen.
  import static Walkbehind* GetAtScreenXY(int x, int y);
  /// Returns the walk-behind at the specified position within this room.
  import static Walkbehind* GetAtRoomXY(int x, int y);
  /// Gets the drawing surface for the 8-bit walk-behind mask
  import static DrawingSurface* GetDrawingSurface();
  /// Gets the ID number for this walk-behind.
  import readonly attribute int ID;
  /// Gets/sets this walk-behind's baseline.
  import attribute int Baseline;
};

They are accessible from new global arrays:
Code (ags) Select
WalkableArea *walkarea[AGS_MAX_WALKABLE_AREAS];
Walkbehind *walkbehind[AGS_MAX_WALKBEHINDS];

For example:
Code (ags) Select
walkarea[0].Enabled = false;
walkbehind[4].Baseline = 200;
Title: Re: AGS 4.0 - Early Alpha 8 for public test
Post by: eri0o on Wed 21/02/2024 13:53:46
Hey, on GitHub the release name has a typo, it should be "v4.0.0.3 (AGS 4.0 Early Alpha 8)". :)
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Fri 15/03/2024 17:22:20
Updated to Alpha 9
(Please use download links in the first post)

Contains updates and fixes from 3.6.1 Beta RC6 (except ones related to backwards compatibility).

Other changes:

Editor:
- Fixed 8-bit images imported and converted for a 32-bit game to not get their colors clamped to a low-precision palette.
- Fixed 8-bit rooms not being usable in the new Editor version (regression in AGS 4).
NOTE: 8-bit backgrounds are still not working fully correct in this version, new imported bgs do not have their palette remapped.

Script API:
- Added VideoPlayer struct, which provides means of playing non-blocking videos rendered onto a sprite that may be displayed on any game object.

Engine:
- Camera will not follow a disabled player character.
- Fixed error occuring when trying to make a screenshot while running Direct3D renderer (regression in AGS 4).
- Fixed sprites leaving traces on background while running Software renderer (regression in AGS 4).







The new VideoPlayer struct is declared as:
Code (ags) Select
builtin managed struct VideoPlayer {
  import static VideoPlayer* Open(const string filename, bool autoPlay=true, RepeatStyle=eOnce);
  /// Starts or resumes the playback.
  import void Play();
  /// Pauses the playback.
  import void Pause();
  /// Advances video by 1 frame, may be called when the video is paused.
  import void NextFrame();
  /// Changes playback to continue from the specified frame; returns new position or -1 on error.
  import int  SeekFrame(int frame);
  /// Changes playback to continue from the specified position in milliseconds; returns new position or -1 on error.
  import int  SeekMs(int position);
  /// Stops the video completely.
  import void Stop();

  /// Gets current frame index.
  import readonly attribute int Frame;
  /// Gets total number of frames in this video.
  import readonly attribute int FrameCount;
  /// Gets this video's framerate (number of frames per second).
  import readonly attribute float FrameRate;
  /// Gets the number of sprite this video renders to.
  import readonly attribute int Graphic;
  /// The length of the currently playing video, in milliseconds.
  import readonly attribute int LengthMs;
  /// Gets/sets whether the video should loop.
  import attribute bool Looping;
  /// The current playback position, in milliseconds.
  import readonly attribute int PositionMs;
  /// The speed of playing (1.0 is default).
  import attribute float Speed;
  /// Gets the current playback state (playing, paused, etc).
  import readonly attribute PlaybackState State;
  /// The volume of this video's sound, from 0 to 100.
  import attribute int Volume;
};


The idea is that you create a VideoPlayer object, and then use its Graphic property to assign the video frame to something, like room object, or Overlay.
NOTE: scaling video is done by scaling an object: for example, you may play a 320x180 video in a 1920x1080 game by assigning to an Overlay and changing Overlay's Width and Height - that's the simplest and fastest (performance-wise) method for stretching video in game so far.

After that you may control the video playback any way you like: start it, stop it, pause and resume, change speed and audio volume.
WARNING: proper Seek is currently not implemented, but Seek(0) works, rewinding the video back to beginning.

Video's FPS is completely disconnected from the game's FPS. Videos are played as a background "process", and their state and displayed frame is synchronized with the game once per game's update. If video's FPS is lower than the game, that would simply mean that the game may display same frame during 2 or more updates. If video's FPS is higher than the game, that would result in frame skipping, because some frames will be replaced faster than the game can display them.

On another hand, you may choose to open VideoPlayer in a non-automatic mode, by passing "autoPlay = false". Then you may use NextFrame() function to advance a frame manually, according to your own rules. There's an important nuance: video's audio track is not played with NextFrame(), but only when the video is played automatically.

Multiple simultaneous video playbacks are supported, but keep in mind that decoding and preparing a frame on screen takes time, so more videos you play in parallel, the more performance hit will be.
In general, following are the factors that slow things down:
- Number of simultaneous video playbacks;
- Video's resolution (but scaling video frame using game object is fast!);
- Video's FPS: the higher FPS the more often the frame has to be decoded and updated, increasing amount of work.


Example:
Code (ags) Select
VideoPlayer *MyVideo;
Overlay *VideoOver;

function ButtonPlay_OnClick(GUIControl *control, MouseButton button)
{
    MyVideo = VideoPlayer.Open("video.ogv", true, eRepeat);
    if (MyVideo)
    {
        VideoOver = Overlay.CreateRoomGraphical(0, 0, MyVideo.Graphic);
        VideoOver.Width = 320;
        VideoOver.Height = 200;
    }
}

function ButtonPauseResume_OnClick(GUIControl *control, MouseButton button)
{
    if (MyVideo)
    {
        if (MyVideo.State == ePlaybackOn)
            MyVideo.Pause();
        else
            MyVideo.Play();
    }
}

function ButtonStop_OnClick(GUIControl *control, MouseButton button)
{
    if (MyVideo)
    {
        MyVideo = null;
        VideoOver = null;
    }
}

function ButtonSlower_OnClick(GUIControl *control, MouseButton button)
{
    if (MyVideo)
    {
        MyVideo.Speed = 0.5;
    }
}

function ButtonNormal_OnClick(GUIControl *control, MouseButton button)
{
    if (MyVideo)
    {
        MyVideo.Speed = 1.0;
    }
}

function ButtonFaster_OnClick(GUIControl *control, MouseButton button)
{
    if (MyVideo)
    {
        MyVideo.Speed = 2.0;
    }
}

function ButtonFrame_OnClick(GUIControl *control, MouseButton button)
{
    if (MyVideo)
    {
        MyVideo.NextFrame();
    }
}
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Fri 15/03/2024 17:25:03
I reposted the recent update again (see a post above), but the problem with room backgrounds in 8-bit games was not fully fixed, and will take more time to investigate and fix.

Importing existing 8-bit games in ags4 now works properly (judging by few tests), but adding new backgrounds does not work correctly yet (they look wrong at runtime).
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: lapsking on Mon 18/03/2024 05:40:18
I think I found an issue, unfortunately. It happens on all AGS 3.6. Haven't tried it on 4.0 yet.

I'm making a high resolution game 1920x1080. Khris wrote me a specific code for a new exit hotspot function: Here (https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/changing-the-verb-when-mouse-moves-over-hotspot-solved/msg636648867/#msg636648867)

It has been working well in all of the rooms. But the last room I'm working on has a glitch. The code is the same and everything. So it took me good few hours to realize glitch happens after interacting with more objects visible=true, visible=false. Is it possible the code is not working because my game is high resolution and because of more objects appearing and disappearing this issue happens? I don't know what else it can be cause otherwise the code is doing fine. That's the only thing that comes to my mind. Some memory or I don't what issue to make code work properly? Maybe I had to post this on AGS 3.6 forums though!

Edit: Sometimes if I leave the room and come back after a reload the issue is resolved. Can it be some kind of a memory overload that doesn't  let the code function properly, since the code also has something to do with storing previous function in memory and reloading it.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Mon 18/03/2024 06:13:10
Quote from: lapsking on Mon 18/03/2024 05:40:18It has been working well in all of the rooms. But the last room I'm working on has a glitch. The code is the same and everything. So it took me good few hours to realize glitch happens after interacting with more objects visible=true, visible=false. Is it possible the code is not working because my game is high resolution and because of more objects appearing and disappearing this issue happens? I don't know what else it can be cause otherwise the code is doing fine. That's the only thing that comes to my mind. Some memory or I don't what issue to make code work properly? Maybe I had to post this on AGS 3.6 forums though!

Yes, bug reports (and suspicions) are better posted in the forum thread dedicated to the version that you are using.

We'd need to see a exact code that you think is not working, the description of the room (what is present there), and what exactly happens wrong. I won't be able to answer your questions without this information.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: lapsking on Mon 18/03/2024 06:17:23
Sorry, Crimson.  If it does worth having a look, shall I remove this post from here and write it with more details where it was supposed to be?
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Mon 18/03/2024 06:44:35
Quote from: lapsking on Mon 18/03/2024 06:17:23Sorry, Crimson.  If it does worth having a look, shall I remove this post from here and write it with more details where it was supposed to be?

There's no need to remove anything, but surely post the description of this problem with more details.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Fri 22/03/2024 05:38:18
Hi !

I'm sorry if I missed something, but are the jagged arrays available for custom structs too ? (I mean for structs I created myself).
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Fri 22/03/2024 05:54:01
Quote from: Baguettator on Fri 22/03/2024 05:38:18I'm sorry if I missed something, but are the jagged arrays available for custom structs too ? (I mean for structs I created myself).

There's no such thing as "custom struct" really, any struct acts the same.
The difference in behavior are only added by struct's modifiers, these are: "managed" and "builtin".

Jagged arrays only work with "managed" structs.
EDIT: I made a mistake, apparently they work with non-managed structs too. But I would need to test this to be certain.
EDIT2: Alright, I tested, and they work with anything: simple types (like "int"), normal structs and managed structs.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Sat 23/03/2024 09:53:58
Good news thanks Crimson !

I tried to upgrade my game with 4.0, but when I run it, it crashes and says for all my rooms "if you have deleted roomX.asc, use the Exclude From Game option". What is it intended ?
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Sat 23/03/2024 10:50:55
Quote from: Baguettator on Sat 23/03/2024 09:53:58I tried to upgrade my game with 4.0, but when I run it, it crashes and says for all my rooms "if you have deleted roomX.asc, use the Exclude From Game option". What is it intended ?

No, of course that's not intended. The "if you have deleted roomX.asc" is shown when the room script file is missing.
On a side note, that message is silly and should be changed.

Did you have any errors or messages during upgrade?
Is there a new "Rooms" subfolder in your project files, and what does it have inside?
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Sat 23/03/2024 11:50:11
I can't look at the project now, but during the upgrade, when I loaded my game into the editor 4.0, I saw a message saying "updating rooms in open format", and it seemed to work well !

Will look at the project asap.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Alan v.Drake on Sat 23/03/2024 12:46:13
Depending on when it crashed, either the scripts didn't get copied over to the new room format folders, or the Editor is retrying to upgrade the old rooms to the new format and can't find the scripts because they were moved to the new folders.

- Alan
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Sun 24/03/2024 15:30:57
The game doesn't launch, so it crashes just after I click the "run" button.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Sun 24/03/2024 15:46:56
Were you able to check the "Rooms" folder in your project?
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Sun 24/03/2024 21:27:40
Now, yes ! I hav a "Room" folder with all of my 17 rooms folders, and inside of each one there are "background", "walkable area", "hotspot", "regions", "walkbehind" and "data" files.

The scripts seem to be .crm files, but they are at the root of the game's folder (with othr scripts)
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Sun 24/03/2024 22:16:53
Quote from: Baguettator on Sun 24/03/2024 21:27:40The scripts seem to be .crm files, but they are at the root of the game's folder (with othr scripts)

No, .crm files are compiled rooms. Room scripts must be called roomN.asc and located inside "Rooms".
From your post it seems like they are not there.

Do you have a previous version of the game backed up? Does it have roomN.asc files? If so, could you try upgrading once more from backup copy, and see if room scripts appear properly in ags4 version?
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: eri0o on Sun 24/03/2024 22:19:40
In the Rooms directory, if I remember correctly, there is a directory with a number for each room and in each directory a XML for the room description, a script Room1.asc (or whatever is the room number)  a few PNG files for the masks and background.

The crm files in the project root are just the "built" binary rooms, and in ags4 you don't need to version them anymore because it should be possible to recover them from the source files in Rooms directory.

Edit: CW was faster. :)
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Mon 25/03/2024 04:25:06
Ahah, thanks a lot for your answers (and congrats to CW the man who answers faster than his shadow !)

I don't see any .asc file in the room folder, but there were .asc files for each of my rooms in the 3.6 version of my game. I could try to re-upgrade my game from a backup version, but it's exactly what I did before, so it should be the same result...

Perhaps I could try to copy/paste manually the .asc files from my back up directly into rooms folder in the upgraded version ?

I will try to reupgrade too and tell you if it worked (it's an other pc where I can't go often, but perhaps in the evening today)
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Mon 25/03/2024 06:52:32
Quote from: Baguettator on Mon 25/03/2024 04:25:06Perhaps I could try to copy/paste manually the .asc files from my back up directly into rooms folder in the upgraded version ?

Yes, you could do that too.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Mon 25/03/2024 08:42:08
Copy/paste the .asc files from the back up seems to work. but upgrading deletes the asc files... Could it be fixed ?
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Mon 25/03/2024 08:55:22
Quote from: Baguettator on Mon 25/03/2024 08:42:08Copy/paste the .asc files from the back up seems to work. but upgrading deletes the asc files... Could it be fixed ?

I never experienced such problem when testing upgrading a project.
Which exact version of AGS 4 are you using? (this may be seen in Help->About)
Does this happen to any project you upgrade or only to a particular one?

room.asc is the only file that is moved to Rooms. *.crm files are not moved, and the rest is created anew. In theory this might mean that file copying or moving is not working for some reason. It may be worth investigating if this process is safe, in terms of checking wether copy operation is successful before removing old files.

Do you have any antivirus, or programs like Windows Defender active on your computer? If so, would it improve the situation if you disable them, or tell them to ignore your project folder before upgrading?
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Alan v.Drake on Mon 25/03/2024 11:00:06
When I asked when it crashed, I meant the Editor, because it's possible something went wrong during upgrade and the upgraded project was never saved (you have to save manually in any case). If the project is recognized as "not upgraded" the Editor will retry again to upgrade from the CRM files, but this time there wont be the scripts, and this is how these problems arise.

We should probably force a save after an upgrade, or ask for confirmation before proceeding.

- Alan
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Mon 25/03/2024 11:29:16
Quote from: Alan v.Drake on Mon 25/03/2024 11:00:06If the project is recognized as "not upgraded" the Editor will retry again to upgrade from the CRM files, but this time there wont be the scripts, and this is how these problems arise.

We should probably force a save after an upgrade, or ask for confirmation before proceeding.

I wrote a ticket about this problem in the past:
https://github.com/adventuregamestudio/ags/issues/1596

Not sure if it's the same case though, as this problem occurs only if you close the Editor without saving nor building (or running) the game after upgrade.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Tue 26/03/2024 08:42:42
That's exactly what I did : I openned my game with AGS4.0, it converted the rooms, but I didn't save the project with AGS 4.0 the first time. So the .asc files were deleted at the second launch of AGS4.0 as Alan v.Drake just said. Sorry, it was my fault  :-[

I will try to upgrade fully my game soon, and will tell you if I encounter any bug !

Thanks a lot for helping !
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Thu 28/03/2024 11:58:47
Hey again, sorry for asking again, but will AGS 4.0 be able to manage PNG files in Dynamic Sprites ? It would be so great especially for transparent backgrounds...
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Fri 29/03/2024 12:20:16
Quote from: Baguettator on Thu 28/03/2024 11:58:47Hey again, sorry for asking again, but will AGS 4.0 be able to manage PNG files in Dynamic Sprites ? It would be so great especially for transparent backgrounds...

If you are referring to DynamicSprite.CreateFromFile, then I suppose it's possible to extend the supported formats, if we add a proper image-loading library to the engine (this was discussed some time ago).

But which "transparent backgrounds" are you speaking of, and why do you need dynamic sprites for these?
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Sun 21/04/2024 14:04:36
Well, using PNG files will be always easier, this way you don't need to save a BMP file in a "magic pink" background to "emulate" a transparent background. It would be a quality-of-life improvement I presume ?

EDIT : also, I'm always working with PNG files, never with BMP files. But perhaps I'm a lonely bad guy :)

Anyway, the proposal milestone of AGS 4 looks great ! Have you got any release date for a fully achieved version ?
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Sun 21/04/2024 14:16:22
Quote from: Baguettator on Sun 21/04/2024 14:04:36Well, using PNG files will be always easier, this way you don't need to save a BMP file in a "magic pink" background to "emulate" a transparent background. It would be a quality-of-life improvement I presume ?

EDIT : also, I'm always working with PNG files, never with BMP files. But perhaps I'm a lonely bad guy :)

Everyone seems to be working with PNGs today, and AGS allows to import PNGs into your game.
It's just that creating dynamic sprites from image files is not a very common thing, so extending image format support for this function was never addressed.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Mon 22/04/2024 04:43:30
Well at least for me, creating Dynamic Sprites using PNG files could be very useful :)
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Thu 02/05/2024 00:18:34
It's been a while since AGS 4 alpha had an update, in the meantime there have been a 3.6.1 release with 2 patches.

I've been thinking to release a AGS 4 update right now, but there's one issue after recent changes that has to be fixed before giving this version to public use. Hopefully this may be done on this week.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Thu 02/05/2024 07:28:15
And what's about PNG files able to be used in DynamicSprite.CreateFromExistingFile ? Will it be available for AGS 3.6.X ? Or only AGS 4 ? Or none of them ?

Congrats for all the work on AGS program :)
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Crimson Wizard on Thu 02/05/2024 07:54:41
Quote from: Baguettator on Thu 02/05/2024 07:28:15And what's about PNG files able to be used in DynamicSprite.CreateFromExistingFile ? Will it be available for AGS 3.6.X ? Or only AGS 4 ? Or none of them ?

I cannot tell at this moment. I was not addressing this task yet.
Title: Re: AGS 4.0 - Early Alpha 9 for public test
Post by: Baguettator on Thu 02/05/2024 11:42:07
No problem ! Thanks ;)
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Crimson Wizard on Mon 06/05/2024 19:11:10
Updated to Alpha 10
(Please use download links in the first post)

This update does not contain any major additions, was made primarily to sync fixes with the latest 3.6.1 release.
Contains updates and fixes from 3.6.1 up to Patch 2 (except ones related to backwards compatibility).

Other changes:

Editor:
- More panes in the Editor are DPI-aware (rescale well with the system font scaling).
- Editor tabs now display icons indicating their contents (may be disabled in Editor Preferences).
- Room panel tabs now display room names.
- Support reordering folders in Project Explorer with drag & drop.
- Support importing plain script files: ash, asc or both, - besides script modules (*.scm).
- Added "Controls transparency" slider to GUI edit pane.
- Fixed few problems occuring when importing old rooms into the new editor.
- Fixed some of the new files could be left after old room upgrade in case of a failure.
- Fixed import, palette remap and compilation of 8-bit room backgrounds in 8-bit games.
- Fixed double warning message when trying to close the Editor while a game test is running.

Script API:
- Added Character.MoveStraight() complementing WalkStraight().
- Added String.Join(), String.Split() and String.Trim() functions.
- Added System.GetEngineInteger() and System.GetEngineString() for returning diagnostic information about engine's runtime state. Possible arguments are defined by EngineValueID enum.

Engine:
- Overlay.X and Y properties of textual screen overlays, such as blocking speech, now treat assigned values correctly as screen coordinates and return values set by user consistently. They also return the assigned values without any offsets for textual overlays created using a TextWindow (having extra borders and padding).
- Added "--no-plugins" command-line argument that denies loading any plugins; also added respective config option.
- Fixed taking screenshots not working properly (regression in AGS 4.0).



The two new functions System.GetEngineInteger(EngineValueID value, int index = 0) and System.GetEngineString(EngineValueID value, int index = 0) may now be used to get some values that describe engine's state, rather than game's state.
Here's the list of currently supported parameters:

Code (ags) Select
// Engine value constant name pattern:
// ENGINE_VALUE_<I,II,S,SI>_NAME, where
//   I - integer, II - indexed integer, S - string, SI - indexed string.

  ENGINE_VALUE_UNDEFINED = 0,              // formality...
  ENGINE_VALUE_SI_VALUENAME,             // get engine value's own name, by its index
  ENGINE_VALUE_S_ENGINE_NAME,          //
  ENGINE_VALUE_S_ENGINE_VERSION,    // N.N.N.N (with an optional custom tag)
  ENGINE_VALUE_S_ENGINE_VERSION_FULL,    // full, with bitness, endianess and any tag list
  ENGINE_VALUE_S_DISPLAY_MODE_STR, // string contains display mode information ( width x height x color depth, etc)
  ENGINE_VALUE_S_GFXRENDERER,
  ENGINE_VALUE_S_GFXFILTER,
  ENGINE_VALUE_I_SPRCACHE_MAXNORMAL,  // user-defined sprite cache size limit
  ENGINE_VALUE_I_SPRCACHE_NORMAL,        // current sprite cache size
  ENGINE_VALUE_I_SPRCACHE_LOCKED,       // size of "locked" sprites (prevented from disposal)
  ENGINE_VALUE_I_SPRCACHE_EXTERNAL,   // size of "external" sprites not automatically disposed (basically - DynamicSprites)
  ENGINE_VALUE_I_TEXCACHE_MAXNORMAL,  // user-defined texture cache size limit
  ENGINE_VALUE_I_TEXCACHE_NORMAL,    // current texture cache size
  ENGINE_VALUE_I_FPS_MAX,     // max allowed FPS (set as GameSpeed, or with --fps command line arg)
  ENGINE_VALUE_I_FPS,    // actual average FPS
  ENGINE_VALUE_LAST                      // in case user wants to iterate them

Example of use:

Code (ags) Select
function repeatedly_execute_always()
{
    int current = System.GetEngineInteger(ENGINE_VALUE_I_SPRCACHE_NORMAL);
    int max = System.GetEngineInteger(ENGINE_VALUE_I_SPRCACHE_MAXNORMAL);
    lblSpriteCacheLoad.Text = String.Format("Sprites: %d / %d KB (%d%%)",
           current, max, current * 100 / max);
}
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: eri0o on Mon 06/05/2024 19:15:27
I think the tabs icons depends on it being enabled in the Editor preferences and I think it defaults on not being enabled - not sure on this last part.
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Crimson Wizard on Mon 06/05/2024 19:26:58
Quote from: eri0o on Mon 06/05/2024 19:15:27I think the tabs icons depends on it being enabled in the Editor preferences and I think it defaults on not being enabled - not sure on this last part.

I did not know that, this is bad, it should be on by default. Otherwise nobody will know it's there.
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Crimson Wizard on Mon 06/05/2024 19:45:23
Ah, I rushed this release, and forgot to review all post-3.6.1 changes, like System.GetEngineString. They are also merged into AGS 4 now.
I must gather these and add to the changelog too.
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: eri0o on Mon 06/05/2024 21:01:59
The support for moving folders in the project explorer by click and drag and adding a script and header pair too should be there. I think the name of the room itself too being readable in the editor tab - instead of only Room1.
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Crimson Wizard on Mon 06/05/2024 22:51:36
Updated the list of changes, please check the last update post again:
https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-4-0-early-alpha-for-public-test/msg636662979/#msg636662979
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Baguettator on Fri 10/05/2024 20:53:34
Hi here !

I don't know if it has been already asked for a request, but is it doable in AGS to add the possibility to rotate/rescale dynamically (when game is launched) GUIs and/or GUIControls ? It would be so great... :)

But I don't know if it is too many work  or if it is doable for now...
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Crimson Wizard on Fri 10/05/2024 21:35:24
Quote from: Baguettator on Yesterday at 20:53:34I don't know if it has been already asked for a request, but is it doable in AGS to add the possibility to rotate/rescale dynamically (when game is launched) GUIs and/or GUIControls ? It would be so great... :)

In AGS 4 it is possible to rotate GUI and almost anything else (Objects, Characters, Camera...) using Rotation or GraphicRotation property (varies depending on type of object).
There's no command to scale gui, but it's not too difficult to add. In the current state of AGS 4 it's mostly a matter of inventing a good way to set this parameter.

I might try adding this in the next update.
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: eri0o on Fri 10/05/2024 23:14:35
I had made a issue for GUI Scaling here: https://github.com/adventuregamestudio/ags/issues/1656

I think it may be nice to have different width height for scaling - just thinking about when someone sets a different game resolution, instead of doing whatever is done today with the GUIs if the person clicks yes, it would just scale it - which feels less "destructive".
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Crimson Wizard on Fri 10/05/2024 23:27:05
Hm, I did not remember there's a suggestion ticket.

We have reserved transformation fields for "scalex", "scaley" in save format for almost all types of objects now, and iirc the discussed API was to have properties ScaleX, ScaleY; and something convenient to set uniform scaling, like a SetScale(x,y) function, where "y" arg is optional, and if not passed, then it is set equal to "x".

Both scaling and rotation are done using fast texture transformation (with renderers that support that), and will likewise be affected by the "Render sprites at screen resolution" setting.
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Baguettator on Sat 11/05/2024 05:09:16
Good news !!! Thanks a lot, I'm waiting this feature :)