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 - Alpha 21 for public test
Post by: Crimson Wizard on Thu 01/06/2023 14:00:59
AGS 4 - Alpha 21
Full release number: 4.0.0.17

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

This is a 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 Alpha installer (https://github.com/adventuregamestudio/ags/releases/download/v4.0.0.17/AGS-4.00.00.17-Alpha21.exe)
Download AGS 4.0 Alpha as a .zip archive (https://github.com/adventuregamestudio/ags/releases/download/v4.0.0.17/AGS-4.00.00.17-Alpha21.zip)

For Editor
Spoiler
VC 2015-2022 redistributable needed for AGS Editor on Windows (https://download.visualstudio.microsoft.com/download/pr/5319f718-2a84-4aff-86be-8dbdefd92ca1/DD1A8BE03398367745A87A5E35BEBDAB00FDAD080CF42AF0C3F20802D08C25D4/VC_redist.x86.exe)
Download Color Themes for the Editor (https://github.com/adventuregamestudio/ags-themes/archive/refs/heads/master.zip)
[close]

For Android
Spoiler
AGS Player, suitable for running any compatible AGS game (https://github.com/adventuregamestudio/ags/releases/download/v4.0.0.17/AGS-4.0.0.17-debug.apk)
NOTE: the Editor now includes Android build component letting you prepare your own games for Android
[close]

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.17/AGS-4.00.00.17-pdb.zip)
[close]


Last updated: 14th April 2025



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 (improvements)
- KeyserSoSay0 (improvements, fixes)



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

Watch Variables panel

This panel lets you see values of the script variables while you run the game from the Editor.
An example of how it looks like is on this screenshot:
https://i.imgur.com/D1L69LH.png

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.
* GUIs may be scaled using ScaleX and ScaleY properties (and SetScale function).

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 and 3.6.2 (including patches), except ones made for backwards compatibility.

Common:
 - Support true 32-bit colors in GUI, text messages and drawing commands in script.
   Color number properties now correspond to the encoded 32-bit ARGB (A8R8G8B8 format).
 - Fonts are split into Font Files and Fonts, where multiple Fonts may use same Font File, or not have any Font File assigned at all (for instance, if they are meant to act as placeholders and get replaced by fonts from plugin).
 - 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, but *running* games compiled by pre-4.0 versions is no longer guaranteed.
 - Removed support for 16-bit games. Any older 16-bit project will be converted to 32-bit on import by the Editor.
 - 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).
 - "Fonts" node in the Project Explorer now contains separate "Font Files" and "Fonts" sublists.
 - Actual font files on disk are now stored in "Fonts" subfolder in the project when imported, and keep their original names (no longer renamed to "agsfntN.*").
 - Translation sources are now saved in PO format.
 - Merged all Color and ColorNumber property pairs into a single Color property that acts as a RGBA selection for 32-bit games, and palette index for 8-bit games. In 32-bit game projects you can assign full RGBA color definition, where alpha is optional, and is assumed 255 if not specified. Color value 0 means "transparent" regardless of game's color depth.
   NOTE: color picker currently does not let define alpha, so only opaque colors may be selected using it; but you may still enter RGBA value by hand.
 - In General Settings added "Script Compiler" option that lets to choose between old and new script compilers for your game (see "Scripting" section below for the new compiler's details).
 - In General Settings added "GUI common controls handle only left mouse button" option.
 - Added Custom Properties for: Audio Clips, Dialogs, GUI, GUI Controls, Regions, Walkable Areas.
 - Added Enabled and Visible properties to Characters, Enabled property to Room Objects.
 - Added BlendMode property for Characters, GUI and Room Objects.
 - Added Transparency property for GUIControls.
 - Added Flip property for View Frame, replacing a boolean Flipped property. The new property supports all 3 flip variants: horizontal, vertical and both at once.
 - Added FaceDirectionRatio property to General Settings, Room and Walkable Areas.
 - Added readonly Length property to AudioClips, for the reference.
 - Added "Source FontFile" property to Fonts, this property lets assign a Font File to the Font.
 - Implemented "Watch Variables" panel which lets to watch values of the selected script variables while running the game. This feature is working only if game is built in Debug mode. The panel has an option to automatically enlist local variables (relative to current position in script).
 - Added "Add to Watch Panel" command to Script Editor's context menu.
 - Support dragging a text from the script window into the "Watch Variables" panel.
 - Added "Word Wrap" command to Edit menu for scripts.
 - General panel look enhancements.
 - Support built-in Base Color Themes that have the custom themes applied over them.
 - Support importing and keeping sprites as explicitly 8-bit images without converting to the game's default color depth. This lets to have chosen sprites used as 8-bit masks in a 16/32-bit game.
 - When importing room backgrounds of a different size Editor will now let user decide whether to reset, keep or rescale room masks.
 - Fixed faulty double-click on project items in case user dragged the cursor away.

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:
 - Managed structs may have constructors. Constructor is a member function which name is identical to the struct's name, and type is "void". Constructor will be called automatically when the managed object is created with "new" command.
 - 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).
 - Similarly you may omit struct's name when addressing a static member from within a struct's member function.
 - Support for dynamic pointer cast: use syntax "pointer as Type" to cast the pointer to either a parent or child type (upcast and downcast respectively).
 - 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.
 - Support regular (non-managed) struct and array variable initializers, where you can specify their element values either in the order of their declaration or as a "name1: value, name2: value" sequence. For arrays the latter would be "0: value, 1: value" and so forth.
   NOTE: this works only for global variables at the moment.
 - Functions now may call any other function from within same script, regardless of their order of declaration.
 - When calling a function you may specify parameter names like "name1: value, name2: value", and when doing so - pass arguments in any order.
 - 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.
 - Dialog Scripts dropped support for a number of obsolete commands: "run-script", "new-room", "set-speech-view", "set-globalint", "play-sound", "add-inv", "lose-inv". All of those have contemporary equivalents.

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.
 - All existing Color properties now assume full ARGB values (0xAARRGGBB) in 32-bit games. This means that you *must* specify alpha value when assigning a color number directly, otherwise the game will treat the color as fully transparent.
 - Added Joystick struct, meant to handle joystics and gamepads in script.
 - Added Touch and TouchPointer structs, meant to handle touch controls 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 Pathfinder struct, which lets to search walkable paths in certain two-dimensional "space", and returns them as an array of Points.
 - Added MaskPathfinder struct, which lets to initialize a Pathfinder using a 8-bit sprite serving as a navigation mask.
 - Added MotionPath struct, which lets to read existing game object's motion plan, or create your own and use it as a reference when moving a custom object.
 - Added Custom Properties interface to types: AudioClip, Dialog, GUI, GUIControl, Region, WalkableArea. This includes functions: GetProperty(), GetTextProperty(), SetProperty() and SetTextProperty().
 - Added BlendMode enum.
 - Added Character.BlendMode, GUI.BlendMode, GUIControl.BlendMode, Object.BlendMode, Overlay.BlendMode.
 - Added Character.Enabled and Visible properties, added Object.Enabled property, Character.on is deprecated.
 - Added Character.UseRegionTint and Object.UseRegionTint, deprecated Character.IgnoreLighting.
 - Added Camera.Rotation, Character.GraphicRotation, GUI.Rotation, Object.GraphicRotation, Overlay.Rotation.
 - Added Game.GetColorFromRGBA() function that creates a color number for red, green, blue and alpha combination.
 - Added Game.FaceDirectionRatio, Room.FaceDirectionRatio, WalkableArea.FaceDirectionRatio and Character.FaceDirectionRatio.
 - Added Character.MovePath() and WalkPath() functions which makes character to move along an arbitrary list of coordinates.
 - Added Object.MovePath() function, that work similar to Character's.
 - Added Character.MotionPath and Object.MotionPath properties that let to get active character's or object's movement plan.
 - Added ColorFormat enum, and optional "color_format" parameter to DynamicSprite's functions: Create(), CreateFromBackground(), CreateFromDrawingSurface(), CreateFromExistingSprite() and CreateFromFile().
 - Added DialogOptionsNumbering enum, to use when setting dialog options numbering mode.
 - Added multiple new properties to Dialog type: OptionsBulletGraphic, OptionsGap, OptionsGUI, OptionsGUIX, OptionsGUIY, OptionsHighlightColor, OptionsMaxGUIWidth, OptionsMinGUIWidth, OptionsNumbering, OptionsPaddingX, OptionsPaddingY, OptionsReadColor, OptionTextAlignment.
   Most of these are replacing previously existing old-style variables in "game" struct and OPT_* options. OptionsGUIX/Y and OptionTextAlignment are completely new features.
 - Added DrawingSurface.BlendImage() and DrawingSurface.BlendSurface() functions.
 - Added DrawingSurface.BlendMode property that lets define blend mode for primitive drawing operations (line, rectangle, triangle, etc).
 - Added DrawingSurface.ColorDepth readonly property.
 - Added DrawingSurface.SetPixel() function that lets to set a pixel value of specified color, disregarding any surface's drawing settings.
 - Added Game.RoomCount, RoomNumbers[] and RoomNames[] properties.
 - Added Game.SpriteColorDepth[] readonly indexed property.
 - Added GUI.ScaleX and ScaleY properties, GUI.SetScale() function.
 - Added GUI.GUIToScreenPoint() and GUI.ScreenToGUIPoint() functions.
 - Added Math.Random(), Math.RandomFloat() and Math.Round() functions.
 - Added eRoundTowardsZero and eRoundAwayFromZero rounding styles for use in FloatToInt() and Math.Round() functions.
 - Added Overlay.Flip property that lets to set one of the 3 standard flip styles.
 - Added Overlay.Tint(), SetLightLevel() and RemoveTint() functions, Overlay.HasTint, HasLightLevel, LightLevel, TintBlue, TintGreen, TintRed, TintSaturation, TintLuminance properties, matching Character and Object tinting functionality.
 - Added Room.Number and Name properties.
 - Added Room.PathFinder property that returns a Pathfinder object, searching paths over this room's walkable areas.
 - Added StringSplitOptions enum, String.Join(), String.Split() and String.Trim() functions.
 - Expanded String.IndexOf() with new parameters: "StringCompareStyle", "index" and "count".
 - ViewFrame.Flipped property now returns eFlipDirection instead of bool.
 - Added optional width, height and layer parameters to SaveScreenShot().
    SaveScreenShot() now supports location tokens in file path.
 - Added new game-wide option OPT_GUICONTROLMOUSEBUT that defines whether common GUI controls are affected by the right mouse button or not (InventoryWindows are excluded from this, because they have their own special handling for RMB).
 - Added "walkarea[]" and "walkbehind[]" global arrays.
 - Global generated game objects (Characters, GUIs, etc), and global arrays of these objects (character[], object[], gui[], etc) are now declared as object *pointers* and arrays of pointers respectively. From the user's perspective this is a mere formality, as working with these variables and arrays will be syntactically same, but this makes it easier for the engine to handle them 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.
 - Support touch input directly, without touch-to-mouse emulation.
 - All color settings in a 32-bit game now respect alpha value, meaning they may be half-transparent. This refers to almost anything that may have a color: texts, GUI backgrounds, DrawingSurface's DrawingColor, and so forth. The exceptions are things that only make sense with opaque color: Tint settings, and screen Fade effects.
 - 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.
 - Allow to run the game even if it has no fonts (log a warning).
 - Allow to continue running the game if any font failed to load on startup. Such font will simply not get drawn, unless replaced by a plugin, for example.
 - Standard Dialog options now support Right-to-left text mode.
 - 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).
 - All the area-related GetAtScreenXY functions (for Hotspot, Region, Walkbehind and WalkableArea) now return a null pointer if no room viewport is found under given coordinates.
 - GetTextHeight() no longer reduces "width" parameter by -1. This was an ancient mistake in the engine kept for many years for backwards compatibility.
 - Both blocking and non-blocking videos are buffered and played on a separate thread.
 - Added FLAC support for music, speech and sound effects.
 - 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.)
 - Fixed SDL log level defaulting to "verbose" instead of "info".
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 Fri 10/05/2024 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 :)
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Crimson Wizard on Sat 11/05/2024 19:00:13
Made a draft PR: https://github.com/adventuregamestudio/ags/pull/2426
Test build may be downloaded here and played with:
https://cirrus-ci.com/task/5935527583547392

Added GUI.ScaleX, GUI.ScaleY and GUI.SetScale(x,y).

The transformation mechanism is already in place, so this was a matter of inventing commands and "wiring" script to internal parameters.

Allows both positive and negative scaling; negative scaling leads to a mirrored image.
Scaling "0" is forbidden, passing "0" to any scale value will reset it to 1.0. If this seems inconvenient, I may allow it, but some fixes will have to be made around the code... Of course scale 0 means that object is not drawn.

When scaled, GUI's image shifts relative to its origin, which is top-left corner. If you want to scale "centered", you must adjust X,Y position along in script. This is perfectly consistent with other types of objects, each type has its own "origin".

Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Baguettator on Sat 11/05/2024 19:52:31
Nice, I will have a look at it !

How coordinates work while scaling ? If a button is at coordinates (10, 50) in its GUI which has width=200 and height =200, and you scale the GUI at (100, 100), what will be the new coordinates of that button ? Screen-related ? GUI-related ?
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Crimson Wizard on Sat 11/05/2024 19:55:47
Quote from: Baguettator on Sat 11/05/2024 19:52:31How coordinates work while scaling ? If a button is at coordinates (10, 50) in its GUI which has width=200 and height =200, and you scale the GUI at (100, 100), what will be the new coordinates of that button ? Screen-related ? GUI-related ?

Control's coordinate properties (Button.X,Y) are unchanged, and related to non-transformed GUI.

Real position on screen changes along with GUI scaling and rotation.
Because GUI's origin is at 0,0, the real controls positions may be calculated by multiplying every control's coordinate by the scale value.
(Rotation is more complicated)

EDIT: we have Screen.RoomToScreenPoint/ScreenToRoomPoint functions because Cameras may be scaled and rotated.
I suppose we might need something similar for GUIs, in case user wants to find out real control's location in script.

EDIT2: I found a curious bug, apparently InventoryWindow does not respect transformation when being interacted with.
It is drawn correctly, but detected item positions are wrong.
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Crimson Wizard on Sun 12/05/2024 15:41:48
An updated variant:
PR: https://github.com/adventuregamestudio/ags/pull/2426
Download:
https://cirrus-ci.com/task/6618591464783872
https://cirrus-ci.com/task/5727916917522432

Adds properties and functions:
* GUI.ScaleX,
* GUI.ScaleY,
* GUI.SetScale(x,y),
* GUI.GUIToScreenPoint(int guix, int guiy, bool clipToGUI),
* GUI.ScreenToGUIPoint(int screenx, int screeny, bool clipToGUI)

Fixed InventoryWindow interaction in case of scaled/rotated GUI.

UPDATE 2: fixed to allow scaling value 0, which is useful in case of tweening between positive and negative scale.
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Baguettator on Tue 21/05/2024 06:47:46
Hi there !

In AGS 3.6.1.24, it seems that \n symbols are not properly drawn with the DrawString function. It displays a square with a cross inside, and it doesn't do a linebreak.

Is it intended ?

(I put it here in case it's a bug, it could be also for AGS 4.0)
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: eri0o on Tue 21/05/2024 12:39:21
I think only DrawStringWrapped support line breaks.
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Baguettator on Sun 26/05/2024 13:24:58
OK, so it's probably intended. Understood :)

Another question : it's said that AGS 4.0 will rework the translation system. Could somebody explain how it will work then ? How we can manage translations for both creators and translators ? In and out of the editor ? A program to help translators ? (better HUD that only a .txt file with 1 line for native language and 1 line for translation)
Title: Re: AGS 4.0 - Early Alpha 10 for public test
Post by: Alan v.Drake on Sun 26/05/2024 14:17:03
Quote from: Baguettator on Sun 26/05/2024 13:24:58Another question : it's said that AGS 4.0 will rework the translation system. Could somebody explain how it will work then ? How we can manage translations for both creators and translators ? In and out of the editor ? A program to help translators ? (better HUD that only a .txt file with 1 line for native language and 1 line for translation)

I already implemented the PO format which is an industry standard (you can manage it from Poedit and other major translation platforms).
What's missing is adding the secondary metadata features like source line references/context/comments, then possibly implementing native .mo compiled translations.


- Alan
Title: Re: AGS 4.0 - Early Alpha 11 for public test
Post by: Crimson Wizard on Wed 19/06/2024 23:07:07
Updated to Alpha 11
(Please use download links in the first post)

This update comes with several important new features (see below).

Contains updates and fixes from 3.6.1 Patch 3 (except ones related to backwards compatibility).

Other changes:

Editor:
- Added "Watch Variables" panel which lets to watch values of the selected script variables while running the game. This feature is working only if game is built in Debug mode.
- Support importing 1-bit (monochrome) and 4-bit images as sprites, room backgrounds and masks (converted to 8-bit).
- Ensure that Editor exports room backgrounds in their actual color depth.
- Improved scrolling of drop-down lists in the Room's navigation bar: made scroll buttons larger, and support mouse wheel.
- Fixed breakpoints not working in room scripts.

Script API:
- Added Pathfinder struct, which lets to search walkable paths in certain two-dimensional "space", and returns them as an array of Points.
- Added Room.PathFinder property that returns a Pathfinder object, searching paths over this room's walkable areas.
- Added Character.MovePath() and WalkPath(), which makes character to move along an arbitrary list of coordinates, and Character.GetPath() that returns current character's walking path.
- Added Object.MovePath() and Object.GetPath() functions, that work similar to Character's.
- Added GUI.ScaleX and ScaleY properties, GUI.SetScale() function.
- Added GUI.GUIToScreenPoint() and GUI.ScreenToGUIPoint() functions.
- Added Speech.SpeakingCharacter that returns currently speaking character (for blocking speech).

Engine:
- Ensure that Character.Speaking returns true even if character has no speech view.
- DynamicSprite.CreateFromFile() may now load 1-bit and 4-bit bitmaps, converting to 8-bit.
- Fixed VideoPlayer's looping mode not working.

Engine Plugin API:
- Added IAGSEngine.Log(), which lets plugins to print using engine's log system.



"Watch Variables" panel is a long waited method for reading the values of the script variables when running the game from Editor. It may be toggled in the Windows menu. Users may add variable names to it, and whenever game hits a breakpoint these variable values will be retrieved and updated.
NOTE: this only works if the game is compiled in Debug mode.

An example of how it looks like on this screenshot:
https://i.imgur.com/D1L69LH.png



Pathfinding API lets you to find paths using internal AGS pathfinder, and use them for your purposes.
OTOH it also lets you pass your own custom path to Character or Room Object, and make them move along one.
Paths are represented as a dynamic array of Points.

Under spoiler is a script example, which draws found path on screen overlay:
Spoiler
Code (ags) Select
DynamicSprite *pathspr;
DynamicSprite *mask_copy;
Overlay *pathover;
Point* last_path[];

function on_mouse_click(MouseButton button)
{
if (pathover == null)
{
pathspr = DynamicSprite.Create(Room.Width, Room.Height);
pathover = Overlay.CreateRoomGraphical(0, 0, pathspr.Graphic);
}

if (mask_copy == null)
{
mask_copy = DynamicSprite.Create(Room.Width, Room.Height);
}

DrawingSurface *mask_copy_ds = mask_copy.GetDrawingSurface();
DrawingSurface *mask = WalkableArea.GetDrawingSurface();
mask_copy_ds.Clear(30);
mask_copy_ds.DrawSurface(mask, 0, 0, 0, mask_copy_ds.Width, mask_copy_ds.Height);
mask.Release();
mask_copy_ds.Release();
 
Point *goal = Screen.ScreenToRoomPoint(mouse.x, mouse.y);
Pathfinder *finder = Room.PathFinder;
   
player.Solid = false;
Point *path[] = finder.FindPath(player.x, player.y, goal.x, goal.y);
Point *trace = finder.Trace(player.x, player.y, goal.x, goal.y);
player.Solid = true;

DrawingSurface *ds = pathspr.GetDrawingSurface();
ds.Clear(COLOR_TRANSPARENT);
ds.DrawImage(0, 0, mask_copy.Graphic, 50);

if (path != null)
{
for (int i = 0; i < path.Length; i++)
{
if (i > 0)
{
ds.DrawingColor = 1;
ds.DrawLine(path[i - 1].x, path[i - 1].y, path[i].x, path[i].y);
}
ds.DrawingColor = 4;
ds.DrawRectangle(path[i].x - 1, path[i].y - 1, path[i].x + 1, path[i].y + 1);
}
}

if (trace != null)
{
ds.DrawingColor = 12;
ds.DrawLine(player.x, player.y, trace.x, trace.y);
}

ds.Release();

last_path = path;
}
[close]


The new MovePath and WalkPath functions have additional eRepeatStyle and eDirection parameters, which let you create a repeating walking paths for characters or objects.
Here's a trivial example of a character patrolling between 2 points:

Code (ags) Select
Point* path[] = new Point[3];
path[0] = new Point; path[0].x = 100; path[0].y = 100;
path[1] = new Point; path[1].x = 200; path[1].y = 100;
path[2] = path[0]; // make it circular

cGuard.WalkPath(path, eNoBlock, eRepeat);
Title: Re: AGS 4.0 - Early Alpha 11 for public test
Post by: Crimson Wizard on Fri 21/06/2024 01:44:03
I had to fix one bad error in the latest update, and reuploaded the version. Please download again (same links).
Title: Re: AGS 4.0 - Early Alpha 11 for public test
Post by: Crimson Wizard on Fri 21/06/2024 22:07:42
In regards to the "Watch Variables", make sure that you do full game rebuild before using it, currently there are possible errors if some scripts were not recompiled in the new version.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Crimson Wizard on Mon 22/07/2024 23:49:00
Updated to Alpha 12
(Please use download links in the first post)

Contains updates and fixes from 3.6.1 Patch 4 (except ones related to backwards compatibility).

Other changes:

Editor:
- Improved scrolling of drop-down lists in the Room's navigation bar: made scroll buttons larger, and support mouse wheel.
- Do not delete previously built game exe from Compiled/Windows folder when testing a game from the editor.
- Added "Open Recent" submenu in the File menu.
- Sync script editor's commands in Edit menu with the context menu.
- Added "Toggle Line Comment" command to Edit menu for scripts.
- Added "Word Wrap" command to Edit menu for scripts.
- Support to import and keep sprites as explicitly 8-bit images without converting to the game's default color depth. This lets to have chosen sprites used as 8-bit masks in a 16/32-bit game.
- Added TurnWhenFacing property to Characters.
- Fixed Character.Enabled and Visible properties not written correctly when the game is built.
- Fixed an unhandled exception occuring when rebuilding rooms if any script's header is missing.

Script API:
- Added MaskPathfinder struct, which lets to initialize a Pathfinder using a 8-bit sprite serving as a navigation mask.
- Added Character.TurnWhenFacing property.
- Added ColorFormat enum, and optional "color_format" parameter to DynamicSprite's functions: Create(), CreateFromBackground(), CreateFromDrawingSurface(), CreateFromExistingSprite() and CreateFromFile().
- Added readonly DrawingSurface.ColorDepth property.
- Added readonly Game.SpriteColorDepth[] indexed property.
- Added StringSplitOptions enum, and "options" parameter to String.Split().
- Expanded `on_mouse_click` callback, now supports two more parameters: click x,y coordinates.
- Global generated game objects (Characters, GUIs, etc) are now declared as object *pointers* in script (this complements recent similar change done to arrays of game objects).
- All the area-related GetAtScreenXY functions (for Hotspot, Region, Walkbehind and WalkableArea) now return a null pointer if no room viewport is found under given coordinates.

Engine:
- GetTextHeight() no longer reduces "width" parameter by -1. This was an ancient mistake in the engine kept for many years for backwards compatibility.
- Fixed a crash occuring when debugger requested a variable's value, but script contains no "table of contents".
- Fixed Character.MovePath and WalkPath not reacting to the "path" parameter being a null pointer, and proceeding with mistakes.
- Fixed a crash in SaveScreenShot (repeating regression in AGS 4).
- Fixed WalkableArea.GetAtScreenXY and GetAtRoomXY returning "garbage" values instead of a valid WalkableArea pointer.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Snarky on Tue 23/07/2024 00:01:22
Quote from: Crimson Wizard on Mon 22/07/2024 23:49:00- GetTextHeight() no longer reduces "width" parameter by -1. This was an ancient mistake in the engine kept for many years for backwards compatibility.

Do you mean GetTextWidth()?
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Crimson Wizard on Tue 23/07/2024 00:24:22
Quote from: Snarky on Tue 23/07/2024 00:01:22Do you mean GetTextWidth()?

No, GetTextHeight had a mistake that used "width - 1" instead of "width" when splitting text up into multiple lines.
GetTextWidth worked properly.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: eri0o on Tue 23/07/2024 02:20:36
Uhm, there are a few other small additions in ags4 that aren't listed because they were added with intention of being in the at some point upcoming 3.6.2 but they are also in ags4 simply because ags4 gets all improvements.  8-) 
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Crimson Wizard on Tue 23/07/2024 02:52:45
Quote from: eri0o on Tue 23/07/2024 02:20:36Uhm, there are a few other small additions in ags4 that aren't listed because they were added with intention of being in the at some point upcoming 3.6.2 but they are also in ags4 simply because ags4 gets all improvements.  8-) 

My intent was to list these too, it looks like I forgot to add them to the update's list this time. But they are added to the full list in the first post.

EDIT: added changes from 3.6.2 dev branch.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Mehrdad on Wed 24/07/2024 18:53:01
Just for information. I have now tested the Android port from AGS4 and got the output. Everything works great ;-D

Thanks @eri0o   @Crimson Wizard


Edit :  If you add MAC and iOS ports to the editor I can test them.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Crimson Wizard on Mon 29/07/2024 14:18:37
Quote from: Mehrdad on Wed 24/07/2024 18:53:01Edit :  If you add MAC and iOS ports to the editor I can test them.

Building for iOS and Mac is not integrated in the Editor, and likely won't be for a while. But engine ports are available, just like in AGS 3.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Mehrdad on Tue 30/07/2024 09:21:29
Quote from: Crimson Wizard on Mon 29/07/2024 14:18:37Building for iOS and Mac is not integrated in the Editor, and likely won't be for a while. But engine ports are available, just like in AGS 3.

I'm not a good programmer and I can't get output other than the editor. So I am waiting for you to add these two ports to AGS4.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: lapsking on Thu 01/08/2024 10:35:24
Hi,

 I don't know what exactly I'm talking about, but I was wondering if it's possible to have some commands to force the script into Block or NoBlock modes. I've seen others asking on the forums too, before. But you always have to work it around (which is not always easy or even possible). They also mentioned a NoBlock module which I couldn't find so I'm not sure how it works and someone mentioned it's outdated anyway. Does it make sense to integrate this into engine instead of having it as a module?

 The reason I'm asking this is because khris wrote a module which I'm using but then it stops running when the game is blocked, and you have to wait till it's unblocked which takes time. I've seen others have been asking about it too, so I gather it doesn't exist on AGS 3.6.1.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Alan v.Drake on Thu 01/08/2024 10:43:00
Quote from: lapsking on Thu 01/08/2024 10:35:24Hi,

 I don't know what exactly I'm talking about, but I was wondering if it's possible to have some commands to force the script into Block or NoBlock modes. [...]

Check this page on the manual: https://adventuregamestudio.github.io/ags-manual/RepExec.html (https://adventuregamestudio.github.io/ags-manual/RepExec.html)

You can use the "_always" variants for things that should always be executed.


- Alan
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: lapsking on Thu 01/08/2024 11:05:07
@Alan v.Drake

Thanks for the fast reply. I've tried that. The problem is the code is:

event == eEventEnterRoomBeforeFadein
It says: undefined symbol event under repeatedly_execute_always()

So the script starts the module when the player enters the room but it keeps running as long as the player is in the room and changes the music. But if the music wants to change in the middle of a block which is a long one, stops running and doesn't change the music till it's unblocked.

Maybe I should ask in the forum how to work it around. But I thought if this happens for few others too, might be a good idea to mention it.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Alan v.Drake on Thu 01/08/2024 11:09:20
That is a question for "Beginners' Technical Questions".
Here you should report and discuss issues about the engine/editor. Also try to search manual and forum for examples.


- Alan

Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: lapsking on Thu 01/08/2024 11:26:17
@Alan v.Drake

It was just a general stupid suggestion. Wasn't looking for an specific solution for my game. Another thing is the possibility to add more hotspots, for example a library with 100 books. I've already worked it around by adding books as objects one by one, but it wasn't easy. Anyway thanks, better go back to my business.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Crimson Wizard on Thu 01/08/2024 12:24:27
Quote from: lapsking on Thu 01/08/2024 11:26:17Another thing is the possibility to add more hotspots, for example a library with 100 books. I've already worked it around by adding books as objects one by one, but it wasn't easy.

Hotspots amount may in theory be increased up to 255 (that's the maximum that the room masks allow).

But having 100 separate hotspots for individual books on the shelves is almost similarly suboptimal as having 100 objects for that.
It may be easier to have a single hotspot for a shelf and script a mathematical formula that gives you a book's index based on a coordinate.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: lapsking on Thu 01/08/2024 12:47:48
@Crimson Wizard
[/quote]
It may be easier to have a single hotspot for a shelf and script a mathematical formula that gives you a book's index based on a coordinate.
[/quote]

Thanks for your reply Crimson. The problem is I'm terrible at mathematics, unlike you guys. I'm more of a visual person and I prefer to draw hotspots by hand. That's the main reason I was attracted to AGS engine in first place, because of it's friendly interface.

By the way, I realized where I should put _always in the script! My problem is solved thanks to Alan, though that was not my intention.

Best
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: Crimson Wizard on Thu 01/08/2024 13:30:25
Quote from: lapsking on Thu 01/08/2024 12:47:48Thanks for your reply Crimson. The problem is I'm terrible at mathematics, unlike you guys. I'm more of a visual person and I prefer to draw hotspots by hand. That's the main reason I was attracted to AGS engine in first place, because of it's friendly interface.

Well, this may be done with a "visual" method too, if you create a custom mask from a sprite. This allows to have as many "things" as there are unique colors.

But this is a topic for technical help forums.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: eri0o on Thu 01/08/2024 13:38:14
Just a minor trick I use for hotspot as objects , I create a few squares and rectangles in more or less standard sizes, as rectangles that I draw in black with the opacity at 1% in the drawing program, so they are practically invisible in AGS or I draw them in any color and then script them to have 99 in transparency, and then position the objects where I want in the room Editor. This allows the full rectangle to be picked even in pixel perfect mode.

I do this because when there is an object in the background that should be clickable to avoid readjusting hotspots manually later. I noticed through trial and error that on touch screen, specially in an average smartphone, a game with 320x180 resolution, needs at minimum 20x20 square or something like a 22x18 or 18x22 to be able to be reasonably clicked with the finger - for direct touch but also it allows a less precise mouse usage on indirect mode too that feels more comfortable. Using this trick of object as hotspot I can easily mass adjust the size of "background object hotspots" in my games.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: lapsking on Thu 01/08/2024 13:55:08
@eri0o
Quote from: eri0o on Thu 01/08/2024 13:38:14Just a minor trick I use for hotspot as objects , I create a few squares and rectangles in more or less standard sizes, as rectangles that I draw in black with the opacity at 1% in the drawing program, so they are practically invisible in AGS or I draw them in any color and then script them to have 99 in transparency, and then position the objects where I want in the room Editor. This allows the full rectangle to be picked even in pixel perfect mode.

I do this because when there is an object in the background that should be clickable to avoid readjusting hotspots manually later. I noticed through trial and error that on touch screen, specially in an average smartphone, a game with 320x180 resolution, needs at minimum 20x20 square or something like a 22x18 or 18x22 to be able to be reasonably clicked with the finger - for direct touch but also it allows a less precise mouse usage on indirect mode too that feels more comfortable. Using this trick of object as hotspot I can easily mass adjust the size of "background object hotspots" in my games.

I think I might be trashing the engine forum, so feel free to delete all these posts. But just wanted to say the books were part of the background and they were not in square or rectangular shapes, but books in different sizes in perspective some parts covered by other books. So they had random shapes. So what I had to do was to make a PNG of each of these random shapes one by one and add them as objects and put each exactly on the same spot on background. If I could directly draw the shapes on the background in engine it would be much easier. But maybe there are better ways to do this, which I need to learn.
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: boycalledjames on Wed 14/08/2024 09:47:46
Hi, I've upgraded from 4.00.00.06 to the latest 4.00.00.07 build. However when I attempt to open the AGSEditor.exe I am greeted with the following error message:

Quote---------------------------
Error
---------------------------
An unexpected error occurred trying to start up the AGS Editor. Please consult the details below and post the error to the AGS Technical Forum.

System.ArgumentNullException: Value cannot be null.

Parameter name: path1

  at System.IO.Path.Combine(String path1, String path2)

  at AGS.Editor.Components.FileCommandsComponent.GetRecentGamesSubcommands()

  at AGS.Editor.Components.FileCommandsComponent.GetOpenRecentMenuCommand()

  at AGS.Editor.Components.FileCommandsComponent..ctor(GUIController guiController, AGSEditor agsEditor)

  at AGS.Editor.ApplicationController.CreateComponents()

  at AGS.Editor.ApplicationController..ctor()

  at AGS.Editor.Program.startupTimer_Tick(Object sender, EventArgs e)

  at System.Windows.Forms.Timer.OnTick(EventArgs e)

  at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)

  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
---------------------------
OK 
---------------------------

I have tried both the installer and the .zip file just to be sure, but both return the same results. Any help would be greatly appreciated! Many thanks
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: eri0o on Wed 14/08/2024 11:59:31
Hi @boycalledjames !

Can I ask you to send me through private message the file in your following location:

C:\Users\YOURUSERNAME\AppData\Local\AGS\AGSEditor.exe_StrongName_mqpdv5kqypl2dezfmjnjxse4zvfvse2h\4.0.0.7
I don't remember right now if the random characters after the AGSEditor.exe are the same for everyone... But I would like to look into your user.config file because it will help me pick up the exact issue.

Now for it having the error, the problem is I messed up my code and didn't account for this possibility.

The cause is (I think!) that in this file, which is a xml, there is a recent game that is listed with an empty path.

Code (xml) Select
...
<setting name="RecentGames" serializeAs="Xml">
    <value>
        <ArrayOfRecentGame xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <RecentGame>
                <Name>TestSpriteDepth</Name>
                <Path></Path> 
                <!-- this path above should not be empty! -->
            </RecentGame>
            <RecentGame>
                <Name>TestPathFinder</Name>
                <Path>C:\Users\USERNAME\Documents\AGSProjects\TestPathFinder</Path>
            </RecentGame>
            <RecentGame>
                <Name>Ags4VideoHD</Name>
                <Path>C:\Users\USERNAME\Documents\AGSProjects\Ags4VideoHD</Path>
            </RecentGame>
        </ArrayOfRecentGame>
    </value>
</setting>
...

Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: boycalledjames on Wed 14/08/2024 13:09:12
Thanks @eri0o ! That was it! ;)

So just for the sake of clarity/reporting; my user.config file had a game listed without a path as suspected. The specific text within the config file that was causing the error read;

<RecentGame>
<Name>Game1</Name>
</RecentGame>

Whereas all other projects had the "<Path></Path>", this one did not. Once I removed the above text from the config, the AGSEditor.exe worked as expected.

Many thanks!
Title: Re: AGS 4.0 - Alpha 12 for public test
Post by: eri0o on Wed 14/08/2024 14:15:50
Well, nothing like real usage to find bugs, thanks @boycalledjames , turns out I didn't test for the case where (for whatever reason) the Path tag disappears. I put a PR for a fix for it that should be in future versions. I am curious how it happened in the first place so I will still play a bit with project upgrade here to see if I can figure it out.

Anyway, happy you managed to find and fix in the file as a workaround. :)
Title: Re: AGS 4.0 - Alpha 13 for public test
Post by: Crimson Wizard on Tue 17/09/2024 22:12:03
Updated to Alpha 13
(Please use download links in the first post)

This is suddenly an update with multiple new functionalities. Some of those are going to be exclusive to AGS 4, while few may be a part of the next minor 3.6.* update later.

Contains fixes from 3.6.1 Patches 5 and 6 (except ones related to backwards compatibility).

Other changes:

Common:
- Support true 32-bit colors in GUI, text messages and drawing commands in script. Color number properties now correspond to the encoded 32-bit RGB (R8G8B8 format). Older projects will have all Color properties upgraded by the Editor (but not colors in script!).
- Removed support for 16-bit games. Any older 16-bit project will be converted to 32-bit on import by the Editor.
SPECIAL NOTE: 8-bit games are still supported.

Editor:
- Editor will now remember certain window states: "Sprite selector" window and splitter position, splitter position in "Sprite manager".
- Copy, paste and delete commands now apply to all the selected GUI controls in GUI editor.
- Support editing group properties for selected GUI controls.
- When importing room backgrounds of a different size Editor will now let user decide whether to reset, keep or rescale room masks.
- Ensure that Editor exports room backgrounds in their actual color depth.
- Removed obsolete "Copy walkable area mask to regions" command from the Room editor.
- Merged all "***Color" and "***ColorNumber" paired properties into a single "***Color" property. This property is internally saved as a number, but is viewed and edited as RGB combination for 32-bit games, and as a palette index for 8-bit games.
- Added Custom Properties for: Audio Clips, Dialogs, GUI, GUI Controls, Regions, Walkable Areas.
- Textual GUI controls can now select "Null Font" as their font: this will prevent any text to be drawn even if one is assigned, and make it have zero size (when it matters).
- Added "/maketemplate" command-line option that tells Editor to run, make template out of the said game, and quit.
- Fixed "Flood Fill" operation on mask in the room editor for masks of sizes which are not multiples of 4.
- Fixed "Recent games" menu could throw a error if a saved Editor's config contained empty paths for any reason.
- Fixed "Make template" operation was not adding Rooms subfolder to a template.

Compiler:
- Compiler no longer requires explicit pointer declaration for imported global variables of managed types. Now they are always assumed to be pointers by default, and non-pointer imports of builtin managed types are not permitted, unless a backwards compatibility option is set.
- Fixed compiler could cause memory corruption while compiling certain expressions.
- Fixed parsing of bracketed expressions inside ternary operation ( ? : ).
- Fixed a error message reported in case of undefined symbol, now it correctly states that the symbol is undefined, instead of making a vague statement of "unexpected expression".

Script API:
- All ***Color properties and function arguments now require a 32-bit RGB number. Where Game.GetColorFromRGB() is used to create a color number, there the script should continue to work as before, but if a literal number was used in script, these must be updated by hand or wrong colors will be displayed at runtime.
- Added eNullFont constant that lets assign or pass a "null font" to any property or function parameter which expects a font's ID. This "null font" will simply make any text not drawn and have no actual measurements (size, spacing, etc).
- Added global events: eEventDialogStart, eEventDialogStop, eEventDialogRun, eEventDialogOptionsOpen, eEventDialogOptionsClose (these are handled in "on_event").
- Added Custom Properties interface to types: AudioClip, Dialog, GUI, GUIControl, Region, WalkableArea. This includes functions: GetProperty(), GetTextProperty(), SetProperty() and SetTextProperty().
- Added static Dialog.CurrentDialog property and non-static ExecutedOption and AreOptionsDisplayed properties.
- Added RenderLayer enum, and optional "layers" parameter to DynamicSprite.CreateFromScreenShot(), that tells which of the game's render layers to capture when making a screenshot.
- Added Overlay.SetPosition() and SetSize() functions for convenience.
- Added Overlay.Tint(), SetLightLevel() and RemoveTint() functions, Overlay.HasTint, HasLightLevel, LightLevel, TintBlue, TintGreen, TintRed, TintSaturation, TintLuminance properties, matching Character and Object tinting functionality.
- Expanded String.IndexOf() with new parameters: "StringCompareStyle", "index" and "count".
- Added optional "sprite" parameter to SaveGameSlot(), that lets to pass a number of an arbitrary sprite to write into this save instead of a standard "screenshot".
- Added new game-wide option OPT_SAVEGAMESCREENSHOTLAYER that lets to define which of the game's render layers will be captured when making a standard screenshot for the save game.

Engine:
- Do not alter or clamp palette for 8-bit sprites loaded into a 16/32-bit game at runtime.
- Assigning InventoryItem.Graphic will no longer reassign CursorGraphic too even if they were identical previously.
- Added new accessibility config settings in "access" section: "speechskip" and "textskip". These let player to override game's skipping style for character speech and text messages respectively.
- Fix transformed (scaled or rotated) overlays could look wrong in Software renderer.

WinSetup:
- Redesigned winsetup into a tabbed dialog.
- Added "Accessibility" settings for skipping speech and text messages.
Title: Re: AGS 4.0 - Alpha 13 for public test
Post by: ThreeOhFour on Thu 19/09/2024 06:03:06
May I quietly add my enthusiastic praise for adding support for different blending modes in game. One of my most wanted features, I am delighted that 4.0 will support this.
Title: Re: AGS 4.0 - Alpha 13 for public test
Post by: Pax Animo on Tue 24/09/2024 18:29:01
Heya,

Copying and pasting of labels on a GUI seems to be not working correctly, not sure what else this extends too but will update if any other problems.
Title: Re: AGS 4.0 - Alpha 13 for public test
Post by: Crimson Wizard on Wed 25/09/2024 00:53:33
Quote from: Pax Animo on Tue 24/09/2024 18:29:01Copying and pasting of labels on a GUI seems to be not working correctly, not sure what else this extends too but will update if any other problems.

Yes, copy/pasting gui controls appears broken in ags4 (it works in all other versions).
Title: Re: AGS 4.0 - Alpha 13 for public test
Post by: Crimson Wizard on Wed 25/09/2024 06:06:17
Here's a version with gui copy/paste fixed:
https://cirrus-ci.com/task/5132310821994496
Title: Re: AGS 4.0 - Alpha 13 for public test
Post by: Pax Animo on Sat 28/09/2024 18:44:30
Heya, adding a new text line via *[* in strings no longer seems to work.
Title: Re: AGS 4.0 - Alpha 13 for public test
Post by: Crimson Wizard on Sat 28/09/2024 18:54:45
Quote from: Pax Animo on Sat 28/09/2024 18:44:30Heya, adding a new text line via *[* in strings no longer seems to work.

We no longer support "[" for newlines, now you should be using standard escaped sequence "\n" for this.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: Crimson Wizard on Wed 23/10/2024 12:46:17
Updated to Alpha 14
(Please use download links in the first post)

Contains all the new features from 3.6.2 Betas 1 and 2 (https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-3-6-2-beta-1-a-wip-3-6-update/).

Other changes:

Common:
- Fonts are split into Font Files and Fonts, where multiple Fonts may use same Font File, or not have any Font File assigned at all (for instance, if they are meant to act as placeholders and get replaced by fonts from plugin).

Editor:
- "Fonts" node in the Project Explorer now contains separate "Font Files" and "Fonts" sublists.
- Actual font files on disk are now stored in "Fonts" subfolder in the project when imported, and keep their original names (no longer renamed to "agsfntN.*").
- In General Settings replaced "Use Extended Compiler" option with "Script Compiler" option that acts as a dropdown list, with compiler names to choose from.
- Added "Source FontFile" property to Fonts, this property lets assign a Font File to the Font.
- Fixed GUI controls failing to copy/paste via Clipboard (regression in previous Alpha versions).

Engine:
- Allow to run the game even if it has no fonts (log a warning).
- Allow to continue running the game if any font failed to load on startup. Such font will simply not get drawn, unless replaced by a plugin, for example.



Fonts...

Inside the project Fonts are now split into Fonts and Font Files. They may be added and deleted separately from each other.
Font Files retain their actual names when imported, they are no longer renamed into "agsfntN" (unless you rename these files yourself, or upgrade older project where they've been called like that).

(https://i.imgur.com/2ixB14E.png)
(https://i.imgur.com/zIOWyJl.png)

When you open a Font's properties, you may select one of the imported Font Files as this font's "Source FontFile". Multiple Fonts may select same FontFile as their source, and at the same time use different properties (size, outline, linespacing and so forth).

(https://i.imgur.com/Uhaggtf.png)

For extra convenience, Fonts that use same FontFile are referenced under the FontFile as well:

(https://i.imgur.com/Mv3aYUD.png)



EDIT: I just realized that these screenshots were made before we added new icons for FontFiles... so things look a bit better in the Editor now.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: ThreeOhFour on Wed 23/10/2024 16:48:47
Great stuff!

Reading through some of the changes to recent versions of the editor, I notice a lot of room editing shortcuts have been added that makes it work much like image editors. Things like space + click & drag to pan, ctrl + mousewheel to zoom in and out based on cursor position. I love this! Another shortcut I use all the time in image editing programs is alt + click to colour select with the eyedropper tool. Seeing as alt + click doesn't seem to be used for anything else in here, might I add that as a feature request? It would make picking between hotspots, regions and such very quick and familiar to people used to Photoshop, Aseprite, Clip Studio Paint, etc.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: Crimson Wizard on Fri 01/11/2024 12:34:19
There's unfortunately an annoying bug found in the latest Alpha 14 release, following an addition of "Script Module" selection for events in AGS 4.

Room scripts are stored in a different place in AGS 4, but the script module setting was not adjusted for AGS 4 situation in this feature, so ScriptModule for rooms points to a non existing file.

As a result, when you hit "..." button wanting to add a new event function, the function's name is filled into the property field, but the script is not opened and new function is not added there.

The workaround is to add such function in script by hand.

I'm currently investigating this to make a fix, and will have to release a new update soon.

EDIT: here's a temporary build with just this fix:
https://cirrus-ci.com/task/5366978280423424



Quote from: ThreeOhFour on Wed 23/10/2024 16:48:47nother shortcut I use all the time in image editing programs is alt + click to colour select with the eyedropper tool. Seeing as alt + click doesn't seem to be used for anything else in here, might I add that as a feature request? It would make picking between hotspots, regions and such very quick and familiar to people used to Photoshop, Aseprite, Clip Studio Paint, etc.

So, - make "Alt + LMB" to trigger a area selection when in corresponding mode. I suppose this may be done.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: ThreeOhFour on Sat 02/11/2024 05:32:26
Quote from: Crimson Wizard on Fri 01/11/2024 12:34:19So, - make "Alt + LMB" to trigger a area selection when in corresponding mode. I suppose this may be done.

Yep, if you hold down Alt while in most image editing programs the cursor will change to the eyedropper tool while the Alt key is held down, then change back to your previously selected drawing tool when you release it. This is fairly universal - from memory GIMP uses Ctrl by default instead, but everything else I know uses Alt.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: Crimson Wizard on Sat 02/11/2024 09:40:20
Quote from: ThreeOhFour on Sat 02/11/2024 05:32:26Yep, if you hold down Alt while in most image editing programs the cursor will change to the eyedropper tool while the Alt key is held down, then change back to your previously selected drawing tool when you release it. This is fairly universal - from memory GIMP uses Ctrl by default instead, but everything else I know uses Alt.

So, I did this, but there's a silly issue I met. Whenever Alt key is released, the focus goes to the menu, as that's a standard thing in windows.
I can prevent this by marking the key event as "handled" if it's done in "Area editing" mode, but I was not sure if that would be expected, as that would on contrary prevent user from calling a menu using Alt while in certain room editing modes.

How do applications deal with this usually?

EDIT: don't know why, but appears it goes to system menu, and not to the main menu. Maybe that has to be coded separately.
Also AGS seems to have a separate glitch on its own, because as soon as you open a system menu after pressing Alt, it's moved down, causing graphical artifacts on the window panel...
EDIT2: apparently something got broken in that regard too. In 3.2.1 pressing Alt would focus the main menu, but starting with the first open source version 3.3.0 it focuses the system menu and causes the above glitch. Perhaps this got broken when AGS interface was redone with docking panels.


EDIT3: Maybe I should change this feature to using Ctrl instead. Ctrl is usually associated with selection (ctrl + click can mean "add to selection" in editors).
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: ThreeOhFour on Sat 02/11/2024 22:19:20
I think Ctrl+click would work well too, yes! I will use this in image editors to select a layer (as opposed to a colour) which probably makes just as much sense, thematically.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: Snarky on Tue 19/11/2024 15:06:34
Just out of curiosity, what if anything is holding AGS 4 back from becoming the official AGS release (or at least the next RC)?
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: eri0o on Tue 19/11/2024 15:50:45
Note: what I mention below is my own opinion

At minimum we need to document everything we made. I would say the biggest thing in my mind is documentation. And updating the templates.

Perhaps there are small details since because no one tested.

Spoiler
Other than this there are small known issues that I think it's mostly about people being ok with current state of things. I think the blend modes may not work on the web due to limitations of WebGL because they would need to somehow be reimplemented using shaders (I conceptually don't know how, like how I would sample what is there to calculate the blending, it seems I need for each 2d pixel all pixels "vertically" of the things on top and bottom), I don't remember if rotation had all the click handling done but this was a thing at some point. If we ever do touch there are some issues that needs to be redone on the backend of GUIs but perhaps this can be changed without affecting things. There is also the Joystick/Gamepad stuff for skipping things, the preconfigured skippings of AGS, how one would set a button - currently you need to manually use Skip for joysticks if you want a custom config. We need to add Length to the autocomplete of arrays - this is now an issue in 3.6.2. But maybe these don't matter for a release, they sound like things that can be postponed, it all depends from people testing and giving their feedback.
[close]

Overall my feeling is more about the process of things, ags3 is magically backwards compatible to everything before, both in project and binary (the engine runtime). In ags4 the idea is to drop this, or at least drop this for things in the land before time. This impacts things, for me documentation is the hard one since so far we simply always added stuff and now suddenly I need to delete stuff, what does it means, would it be maintaining two documentation repositories for some time and forward?
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: Crimson Wizard on Tue 19/11/2024 18:10:32
Quote from: Snarky on Tue 19/11/2024 15:06:34Just out of curiosity, what if anything is holding AGS 4 back from becoming the official AGS release (or at least the next RC)?

1. My lack of confidence in planning.

2. Documentation must be updated, and before that we need to have a proper support for 2 branches of the manual (3.* and 4.* at least).

3. At least couple of planned new features, like Touch input API (joystick/gamepad api is already implemented, and touch api is the only api remaining to let users script their own controls on all types of platforms).

4. Each new major feature has to be reviewed for completeness, tested, and finished if it's not complete, like the "blend modes" that eri0o mentioned.



In regards to testing: I am fairly certain that at least several people have been using AGS 4 for a while now to make games. But I know that mostly because of the occasional conversations on Discord. If it were possible to bring more people to just experiment with the new version, or chosen features at least (if not making actual games with it), and give feedback, that might speed things up too.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: WiseFrog on Tue 19/11/2024 23:06:13
Are you planning to add the possibility to update games without losing saved files in this version of ags?
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: Crimson Wizard on Tue 19/11/2024 23:19:20
Quote from: WiseFrog on Tue 19/11/2024 23:06:13Are you planning to add the possibility to update games without losing saved files in this version of ags?

I'm adding this in 3.6.2 first, because I wanted to have this in a backwards compatible version as well. (Of course AGS 4 will receive it too)
The basic functionality is already done*, and currently I am working on a additional "save prescanning" feature that lets to test a save without actually loading it.

This is thoroughly explained in this thread, and links to test builds are available in posts:
https://www.adventuregamestudio.co.uk/forums/engine-development/load-older-game-saves-into-updated-game-attempt-2/

* - when I say "done", i refer to the minimal functionality. It may be expanded further (although there's a limit of what may be achieved with the existing save format). This feature still awaits its users to provide potential use cases and feedback.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: ThreeOhFour on Tue 19/11/2024 23:39:03
Out of curiosity, what features are you looking for feedback on? I'm using AGS 4 daily now, and am using some of the new features - but definitely not all of them. Overlay rotation and the add blend mode work perfectly. I haven't spent much time trying to rotate anything else, nor using the other blend modes, but can spend some time with them and give feedback if it's desired?
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: Crimson Wizard on Tue 19/11/2024 23:56:08
Quote from: ThreeOhFour on Tue 19/11/2024 23:39:03Out of curiosity, what features are you looking for feedback on?

Any from the list, really. Even if only just the fact that they are being used, work as expected, and if are useful or not.
It's not clear at this point which were tried by other people than the devs themselves, since there had been little mention of this.

Then, there are those that are rather straightforward, and those that are complex. The latter may be of more interest.

1. New scripting features available with the new compiler; more importantly those that require using pointers: managed structs within managed structs, connecting custom managed objects together, and such. These involve both script compiler and the engine managing "garbage collection".
2. "Watch variables" panel.
3. From new scripting commands, it would be nice to see someone trying VideoPlayer, but I understand that's rather niche thing to have in games. That will mostly be useful if someone makes one of those "FMV style" games.
4. New Joystick/gamepad interface in script. It should replace a use of joystick plugin. But this is interesting for people who make gamepad controls in their games.
5. Translations, because they are now saved in a PO format. Although the usage should still be pretty straightforward, but I am curious if they cause any kind of trouble.

Earlier I would have also mention "Room editing" because of the new rooms storage format, but you can't miss it when you edit the game, so, I suppose. this was tested more than other things.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: eri0o on Wed 20/11/2024 11:20:17
Another feature that would be nice to get more experimentation is the PathFinder and MaskPathFinder API along with the path movement stuff - you can pass an array of Points to things to create a path that they should move along, at least for objects and characters. I think at the time only I and CW played with it.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: Snarky on Wed 20/11/2024 14:09:29
Quote from: Crimson Wizard on Tue 19/11/2024 18:10:322. Documentation must be updated, and before that we need to have a proper support for 2 branches of the manual (3.* and 4.* at least).

I assume "proper support for 2 branches," means that it's not just a matter of forking the manual's Github repo, then.
Title: Re: AGS 4.0 - Alpha 14 for public test
Post by: Crimson Wizard on Wed 20/11/2024 14:30:41
Quote from: Snarky on Wed 20/11/2024 14:09:29I assume "proper support for 2 branches," means that it's not just a matter of forking the manual's Github repo, then.

I don't know, maybe having 2 repositories is also a way, if branches don't work.

With 2 repos the wiki pages may be still being used to edit the manual (github does not support editing multiple branches through the "wiki" front).

This approach will become inconvenient if we want to have separate branch per maintained version, including minor versions. But it also may be a temporary "dirty" solution until something better comes up.
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: Crimson Wizard on Sun 24/11/2024 22:21:39
Updated to Alpha 15
(Please use download links in the first post)

Contains all the new features from 3.6.2 Betas 3 (https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-3-6-2-beta-1-a-wip-3-6-update/).

Own changes:

Editor:
 - The "Watch Variables" panel has an option to automatically enlist local variables (relative to current position in script) when testing the game.
 - Added "Add to Watch Panel" command to Script Editor's context menu.
 - Support dragging a text from the script window into the "Watch Variables" panel.
 - Fixed mistakes occuring when overwriting existing room files by a imported room.

Scripting:
 - Managed structs may have constructors. Constructor is a member function which name is identical to the struct's name, and type is "void". Constructor will be called automatically when the managed object is created with "new" command.
 - Dialog Scripts dropped support for a number of obsolete commands: "run-script", "new-room", "set-speech-view", "set-globalint", "play-sound", "add-inv", "lose-inv". All of those have contemporary equivalents.



Using constructors is more or less how you do it in C++/C#, except it has to be declared having a type "void", as opposed to no type at all (this is kept so for simplicity of compiler's work, idk if it's critical, but maybe we could look into letting to declare it completely typeless later).

Example:
Code (ags) Select
// header
managed struct MyStruct
{
     import void MyStruct(int data); // this is constructor
     import readonly attribute int Data;

     writeprotected int _data;
};

// script
void MyStruct::MyStruct(int data)
{
     _data = data;
}

int get_Data(this MyStruct*)
{
     return _data;
}

// elsewhere in another script
function game_start()
{
     MyStruct *s = new MyStruct(10); // this actually calls constructor
     Display("%d", s.Data); // should display 10
}
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: Crimson Wizard on Sun 08/12/2024 14:45:29
@yarooze , I moved the text boxes discussion here:
https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/re-ags-4-0-alpha-15-for-public-test/
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: ThreeOhFour on Tue 10/12/2024 11:08:07
I've been taking a look at the alternate blending modes added to AGS 4.0 and some of them seem to handle alpha channels in a way different than I expect from these modes. Normal, additive and subtractive blending modes act exactly as I expect them to, but the rest seem to have trouble processing the alpha channel correctly, with alpha seeming to be processed without any gradation, and even blending where the image is completely transparent. Here's an example:

Normal blending mode (https://imgur.com/a/ngcZj5I)

Mutliply blending mode (https://imgur.com/hZMMN6I)

I'm using build 4.00.00.09, and I've put up a copy of the sprite used in this test here (https://www.dropbox.com/scl/fi/7ny6r4wiif1gik4bb42up/Test.png?rlkey=zn7vv4qw9nvk7aktkv4b6ll4q&st=d498fdpf&dl=0).
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: eri0o on Tue 10/12/2024 11:39:16
I noticed it went unmentioned in last release notes here on the forums but there's an additional fix for the watch pane that could make the engine unresponsive if one "step into" too fast -  this made it hard to use the watch pane, but the latest 4.0.0.11 also fixed this, so now debugging is much smoother.

About the blending modes, the way they are currently implemented relies on DirectX and OpenGL own implementations, and I guess it may require some of those premultiply alpha settings.

They would be less driver dependent if we used shaders, but there is a detail here that the current use of shaders in the engine, for tint (color and lighting) and transparency, only depends on the data in the texture of the sprite itself. With blending modes the shader has to depend on the information "below", but currently, in the gfx drivers the previous drawn sprites aren't "rasterized" (or "flattened"), so it's not clear how one would get the information of the pixels below, I guess once it has to draw a sprite that has a blending effect it would need to "flatten" so that we can pass each pixel info to the shader drawing this sprite. Beyond investigating implementation there would be a need to check performance impacts, if any.
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: Crimson Wizard on Tue 10/12/2024 12:16:44
To put it simply, not all of the blend modes were implemented correctly in all graphic renderers, and this has to be looked into before the final AGS 4 release.

BTW, there's a ticket that I wrote, about "reimplementing blend modes as shaders", but I wrote it just to have a formal reminder. It is quite possible that this cannot be done with shaders alone, since, as eri0o mentioned, for blending you have to combine pixels from current texture and pixels from already drawn textures below, and shaders cannot do that on their own afaik.
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: ThreeOhFour on Tue 10/12/2024 13:01:15
Thanks for the information! I did some tests with the different drivers and see that there's a difference there. Good to know, thank you.
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: yarooze on Wed 18/12/2024 14:13:58
The new features of AGS4 are great! Nested objects, multi dimensional arrays, watch variables window, shiny new editor windows.. I don't know, how we lived without them.  :smiley:

Unfortunately, after I wrote some functions, the editor starts crashing from time to time without any warnings.

I click F5 or "run" button.
AGS popup "Please wait while your scripts are compiled..." appears.
Then the editor crashes and Windows popup "AGS Editor for Windows does't work anymore" appears.

This one:
(https://i.postimg.cc/R0rcxC38/crash-v4.png) (https://postimages.org/)


The game can be compiled then, if I edit any script (adding some spaces or new lines is enough), save it and compile it again. So it seems, that I can reproduce this error and compile it correctly with the same code.  :confused:

I have some nested Object in my code (even some recursions), but it crushes on compile - not in the run time.

So my questions:
1. Is there any possibility to write some logs to find the problem?
2. Do anybody have such problem with the crushing editor?


I'm using Win10.
AGS Editor .NET 32-bit (Build 4.00.00.11) ** BETA VERSION **
v4.0.0, November 2024
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: Snarky on Wed 18/12/2024 14:25:03
I seem to recall that people have experienced similar problems (not just with AGS4) caused by their antivirus, which for some unknown reason hates AGS. You could try disabling it temporarily and see if you can build.
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: eri0o on Wed 18/12/2024 14:29:25
Just add an exception to your own game folder to Windows Defender and it should work I think. Maybe an exception to AGS Editor too, but I don't think that is needed.

I know the JetBrains IDEs I use for c++, python and Android all require to have the work directories added to Windows Defender otherwise I get some weird behavior.
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: yarooze on Wed 18/12/2024 16:12:28
Windows Defender is actually deactivated. Trend Micro is active but has nothing in log.
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: Crimson Wizard on Wed 18/12/2024 16:34:10
Quote from: yarooze on Wed 18/12/2024 14:13:58So my questions:
1. Is there any possibility to write some logs to find the problem?
2. Do anybody have such problem with the crushing editor?

There's no logging in the editor, other than compiler's errors.

You could PM us your project for a test, if this is a bug in the editor then we'll be able to see what is happening.
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: Crimson Wizard on Wed 18/12/2024 18:24:04
@yarooze I checked your project, and it has a mistake in script that is known to cause all kinds of weird issues.

This is when you have "import" keyword used in function's body, like:
Code (ags) Select
import void HemisphereElement::HemisphereElement(int id,  Hemisphere *hemisphere)
{

}

We have this crash already fixed and the fix will be included in the next update (coming soon).
Instead compiler will report a syntax error.
But you have to fix the script anyway.
Title: Re: AGS 4.0 - Alpha 15 for public test
Post by: yarooze on Wed 18/12/2024 20:53:35
Quote from: Crimson Wizard on Wed 18/12/2024 18:24:04This is when you have "import" keyword used in function's body, like:

Oh.. looks like "silly me".

You mean: "Import belongs to the header. Export belongs to the code. Copypasta is evil."?
Title: Re: AGS 4.0 - Alpha 16 for public test
Post by: Crimson Wizard on Thu 19/12/2024 00:09:46
Updated to Alpha 16
(Please use download links in the first post)

Contains all the new features and fixes from 3.6.2 Beta 4 (https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-3-6-2-beta-1-a-wip-3-6-update/msg636667767/#msg636667767) (excepts ones related to backwards compatibility).


Own changes:

Editor:
- Added Flip property to View Frame, replacing a boolean Flipped property. The new property supports all 3 flip variants: horizontal, vertical and both at once.
- Fixed certain errors like "not terminated string" in Dialog Scripts did not report correct Dialog and line, making it difficult to find the cause of mistake.

Compiler:
- Fixed function bodies mistakenly declared with "import" keyword could cause program memory corruption during compilation.

Scripting:
- When calling a function you may specify parameter names like "name1: value, name2: value", and when doing so - pass arguments in any order.

Script API:
- Added Overlay.Flip property that lets to set one of the 3 standard flip styles.
- ViewFrame.Flipped property now returns eFlipDirection instead of bool.

Engine:
- Engine now supports up to 1024 simultaneously loaded scripts (was 128).
- Fixed Type.GetByName() not working (regression since one of the previous v4.0 Alphas).
- Fixed Software renderer not handling all the Overlay transformations correctly (like rotation).



In regards to naming parameters in the function call.

When calling a function, you can pass parameters having their names explicitly specified. This may be advantageous for the clarity of code. But in the end this is a user's choice of code style.

For example:
Code (ags) Select
import int Func(int param, float fparam, String str_param);

void CallAnother()
{
    int result = Func(param: 10, fparam: 5.7, str_param: "text");
}

There are following rules:

* A function call must have either all passed parameters named, or none named. These two syntax styles cannot be mixed in the same function call.
* If you pass parameters named, they may go in any order.
* But, in any case, non-optional parameters (ones without default value) must be passed in the function call regardless of the syntax style used.
* If you are calling a variadic function (such as String.Format), and pass fixed parameters named, then you won't be able to pass variable parameters at all (because they don't have names!).
Title: Re: AGS 4.0 - Alpha 16 for public test
Post by: yarooze on Sat 21/12/2024 08:50:12
I've got some strange behavior with the new AGS4 build a couple of time.

As I wrote the function (actually I did some copy pasta and change some parameters), I've got an error message:

Error: Der Index war außerhalb des Arraybereichs.
Version: AGS 4.00.00.12

System.IndexOutOfRangeException: Der Index war außerhalb des Arraybereichs.
  bei AGS.Editor.AutoComplete.GetFunctionParametersAsVariableList(ScriptFunction func, List`1 variables)
  bei AGS.Editor.AutoComplete.GetLocalVariableDeclarations(ScriptFunction func, List`1 localStructs, String scriptToParse, Int32 relativeCharacterIndex)
  bei AGS.Editor.ScintillaWrapper.CheckFunctionForLocalVariables(Int32 currentPos, ScriptFunction func, String scriptExtract, Boolean searchWholeFunction)
  bei AGS.Editor.ScintillaWrapper.GetListOfLocalVariablesForCurrentPosition(Boolean searchWholeFunction, Int32 currentPos)
  bei AGS.Editor.ScintillaWrapper.FindLocalVariableWithName(Int32 startAtPos, String nameToFind)
  bei AGS.Editor.ScintillaWrapper.GetFinalPartOfExpression(Int32 currentPos, ScriptStruct& memberOfStruct, Boolean functionsOnly)
  bei AGS.Editor.ScintillaWrapper.CheckForAndShowEnumAutocomplete(Int32 checkAtPos)
  bei AGS.Editor.ScintillaWrapper.ShowAutoCompleteIfAppropriate(Int32 minimumLength)
  bei AGS.Editor.ScintillaWrapper.OnUpdateUI(Object sender, EventArgs e)
  bei ScintillaNET.Scintilla.OnUpdateUI(UpdateUIEventArgs e)
  bei ScintillaNET.Scintilla.WmReflectNotify(Message& m)
  bei ScintillaNET.Scintilla.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)


"Der Index war außerhalb des Arraybereichs." means "The index is out of the array boundaries"

The Editor did not crash. Simple displayed me this message a couple of time. I was able to work further.

I'm not really sure how to reproduce it. I added parameters into the existing constructor (it had no parameter and was imported into the struct in the ash file). So I wrote something like this in the asc file:

void SkyViewElement::SkyViewElement(SkyView *skyView, int is = 0)
ash was like this:

import void SkyViewElement();
Message as screenshot:

(https://i.postimg.cc/w164C7kK/arraykey.png) (https://postimg.cc/w164C7kK)




Title: Re: AGS 4.0 - Alpha 16 for public test
Post by: Crimson Wizard on Sun 22/12/2024 01:35:02
This temp build should have the problem with autocomplete crashing fixed:
https://cirrus-ci.com/task/6320305364271104
Title: Re: AGS 4.0 - Alpha 16 for public test
Post by: yarooze on Thu 26/12/2024 22:30:35
Sorry, but it's me again.

It seems for me, that the function Character.AddWaypoint doesn't work as described: https://adventuregamestudio.github.io/ags-manual/Character.html#characteraddwaypoint


If I put it into the default game, the character walks endless on the 50,145 point and sometimes the game crashes then:
function room_AfterFadeIn()
{
  cEgo.Walk(50, 145);
  cEgo.AddWaypoint(100, 145);
}

If I remove AddWaypoint line, then cEgo stops on the 50,145.

Am I doing something wrong?
Title: Re: AGS 4.0 - Alpha 16 for public test
Post by: Crimson Wizard on Thu 26/12/2024 22:50:52
Quote from: yarooze on Thu 26/12/2024 22:30:35and sometimes the game crashes then

Please tell is there any error message when it crashes?
Title: Re: AGS 4.0 - Alpha 16 for public test
Post by: yarooze on Thu 26/12/2024 23:22:08
Quote from: Crimson Wizard on Thu 26/12/2024 22:50:52
Quote from: yarooze on Thu 26/12/2024 22:30:35and sometimes the game crashes then

Please tell is there any error message when it crashes?


Looks like this:
https://get.hidrive.com/i/JNHiHwr8

then sometimes this message:

---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x779928CF; program pointer is +9908, engine version 4.0.0.11, gtags (0,9)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and contact the game author for support or post these details on the AGS Technical Forum.



Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.

An error file CrashInfo.dmp has been created. You may be asked to upload this file when reporting this problem on the AGS Forums. (code 0)
---------------------------
OK   
---------------------------

Title: Re: AGS 4.0 - Alpha 16 for public test
Post by: Crimson Wizard on Fri 27/12/2024 01:54:47
@yarooze there was a bug in AddWaypoint, here's a temp build with a fix:
https://cirrus-ci.com/task/5025614987526144
Title: Re: AGS 4.0 - Alpha 16 for public test
Post by: yarooze on Fri 27/12/2024 11:59:05
Quote from: Crimson Wizard on Fri 27/12/2024 01:54:47@yarooze there was a bug in AddWaypoint, here's a temp build with a fix:
https://cirrus-ci.com/task/5025614987526144
It works. Thank you.

PlaySound("Your sound card works perfectly!");
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sun 29/12/2024 14:12:01
Updated to Alpha 17
(Please use download links in the first post)

Contains all the new features and fixes from 3.6.2 Beta 5 (https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-3-6-2-beta-1-a-wip-3-6-update/msg636668024/#msg636668024) (excepts ones related to backwards compatibility).


Own changes:

Editor:
- Fixed incorrect default values of GUI color properties (BackgroundColor, etc). This is a regression in 4.0 Alphas since we support full 32-bit color range values.
- Fixed default value of ListBox's SelectedBackgroundColor is being treated as "transparent", for the same reason.

Scripting:
- May omit struct's name when addressing a static member from within a struct's member function.

Script API:
- Added Game.RoomCount, RoomNumbers[] and RoomNames[] properties.
- Added Room.Number and Name properties.

Engine:
- Fixed program exception when Character.AddWaypoint() is called in script.

Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Thu 02/01/2025 12:43:28
Hi,

I'm trying to test AGS 4.0 with my project developped on AGS 3.6.1.

I'm adjusting some of the deprecated functions now.

In AGS 4.0, is there a way to play MP3 files (or audio files) placed in the game's directory ? Before, I used to use the PlayMP3 function (with an old-style scripting enabled in general settings if I remember well).

Also, it doesn't seem Tween module is compatible with AGS 4.0 ?

And last question : is it normal that each time I want to launch my game, all the rooms are recompiled ? (even if I didn't change any Header script files)
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Thu 02/01/2025 12:59:53
Quote from: Baguettator on Thu 02/01/2025 12:43:28In AGS 4.0, is there a way to play MP3 files (or audio files) placed in the game's directory ? Before, I used to use the PlayMP3 function (with an old-style scripting enabled in general settings if I remember well).

No. We have discussed a possible replacement, but it was not done yet.

Quote from: Baguettator on Thu 02/01/2025 12:43:28Also, it doesn't seem Tween module is compatible with AGS 4.0 ?

It may require fixing some syntax mistakes.

Quote from: Baguettator on Thu 02/01/2025 12:43:28And last question : is it normal that each time I want to launch my game, all the rooms are recompiled ? (even if I didn't change any Header script files)

No, it's not normal.
But this is a known problem if you have just upgraded your project, then all rooms will be recompiled after fixing any mistake in script.
If that's the case, one way to fix this is to open Game.agf.user in a notepad and change value of "<RequiresRebuild>True</RequiresRebuild>" to "False".
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Thu 02/01/2025 15:00:41
Thanks Crimson !

I encounter a problem with the upgrade of AGS 4.0 : my game places tokens like in a tabletop game, it's gui's buttons with a dynamicsprite.CreateFromFile as visual. Sometimes it has to be rotated.

In AGS 4.0, all the sprites look "grey", like with black lines on them. And the larger sprites (supposed to be tiles, larger than tokens) are not displayed at all (only full black squares, I tested with a script that displays a text if I click on these buttons, and the text is well displayed. So the button is here, it has correct width/height, but it's full black instead of its intended picture).

https://drive.google.com/file/d/1IOlLnlPJ1-rahRnH7AoCIa-tobb5RlSe/view?usp=sharing

In AGS 3.6, everything was working perfectly...

Any idea ?

The only thing I changed by upgrading to AGS 4.0, is to remove the bool parameter in DynamicSprite.Create and DynamicSprite.CreateFromExistingFile, and these are not used for that tokens and tiles because I use sprites that are not imported in my game's editor. These images are in the Game's directory, and they are BMP files (or sometimes PNG, but on my examples they are BMP).

The buttons with the image displayed correctly in my example are buttons that have their sprite already imported in my editor's game. So they have no problem.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Thu 02/01/2025 19:30:03
Also, another problem (or difference between AGS 3.6 and 4.0, if intended or not ?) I noticed :

In my code, I had this line :

String tmp_name="tmp";
File* tmp = File.Open(tmp_name, eFileWrite);

It was supposed to open (create) a file that didn't exist before, write in it, then copy its content into another file, then delete it (I think it's a bit weird to do that way, it's from a module I didn't make, but anyway...).

In AGS 3.6, no problem.

In AGS 4.0, tmp was always a null pointer.

Perhaps the File.Open command wasn't containing any tag for the path of the file ? it was just the name of the file, and I don't know if by default, if no path is indicated, AGS pointed to its game's directory.

The thing is, now in AGS 4, it's a crash, it wasn't before. I don't know if it's intended ?
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Thu 02/01/2025 19:39:11
Quote from: Baguettator on Thu 02/01/2025 19:30:03Perhaps the File.Open command wasn't containing any tag for the path of the file ? it was just the name of the file, and I don't know if by default, if no path is indicated, AGS pointed to its game's directory.

The thing is, now in AGS 4, it's a crash, it wasn't before. I don't know if it's intended ?

You should always insert a location token into the path. When you do not, AGS assumes "game's directory", which is forbidden for writing files.

In AGS 3 there was a backwards compatible mode, where in such case it would remap the path to "$APPDATADIR$" instead.

Initially it was supposed to work only for older games, but someone persuaded me to change it and make it work for new games too, which is a mistake in my opinion. Anyway, it seems people might be using this in 3.* versions without realizing what is going on.

AGS 4 is strict about this.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Thu 02/01/2025 19:51:44
OK, thanks for the explanation ! It's not a problem for me, I corrected the script :)

Any idea about the sprite problem I wrote before ?
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Thu 02/01/2025 19:58:29
Quote from: Baguettator on Thu 02/01/2025 15:00:41I encounter a problem with the upgrade of AGS 4.0 : my game places tokens like in a tabletop game, it's gui's buttons with a dynamicsprite.CreateFromFile as visual. Sometimes it has to be rotated.

In AGS 4.0, all the sprites look "grey", like with black lines on them. And the larger sprites (supposed to be tiles, larger than tokens) are not displayed at all (only full black squares, I tested with a script that displays a text if I click on these buttons, and the text is well displayed. So the button is here, it has correct width/height, but it's full black instead of its intended picture).

https://drive.google.com/file/d/1IOlLnlPJ1-rahRnH7AoCIa-tobb5RlSe/view?usp=sharing

Please upload an example of image, and post an example of a script command that loads this sprite into the game, so that I could test this.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Thu 02/01/2025 20:20:45
OK, here a folder with all the tokens I use. You find the tiles in the "Dalles" repertory, and the other tokens in every other directory.

https://drive.google.com/file/d/1uJiEOUisX77uaZZcMvKmSYU2k5uif5U9/view?usp=sharing

My script is very simple.

struct Token
{
DynamicSprite *ds;
};

Token token[50];

function CreateTokens(int id, String path, int angle)
{
  token[id].ds=DynamicSprite.CreateFromFile(path);
  if (angle>0) token[id].ds.Rotate(angle);
  gTabletop.controls[id].NormalGraphic=token[id].ds.Graphic;
  gTabletop.controls[id].Visible=true;

  // etc...
}

EDIT : it seems very strange, some sprites are displayed strangely (as I have shown in my previous screenshot), but some sprites don't appear at all, like if they were totally transparent...
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Fri 03/01/2025 15:17:43
I found something annoying with the last update of AGS 4, it's that when you test the game with the editor, and the game crashes, the call stacks and the little message telling you what happenned are not displayed, you have to go to "window=>call stack" to see them, and you click "okay, close the game", the game doesn't close and the editor is stuck in debugging mod. (you can modify it, but you need Ctrl+Alt+Suppr to close it for real)

EDIT : seems to not concern every crash reason.

EDIT 2 : new problem I encounter in AGS 4. If I attach a function On_Click on a button called "Objectif", the function is by default called Objectif_OnClick. If I rename it, let say Fouille, then in the editor I click in the "..." button of on_click function in the right panel of the gui's window (with the Objectif button selected, so in this box there is the name of its onclick function, so in my case it's written Fouille), the editor creates a new function called Fouille. Previously in AGS 3.6, he knew that there was a function called Fouille, and he didn't create a new one, he jumped to the right function directly.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Fri 03/01/2025 17:33:50
Quote from: Baguettator on Fri 03/01/2025 15:17:43EDIT 2 : new problem I encounter in AGS 4. If I attach a function On_Click on a button called "Objectif", the function is by default called Objectif_OnClick. If I rename it, let say Fouille, then in the editor I click in the "..." button of on_click function in the right panel of the gui's window (with the Objectif button selected, so in this box there is the name of its onclick function, so in my case it's written Fouille), the editor creates a new function called Fouille. Previously in AGS 3.6, he knew that there was a function called Fouille, and he didn't create a new one, he jumped to the right function directly.

This may be the case with AGS 3.6.2 too (will need to test this), because this is where some additions to event creation and linking were done first.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Fri 03/01/2025 20:10:46
Alright, thanks !

Have you looked into the sprite rendering issue ? (no pressure, just to know if you indentified at the problem)
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Fri 03/01/2025 21:04:55
Quote from: Baguettator on Fri 03/01/2025 20:10:46Have you looked into the sprite rendering issue ? (no pressure, just to know if you indentified at the problem)

I did reproduce the problem, but did not have time to investigate this yet.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Fri 03/01/2025 21:07:05
Nice, happy to know it's also for the others :D

Hope you'll be able to fix it !

I'm testing AGS 4.0 as deeply as I can with my game. I'll report if I encounter anything else !

Thanks a lot for developing the tool :)
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Fri 03/01/2025 21:47:46
Crimson, sorry for double post, but here is what I can observe about the sprite problem :

it seems sprites rendering is "decreasing in quality". Because my scripts gives DynamicSprites to many buttons, I can see one of them in pretty good quality, and then, others are like less and less in quality. Until they become invisible. I can see as if the sprites were "cut" with a knife, making transparent lines on them. And they got more and more "cuts".

i'm not sure if it's important for you, but it seems the process is worser and worser, or better and better. I don't know... Hope it will help you !

EDIT : I just saw that the DynamicSprite.CreateFromFile function has a second optional parameter : colorformat. Should it be the issue ? In my game, I don't use this parameter (all of my DynamicSprite.CreateFromFile have only 1 parameter).
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Sun 05/01/2025 09:31:57
Also, not a great problem, but I noticed that if selectedBackgroundColor=0; 0; 0 for a ListBox, it makes it transparent. Before, in AGS 3.6, it was black (as intended).

(sorry for multiposts, I don't know if you are notified if I make "quick edits" in my old posts, so I create a new one, but tell me if I'm doing wrong please !)
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sun 05/01/2025 10:14:43
Quote from: Baguettator on Sun 05/01/2025 09:31:57Also, not a great problem, but I noticed that if selectedBackgroundColor=0; 0; 0 for a ListBox, it makes it transparent. Before, in AGS 3.6, it was black (as intended).

This is a known problem, but I must clarify: color 0 is treated as transparent by SelectedBackgroundColor property.
The reason why "black" color worked before was that it was written in palette index other than 0 (16 to be precise), but it's not possible to do now in AGS 4, where colors in 32-bit games must be written as 32-bit RGBs.

There's no other way around this than to select slightly non-black color at the moment.

I do not know what the actual fix should be, as there's no way to select "transparent color" in these properties. Either we have to implement that somehow, or maybe there could be a separate property that sais "show or not show the selection".

Personally, I'd prefer selectable transparent color, as "selection" awhole may involve multiple things, not just the bg color, while user may want to have front color for selected items, for instance, but not bg color.

EDIT: Perhaps having 0 color be black in 32-bit would work as a quick fix. Because it's more likely that users want a bg color for selection. And if they want transparent color, they may assign the background GUI color. The only case when that won't work is if the GUI has a non-trivial background graphic...
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Snarky on Sun 05/01/2025 10:22:11
Quote from: Crimson Wizard on Sun 05/01/2025 10:14:43I do not know what the actual fix should be, as there's no way to select "transparent color" in these properties. Either we have to implement that somehow

Would there possibly be a need for three versions of the color picker?

- 24-bit (RGB) for colors that must be fully opaque
- 24-bit/transparent for colors that can be opaque or not drawn at all
- 32-bit (RGBA) for colors that can have alpha-transparency
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sun 05/01/2025 11:30:33
Quote from: Snarky on Sun 05/01/2025 10:22:11Would there possibly be a need for three versions of the color picker?

- 24-bit (RGB) for colors that must be fully opaque
- 24-bit/transparent for colors that can be opaque or not drawn at all
- 32-bit (RGBA) for colors that can have alpha-transparency

I am currently not certain if it is necessary to have all 3 variants and not just the fullest one.
But besides (or rather - before) the editor GUI there's a problem of
a) saving this value in game data. Right now all the colors in AGS 4 are interpreted uniformly as R8G8B8, the uniformity keeps things simple.
b) having this value in respective script properties.

Because even if you take just the single transparent color as an addition, it's not im clear how to incorporate it in the existing system without treating alpha bits as alpha. I.e. classic 255,0,255 color may be opaque too.

I had a ticket open (https://github.com/adventuregamestudio/ags/issues/2525), but it received a mixed reaction from other devs. I suggest that we need to come to a conclusion on it.

EDIT: I think (and noted in the last comment to that ticket), that I put several separate things in it by mistake. Maybe these things should be disconnected and dealt with separately.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Sun 05/01/2025 12:13:10
I mentioned in the ticket, what if we do that Color managed struct, all these properties are now this type, and things that need color properties would instantiate these managed structs and hold a reference internally. Then we can either make these readonly (so people must use the properties) or handle the pointer assignment as way that only copies the values (but not the pointer, or people could pass the same pointer to multiple properties and get confused when changing one property change another).

Then we could do obj.Color.RGB = 0xRRGGBB or obj.Color.ARGB = 0xAARRGGBB (or obj.Color.RGBA = 0xRRGGBBAA, and however we handle it, we hide it internally (including any mask color necessary).
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sun 05/01/2025 12:33:58
Above looks alright on its own (in api sense), but naturally my concern is that this will break all the people scripts... If that's fine, we could try that approach.


EDIT:
Also, I am mentioning this since you have brought the script function speed before, this will make setting colors somewhat slower, because that would require 2 function calls:
- get_Color - that returns a pointer to Color struct
- set_RGB - that sets value as rgb.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Sun 05/01/2025 13:40:17
Two things often appear when I use the VS Profiler in the AGS Engine when I am trying to do something visual (like the recent Particles script module)


Other than this for some reason loops in AGS Script feel slower than they should, but these don't appear when profiling.

The Color having to be fast is an issue only in one place, which is the DrawingSurface.DrawingColor property, which is critical for doing fun effects!

I guess we could try the plain int approach and see how that works.

Whatever is done has to be throughly tested in the hard case that is a game with a linear interpolation, to see if the border of sprites are affected since the ticket with all the changes written impacts how sprite importing would happen.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sun 05/01/2025 13:49:00
Quote from: eri0o on Sun 05/01/2025 13:40:17Whatever is done has to be throughly tested in the hard case that is a game with a linear interpolation, to see if the border of sprites are affected since the ticket with all the changes written impacts how sprite importing would happen.

I don't understand, how does that ticket impacts sprite importing?
I re-read it, and I do not see anything mentioning sprite import...
EDIT: i found something in comments, is it about sprite->texture conversion?

In any case, I am not suggesting to implement that ticket as-is. It may be split apart and done in steps, discussing and testing every step separately.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sun 05/01/2025 16:10:48
Quote from: Baguettator on Fri 03/01/2025 15:17:43EDIT 2 : new problem I encounter in AGS 4. If I attach a function On_Click on a button called "Objectif", the function is by default called Objectif_OnClick. If I rename it, let say Fouille, then in the editor I click in the "..." button of on_click function in the right panel of the gui's window (with the Objectif button selected, so in this box there is the name of its onclick function, so in my case it's written Fouille), the editor creates a new function called Fouille. Previously in AGS 3.6, he knew that there was a function called Fouille, and he didn't create a new one, he jumped to the right function directly.

@Baguettator  could you please post step-by-step instruction on how to reproduce this problem? At first I thought I got it, but trying now it works fine, so maybe I am not doing what you were doing.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Sun 05/01/2025 17:41:09
Yeah, in my last working time, I didn't encounter the bug. Will notice you if I encounter again, because perhaps it was the previous AGS 4.0 version (was alpha 13 before).

The main problem for me is the dynamicsprite not rendering correctly. Hope you will fix it as soon as possible ! ;)
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sun 05/01/2025 18:47:29
Quote from: Baguettator on Sun 05/01/2025 17:41:09The main problem for me is the dynamicsprite not rendering correctly. Hope you will fix it as soon as possible ! ;)

I found what was wrong with some sprites not visible after loading, but I don't know how to reproduce the other problem where sprites have lines on them.

Does this happen with particular sprites (which ones?), or after you do something to them?

EDIT:
here's the temp build which has sprite loading fixed:
https://cirrus-ci.com/task/6201304671846400
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Sun 05/01/2025 19:05:54
@Baguettator can you make a small game and project that has the same lines issue and share the project here?

Also, does the issue happens with all three graphics drivers (D3D, OGL, and Software)?
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Sun 05/01/2025 21:06:48
Thanks Crimson ! Is it safe to test my game with your fixed version ?

Will have a look and tell you what I'll see :)
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Mon 06/01/2025 09:41:19
Quote from: eri0o on Sun 05/01/2025 12:13:10I mentioned in the ticket, what if we do that Color managed struct, all these properties are now this type, and things that need color properties would instantiate these managed structs and hold a reference internally. Then we can either make these readonly (so people must use the properties) or handle the pointer assignment as way that only copies the values (but not the pointer, or people could pass the same pointer to multiple properties and get confused when changing one property change another).

Then we could do obj.Color.RGB = 0xRRGGBB or obj.Color.ARGB = 0xAARRGGBB (or obj.Color.RGBA = 0xRRGGBBAA, and however we handle it, we hide it internally (including any mask color necessary).


I've been thinking this over for several hours, and while I like the syntax, I am much concerned about the implementation particularly in AGS, and thus became reluctant to do something like that. If this was a new engine, or a different script language, then maybe it would be easier or better justified...

There are multiple issues here: the color storage in dynamic memory that has to be serialized, how game objects will be accessing these, will the Color instance duplicate color values from object's own data or read/write directly to them?
There will be a use of Color in object properties, but also in user script, then likely it has to contain all data within itself.
Then, AGS engine's code currently has a number of problems in its organization, which may make it inconvenient to bind a game class to a separate managed object. An example is GUI classes that do not have any proper "runtime" class equivalent yet which would allow to handle access to managed data. We'd need to reorganize them first prior to doing something like that.

Then, if we replace properties, then should not we also replace function arguments? There is "color" arg in some functions, like Overlay.CreateTextual. Game.GetColorFromRGB would need to return Color struct.

An idea of having separate DrawingSurface.DrawingColor as integer just for the sake of maintaining performance, while having a practical purpose, looks bad for consistency of API.

If script API uses Color struct, then users should be able to store colors in the same struct too, to keep things smooth.
But then another big inconsistency is going to be color assignment: as you say, when stored in objects they should not be shared, so assigning a Color reference to object's property will act as a copy. But if users use Color struct in their scripts, these will not copy when assigned but share a reference? Which will lead to mass confusion. So this might require designing a specific syntax approach. I'd even say: an ability to pass and assign PODs (plain structs) could come handy.

Overall this means that implementing such approach would require good amount of effort, while breaking user scripts and requiring them to change some habits.

Repeating myself, if this were a new engine then this could be justified. But what do we gain with such overhaul in the existing one? It's the ability to set "transparent color", or provide "alpha" value to color properties, where latter is not normally required alot.
Looking at the cost / benefit relation here makes me quite doubtful.

Maybe this idea could be planned to be looked into again after a bigger refactor of the game classes in the engine, as a part of the big script api overhaul, where other complex things, such as various transformation and graphical properties, would receive same change.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Mon 06/01/2025 09:54:32
We could use the plain int approach, this could work nice with the hex assignment. 0xaarrggbb or 0xrrggbbaa or just 0xrrggbb depending how the colors are thought through.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Mon 06/01/2025 10:06:23
@Crimson Wizard Hi, I have tested with your fixed version : everything is ok !

I think the problem was "per GUI" : the first images you generate within the same GUI will have problems (invisible), and less and less problems for the followings. That's why the images became more and more visible, and only 1 or 2 of them were fully displayed.

Each time it was 3-4 GUIControls within a GUI, every control was invisible. In my Tabletop GUI, I had 40-50 controls who received DynamicSprite.CreateFromFile as graphics. The first who received the sprites were invisible, and then, the last were without problems, and at the middle, a "crescendo" of visibility :)
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Mon 06/01/2025 10:33:52
Quote from: Baguettator on Mon 06/01/2025 10:06:23I think the problem was "per GUI" : the first images you generate within the same GUI will have problems (invisible), and less and less problems for the followings. That's why the images became more and more visible, and only 1 or 2 of them were fully displayed.

The problem I fixed was loaded sprites being invisible. But I cannot explain other things.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Mon 06/01/2025 11:03:12
Quote from: eri0o on Mon 06/01/2025 09:54:32We could use the plain int approach, this could work nice with the hex assignment. 0xaarrggbb or 0xrrggbbaa or just 0xrrggbb depending how the colors are thought through.

I've been thinking about 2 approaches in regards to plain int values.

1. Have all colors treated uniformly as ARGB in all properties and arguments.

That will be most consistent, and simple to implement, but will make 0xFF... prefix mandatory for opaque colors when you define the color by hand, which may be seen as annoying by some, and be prone to user mistakes.
Two more notes here:
- Value 0 will be the easy way to set "transparent color".
- Alpha has to be in highest bits, because 0xRRGGBB may be cast (assigned) to 0xAARRGGBB, but cannot be cast to 0xRRGGBBAA (will require value conversion).
- Majority of users can just use Game.GetColorFromRGB / Game.GetColorFromRGBA functions to form colors; where old one will always return opaque color (alpha 0xFF).

--------

2. Have separate properties for RGB and ARGB.

After some hesitation, I wanted to propose this as an alternative to having a Color.RGB/ARGB syntax.
The reasoning here is that in majority of cases users will likely want opaque colors, and specify alpha in relatively very small number of situations.

The idea is to have a "argb" property pair for each xColor property. For example:
- GUI.BackgroundColor
- GUI.BackgroundColorA
- Button.TextColor
- Button.TextColorA
- DrawingSurface.DrawingColor
- DrawingSurface.DrawingColorA
etc

where Object.Color would interpret positive integer values as RGB, and let's say "-1", or any invalid value would mean "transparent color".
And Object.ColorA would interpret any value as ARGB.

The downside here is obvious duplication of each Color property (but I think there are not too many of those).
There is also a room for mistake, where one would try to assign full argb to rgb property.

The upsides are:
- This allows to restrict certain things to no alpha support, and make alpha support more explicit.
- Users are not required to remember to put alpha 0xFF when they define opaque colors.

There's a remaining question of colors as function parameters though.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Mon 06/01/2025 11:13:23
I see you using the word "Opaque" a lot, and so more making a note here to remind me when making docs, alpha is actually a measure (or a value?) of Opacity. Throughout AGS Script API we use Transparency, which is the inverse. A 100 value of Transparency is a 0 value of alpha.

Also with alpha in the color a lot of things that used to be blit can't be blit if the alpha is not 255.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Mon 06/01/2025 11:30:54
Quote from: eri0o on Mon 06/01/2025 11:13:23I see you using the word "Opaque" a lot, and so more making a note here to remind me when making docs, alpha is actually a measure (or a value?) of Opacity. Throughout AGS Script API we use Transparency, which is the inverse. A 100 value of Transparency is a 0 value of alpha.

BTW there's a ticket that proposes to change Transparency to 0-255 alpha too:
https://github.com/adventuregamestudio/ags/issues/2549

Quote from: eri0o on Mon 06/01/2025 11:13:23Also with alpha in the color a lot of things that used to be blit can't be blit if the alpha is not 255.

This is a matter of providing a separate blitting function that supports alpha blending.
OTOH we may state that we do not support it everywhere for starters.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Tue 07/01/2025 11:05:59
1) I have seen that AGS 4.0 is not displaying "perfectly" sprites : it seems sometimes (or always ? hard to say), there is a line (1 pixel width) that is not drawn. Also for ListBoxes' or TextBoxes' perimeter, not all the lines appear.

2) when you update the translation file, how it works ? If I have already a translation file, and then I delete some lines in my scripts : will the deleted lines be kept in the update ? I remember in 3.6, only the new lines were added (like a File.Append), but I had to delete manually in the .trs file the lines that weren't anymore in my game

3) request for quality of life : would it be possible to add an extra option for the search/replace process ? It would be great if we could choose to search in the full script OR only in the "texts" (the ones who appear in dark red color, between ""). For example, since AGS 4.0, I have to replace many [ symbols, and it would be great to have the replace process to only look at texts zones and not the full script (because you'll have to be careful to not replace the brackets of arrays, and it would be so long, so many "next" clicks...)

Here are my last thoughts ! :)
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Tue 07/01/2025 12:50:51
Quote from: Baguettator on Tue 07/01/2025 11:05:591) I have seen that AGS 4.0 is not displaying "perfectly" sprites : it seems sometimes (or always ? hard to say), there is a line (1 pixel width) that is not drawn. Also for ListBoxes' or TextBoxes' perimeter, not all the lines appear.

Does this happen always, or in a particular case? Can you give a precise example, like, which object, what are this object's properties (size, position, graphic settings)? Does this happen with any graphic driver or specific one?


Quote from: Baguettator on Tue 07/01/2025 11:05:592) when you update the translation file, how it works ? If I have already a translation file, and then I delete some lines in my scripts : will the deleted lines be kept in the update ? I remember in 3.6, only the new lines were added (like a File.Append), but I had to delete manually in the .trs file the lines that weren't anymore in my game

As far as I know, nothing has changed in this regard compared to 3.6.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Tue 07/01/2025 18:53:32
A note on translation files, I believe it now uses the PO format.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: ThreeOhFour on Thu 09/01/2025 04:06:34
Quote from: eri0o on Mon 06/01/2025 11:13:23Throughout AGS Script API we use Transparency, which is the inverse.

This gave me trouble for years when learn AGS because drawing programs use 'Opacity' for this (and usually handle it as a percentage, as AGS does, rather than the 8 bit alpha value) and I always had to convert things backwards. I'm not proposing that this be changed, just mentioning that it always stood out as a quirk in AGS's nomenclature.

I do think it would be great to be able to access the full range of the A value for a colour, though I can't say I've ever run up against it as an issue. But I imagine now that I'm getting back into making effects inside AGS that I would quite rapidly find uses for being able to read and store RGBA colour values.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Thu 09/01/2025 07:57:31
Quote from: Crimson Wizard on Tue 07/01/2025 12:50:51Does this happen always, or in a particular case? Can you give a precise example, like, which object, what are this object's properties (size, position, graphic settings)? Does this happen with any graphic driver or specific one?

Perhaps, just try with the sprites I sent to you, especially those which are located in "dalles" folder. In my game, they are placed one next to the other, without any gap between (side by side). In AGS 4.0, I can see white lines between some sides of them (my background is white). As I also specified, list boxes and text boxes are concerned too. I'll tell you if I see anything else !

About the translation file, I know PO format, I don't know what does it change for me. Just it would be cool if the "update translation file" command would really update it (store the already translated lines, delete everything in the file, and then add all the lines from the scripts, comparing to the stored translated lines and if they match, putting the translated line in the updated file). I have made a "game" to especially do that, but it would be more convenient to have this built-in. (hope my explications are right, I'm not sure of my english language right now !)

And what about my 3° request ? :)
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Thu 09/01/2025 21:50:54
Quote from: Baguettator on Thu 09/01/2025 07:57:31Perhaps, just try with the sprites I sent to you, especially those which are located in "dalles" folder. In my game, they are placed one next to the other, without any gap between (side by side). In AGS 4.0, I can see white lines between some sides of them (my background is white).

Placed how? Were you using objects, or raw drawing them on a surface?
Were these sprites imported, or loaded using DynamicSprite.CreateFromFile?
Can you tell exact name(s) of sprite(s), in case it matters?

Quote from: Baguettator on Thu 09/01/2025 07:57:31As I also specified, list boxes and text boxes are concerned too.

I put a random text box and list box on gui, and they look fine. Does this happen with ANY listbox and textbox for you, or particular ones?
Is this problem seen in the editor or only at runtime?
Does this occur with the particular graphics driver, or any of them?
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Snarky on Fri 10/01/2025 07:22:54
Quote from: Baguettator on Thu 09/01/2025 07:57:31Perhaps, just try with the sprites I sent to you, especially those which are located in "dalles" folder. In my game, they are placed one next to the other, without any gap between (side by side). In AGS 4.0, I can see white lines between some sides of them (my background is white). As I also specified, list boxes and text boxes are concerned too. I'll tell you if I see anything else !

Can't you post a screenshot, at least? It's almost impossible to guess what the problem might be based on the information you've provided.

One possibility is that it has to do with scaling. Are the sprites scaled in-game? Is the game scaled on the screen?
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Fri 10/01/2025 21:53:46
Yes I will give more information when I will able to test.

But, question : my savegames are 250Mo each... It seems VERY large, doesn't it ? Which things take so many place in a save file ? Variables ?

Can it be improved to have savegames lighter ?
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Fri 10/01/2025 21:59:17
Quote from: Baguettator on Fri 10/01/2025 21:53:46But, question : my savegames are 250Mo each... It seems VERY large, doesn't it ? Which things take so many place in a save file ? Variables ?

Can it be improved to have savegames lighter ?

For instance, dynamic sprites are all written in saves by default.
You may avoid that using a new feature (introduced in 3.6.2 and latest 4.0), which allows to exclude dynamic sprites from saves. This is explained here:
https://adventuregamestudio.github.io/ags-manual/UpgradeTo362.html#restricting-the-data-read-or-written-in-a-save

This comes with an obvious problem: you must recreate all the necessary dynamic sprites for the current scene on "eEventRestoreGame" event.

Apart from that, I think you have mentioned that your game is not a standard point and click adventure game, but some kind of a base building strategy game?
In which case I would rather recommend designing your own save system instead. That could be much more convenient than using AGS save states, as you will fully control what is saved and loaded, what is kept intact when restoring a save, and what gets overwritten.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Sat 11/01/2025 08:24:47
Thanks for explanations !

I had a crash for an array out of size, and the runtime executable (the program which runs the game while in the editor) didn't close normally. Perhaps this kind of error causes that issue ?
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Sat 11/01/2025 08:54:18
It would be nice to get bug reports that are minimal, complete and verifiable.

QuoteMinimal – Use as little code as possible that still produces the same problem
Complete – Provide all parts needed to reproduce the problem
Verifiable – Test the code you're about to provide to make sure it reproduces the problem

I think without something that can be run and reproduces any issue it is very hard to grasp anything of what you are reporting. I refrained from writing this because it is useful to get some reporting of bugs but it's hard to act without having anything, ideally, make a small new AGS game that reproduces the issue and attach it somewhere that can be downloaded and link here.

Think in this way, someone writes a bad review in Steam about your game and then just say "bugs", but doesn't clarify any details, it would be nice to get everything needed to reproduce and fix such issues so others get to enjoy the game.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Sat 11/01/2025 09:50:36
Sorry, I wrote it quickly because I already reported here this issue (when the runtime executable doesn't close normally), but really this message is so far now... Apologizes...

The thing is I had something like that :

for (int i=0 ; i<7 ; i++)
{
  btn[i].Visible=true;
}

The btn array's size was [6], so the game crashed (out of array size). And this crash reproduced the "runtime executable doesn't close normally" issue.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Sat 11/01/2025 11:36:11
OK, so here's the problem with "transparent lines" appearing around sprites. I don't know if it's for any sprites, but at least for the tiles in my example (big squares), it's easy to see.

https://drive.google.com/file/d/149PE4pu_DI8YVueWZiyg_5tY4NOXpgAW/view?usp=sharing

I can imagine it's something about rotating sprites. This problem appears with both Draw functions (drawing a DynamicSprite into a surface) and attributing a dynamicsprite to an object (button in my case). If that dynamicsprite is NOT rotated, no problem, no "transparent lines" on edges. If it IS rotated, then the problem happens.

In my screen shots, tiles are the squares  behind every other tokens. There are 3x3 squares, so 9 in total. The rotation of each tile can be seen with the number written on the corner of the tile : the direction of the number indicates the rotation (0, 90, 180 or 270°). Each time a tile is 90 or 270° rotated, it shows the bug.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Sat 11/01/2025 11:48:07
That is zombicide.

But can you hit new in AGS and create a small game that reproduces this specific rotation issue, and share the game project here?
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sat 11/01/2025 15:45:32
Quote from: Baguettator on Sat 11/01/2025 09:50:36The btn array's size was [6], so the game crashed (out of array size). And this crash reproduced the "runtime executable doesn't close normally" issue.

I noticed a similar problem, and apparently it does not matter which error is this.
When a "An error has occured" window appears in the editor, it does not stay and disappears automatically a moment later, game shuts down on its own too (at least in my case), without waiting for you to press the button.

This happens only in AGS 4. (not in any other recently updated versions like 3.6.2)

---

EDIT:  after subsequent tests, this seem random. Sometimes it happens and sometimes is not. It looks like something closes the error popup.
I also do not see the game being stuck in debug mode, although I had an idea why that could happen sometimes (and already pushed a fix earlier).

EDIT2: not sure, but this may be related to another particular application being opened at the same time.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sat 11/01/2025 18:39:05
Quote from: Baguettator on Sat 11/01/2025 11:36:11In my screen shots, tiles are the squares  behind every other tokens. There are 3x3 squares, so 9 in total. The rotation of each tile can be seen with the number written on the corner of the tile : the direction of the number indicates the rotation (0, 90, 180 or 270°). Each time a tile is 90 or 270° rotated, it shows the bug.

Do you rotate same sprite multiple times, or do you recreate it from original each time and then rotate to the final angle?

There's a known issue that if you keep rotating same sprite again and again, then it looses quality over time.
Although, in theory, rotation by the multiples of 90 degrees should not lead to this, so idk if it's related in this case.


EDIT: I tested rotating this big tile from the sprite archive that you have uploaded earlier, and I do reproduce this problem.
It becomes worse if I keep rotating same sprite, bit also happens if I recreate it before giving it a bigger rotation.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Sat 11/01/2025 18:50:19
I rotate them 1 time after creating them.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sat 11/01/2025 19:03:23
I confirm that there's definitely something off with the dynamic sprite rotation in AGS 4.

I made a game in 3.6.0 where I draw 4 tiles on room background, each next rotated by 90 further.

In 3.6.0 version there are no gaps between them, but when replicating same game in 4.0 there are gaps.

Here are both game projects for comparison:
https://www.dropbox.com/scl/fi/fbr8o10b805h3hwvbo6rf/test-360-dynamictilerotate.zip?rlkey=zl3lmkrvfl6zbwo54ua7r9ugq&st=rvkvia0e&dl=0
https://www.dropbox.com/scl/fi/rdmwbkmrk93ud4pyvf78h/ags4-dynamictilerotate.zip?rlkey=2exi0wau9yaw8hcwtb4lc5of8&st=9dssf1cc&dl=0

My first guess is that the dynamic sprites get unexpectedly distorted when rotated.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Sat 11/01/2025 19:19:27
allegro in both ags3 and ags4 are identical except in how they work with the palette for images with palette (8-bit). The rotation code (rotate.c) in both is identical.

In ags4, in Common/gfx/allegrobitmap.h there was a comment added that is like this
    // Draws rotated bitmap, using angle given in degrees.
    // Warning: does not resize destination bitmap; if it's not large enough
    // then the resulting image may end up cropped.

Found the workaround, just pass the width and height properly when rotating. Using your test game @Crimson Wizard

function room_Load()
{
  DynamicSprite *tile = DynamicSprite.CreateFromExistingSprite(1);
  int wid = tile.Width;
  int hit = tile.Height;
 
  DrawingSurface *ds = Room.GetDrawingSurfaceForBackground();
  ds.Clear(Game.GetColorFromRGB(255, 0, 0));
  ds.DrawImage(100, 100, tile.Graphic);
  tile.Rotate(90, 250, 250);
  ds.DrawImage(100 + wid, 100, tile.Graphic);
  tile.Rotate(90, 250, 250);
  ds.DrawImage(100 + wid * 2, 100, tile.Graphic);
  tile.Rotate(90, 250, 250);
  ds.DrawImage(100 + wid * 3, 100, tile.Graphic);
  ds.Release();
}

Works fine in ags4.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sat 11/01/2025 19:41:59
I opened a bug ticket: https://github.com/adventuregamestudio/ags/issues/2651
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Sun 12/01/2025 01:41:43
For the dynamic sprite rotation in ags4, there is a build in the CI here with a fix: https://cirrus-ci.com/task/5179283984875520
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Mon 13/01/2025 12:05:08
Also, I have another request but I know I several times suggested it by the past : because you told about RGBA colours and things about that, is it possible to add PNG management by the editor ? It could be so great to have the possibility to add png files with their alpha channel instead of "magic pink backgrounds" for BMP files.

I don't know how much it is complicated/not planned/not wanted :)
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: eri0o on Mon 13/01/2025 12:14:20
Editor supports importing a png file with alpha, just select the leave as is for alpha when importing.

Did the editor in the link fix the issue with rotating dynamic sprites for you?
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Mon 13/01/2025 13:44:40
Quote from: Baguettator on Mon 13/01/2025 12:05:08Also, I have another request but I know I several times suggested it by the past : because you told about RGBA colours and things about that, is it possible to add PNG management by the editor ? It could be so great to have the possibility to add png files with their alpha channel instead of "magic pink backgrounds" for BMP files.

This is already supported in the editor for many years. Do you maybe mean loading a PNG with DynamicSprite?

What we said about RGBA colors is not related to this.
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Mon 13/01/2025 16:47:45
Yes sorry, I meant : using PNG files for DynamicSprites :)

@eri0o : I didn't try yet, will have a look !
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Sat 18/01/2025 19:26:51
Hi all,

@eri0o : the fix for the rotation with dynamicsprites worked for me, thank you !

I noticed a problem with the GUIControl.GetByName function : I didn't change anything in my game, just ported it to AGS 4.0 (last build, the fix erioo sent me), and I have a null pointer instead of something working like before.

For example, I have a button called "Button1" in my game (it's the script name of the button). Here's my code in game_start function :

int u=1;
  GUIControl *g=GUIControl.GetByName(String.Format("Button%d", u));
  u=g.ID; // error is here, g appears to be a null pointer, whereas it exists in my GUI !
  Display("%d", u);
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sat 18/01/2025 20:49:26
Quote from: Baguettator on Sat 18/01/2025 19:26:51I noticed a problem with the GUIControl.GetByName function : I didn't change anything in my game, just ported it to AGS 4.0 (last build, the fix erioo sent me), and I have a null pointer instead of something working like before.

GetByName got broken again, you will need to use the most recent unreleased build to make it work:
https://cirrus-ci.com/task/6345700029497344
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Sun 19/01/2025 09:00:28
Does it include the rotation fix for dynamicsprite too ?
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Crimson Wizard on Sun 19/01/2025 13:21:29
Quote from: Baguettator on Sun 19/01/2025 09:00:28Does it include the rotation fix for dynamicsprite too ?

This is the latest build which includes everything.

But I forgot that the above includes update of a color format, so may not be entirely safe. It's still in testing.
After upgrading, users will have to fix all of their color constants if they have these in scripts,
that is - assignments like "GUI.BackgroundColor = 123456;". These should be replaced with AARRBBGG format like, which is easier to write in hex (like "0xFFRRGGBB").
If you don't have such things in script, then it's safer, but still I recommend making a game backup.

If you don't want to do this right away, there's a temporary workaround for GetByName:
Code (ags) Select
GUIControl *MyGetByName(GUI* parentGUI, String name)
{
    for (int i = 0; i < parentGUI.ControlCount; i++)
    {
        if (parentGUI.Controls[i].ScriptName == name)
            return parentGUI.Controls[i];
    }
    return null;
}
Title: Re: AGS 4.0 - Alpha 17 for public test
Post by: Baguettator on Fri 24/01/2025 06:53:04
Oh, you mean you are trying to implement the alpha value directly in the number of the color ?

I'll wait for a stable update, don't worry, I'm not in a hurry :)
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Crimson Wizard on Sat 25/01/2025 16:19:07
Updated to Alpha 18
(Please use download links in the first post)

IMPORTANT: starting from this version Editor will require a different VC Redistributable to run.
Installer contains the VC Redist, but if you are getting AGS in an archive, and the necessary component does not happen to already be on your system, then here's a download link to Microsoft's site:
https://download.visualstudio.microsoft.com/download/pr/5319f718-2a84-4aff-86be-8dbdefd92ca1/DD1A8BE03398367745A87A5E35BEBDAB00FDAD080CF42AF0C3F20802D08C25D4/VC_redist.x86.exe

Contains all the new features and fixes from 3.6.2 Beta 6 (https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-3-6-2-beta-1-a-wip-3-6-update/msg636668738/#msg636668738) (excepts ones related to backwards compatibility).


Own changes:

Common:
 - Color number properties now correspond to the encoded 32-bit ARGB (A8R8G8B8 format).

Editor:
 - In 32-bit game projects you can assign full RGBA color definition, where alpha is optional, and is assumed 255 if not specified. Color value 0 means "transparent" regardless of game's color depth.
   NOTE: color picker currently does not let define alpha, so only opaque colors may be selected using it; but you may still enter RGBA value into properties by hand as "RR; GG; BB; AA".

Compiler:
 - Fixed unnecessary warnings about function parameters in function declarations "hiding" global functions of same name. Only report such warnings for function bodies.
 - Fixed incorrect "overflow" error reported for a bitwise left shift operation, when shifting a byte value by 24 bits.

Script API:
- All existing Color properties now assume full ARGB values (0xAARRGGBB) in 32-bit games. This means that you *must* specify alpha value when assigning a color number directly, otherwise the game will treat the color as fully transparent.
- Added Game.GetColorFromRGBA() function that creates a color number for red, green, blue and alpha combination.
- Added DrawingSurface.BlendMode property that lets define blend mode for primitive drawing operations (line, rectangle, triangle, etc).
- Added DrawingSurface.SetPixel() function that lets to set a pixel value of specified color, disregarding any surface's drawing settings.

Engine:
 - All color settings in a 32-bit game now respect alpha value, meaning they may be translucent. This refers to almost anything that may have a color: texts, GUI backgrounds, DrawingSurface's DrawingColor, and so forth. The exceptions are things that only make sense with opaque color: Tint settings, and screen Fade effects.
 - Fixed Type.GetByName() functions not working again.
 - Fixed loss of precision in sprite rotation, which could cause rotating sprites by a multiple of 90 degrees to cause unexpected shifts of an image by few pixels (regression in 4.0 Alpha).
 - Fixed 32-bit images loaded with DynamicSprite.CreateFromFile() becoming completely transparent (regression since previous 4.0 Alphas).
 - Fixed GUI not redrawing properly by software renderer.



This update is likely the last change to the color format. I wish it was done altogether from the start, but somehow the changes were split into multiple updates, where one update made it proper 32-bit color but without alpha, and this update finally makes AGS respect alpha component as well.

If you're upgrading an older project, you need to know that:
- Color properties in the editor are supposed to update automatically.
- In script, if you were using Game.GetColorFromRGB when assigning colors, then no changes are necessary.
- But if you were assigning color numbers directly, then you will have to fix them all to the ARGB format: either use Game.GetColorFromRGB, or change to a number that has ARGB encoded. The easiest way to do the latter is to write color in hexadecimal notation (some graphic editors let you display colors like that): that is - 0xAARRGGBB; for example: 0xFF000000 is a opaque black, 0xFFFF0000 is a opaque red, 0x8000FF00 is a half-translucent green, and so forth. Note that if you're writing colors as a raw number, then you must define opacity (alpha) value, there's no way around it, except using Game.GetColorFromRGB that automatically makes opaque color. If you forget alpha, then your color will be treated as transparent.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: brushfe on Sat 25/01/2025 18:21:39
Hi! Thank you for the new update!

Entirely out of curiosity, is there a reason for some of the colour features being ordered RGBA, and others in ARGB? And is that purely on the backend, or will we using both formats at different times in the 4.0 editor?

Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Crimson Wizard on Sat 25/01/2025 18:40:56
Quote from: brushfe on Sat 25/01/2025 18:21:39Entirely out of curiosity, is there a reason for some of the colour features being ordered RGBA, and others in ARGB? And is that purely on the backend, or will we using both formats at different times in the 4.0 editor?

It's ARGB when typed as a number in the script for two reasons:
- because then it matches internal representation in the engine, so less data to convert and less hassle.
- because then it's possible to cast between RGB and ARGB by a simple assignment and adding alpha with bitwise OR, e.g. "int argb = rgb | 0xFF000000". If it were RGBA, then extra conversion would be required in such case.


On another hand, it's made RGBA when you type the color in the properties in the editor, in a string like "128;64;64;255". This is made so to let Alpha be optional, in which case it's reduced to 3 numbers ("128;64;64"). If alpha were first, then it would have to be made obligatory. This is done for user convenience, in assumption that 99% of colors set this way will be opaque with default alpha of 255.
But since this form is used in GUI only, it may be changed too if found inconvenient, without affecting the game data.

Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: brushfe on Sat 25/01/2025 21:44:59
Awesome, thanks for such a detailed reply! It's great to hear all the details and considerations that go into something as seemingly small as this. I've not seen argb in the software I've used, so this was very educational!

Edit: the rgba default to max opacity definitely feels right!
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Baguettator on Sun 26/01/2025 16:52:25
Hi @Crimson Wizard , I encounter a crash when launching the new version (not my game, but the editor) of AGS 4.0 (I can't launch it, everytime the same crash), here's what's displayed :

https://drive.google.com/file/d/1iNk0P9ZIMU9-EgFXNHexVFDCIpjn6ZWu/view?usp=sharing

What I wanted to verify with the last version of AGS is a bug I found in the previous version : it seems overlays have a problem. I use an overlay when I right click on a button to make it "selected", it's a dynamic sprite where I draw colored lines on a transparent background. When I was on AGS 3.6, it worked perfectly, but since I'm in 4.0, it's a weird thing : the Overlay seems to take for its graphic the last sprite that was created by the game. I managed to see that the overlay takes its graphic as intended, and suddenly I create a dynamicsprite from a file and the overlay takes the same graphic whereas the graphic of the overlay doesn't use the same sprite. The funniest moment was when I wrote "display" functions at soime points to have a look of what's happening, just after the overlay is created I wrote "Display("Oh ?");", so it pauses the game with the message displayed, and I saw the overlay's graphic changed into the graphic of the message (a white square, with black borders, and "Oh ?" written inside !). Really strange...

I'm sorry, I can't develop furthermore nor give a project to test it with my code because I don't have any time right now, but I swear I don't manipulate the same dynamicsprites during the code, all I do is creating a Overlay.Graphical on which I draw something, and it suddenly changes to another sprite that was just created (just like the Display function does).

Take this as a report, I will look deepier in the code if anything is wrong, but I swear in 3.6.1 it was working perfectly, perhaps things changed in overlays in 4.0 and something's broken ?

EDIT : about my overlay problem : it seems things have changed in 4.0, so I added the "true" parameter to clone the overlay's dynamicsprite that's used to make it, because the dynamicsprite was not saved out of the function. By the way, I don't know why sprite 0 was the last dynamicsprite created in script, because sprite 0 is existing in the sprites saved in editor (it's a blank square for me). Perhaps the problem is that overlay's graphic doesn't properly resets to sprite 0 in engine ?
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Crimson Wizard on Sun 26/01/2025 17:03:22
Quote from: Baguettator on Sun 26/01/2025 16:52:25Hi @Crimson Wizard , I encounter a crash when launching the new version (not my game, but the editor) of AGS 4.0 (I can't launch it, everytime the same crash), here's what's displayed :

https://drive.google.com/file/d/1iNk0P9ZIMU9-EgFXNHexVFDCIpjn6ZWu/view?usp=sharing

You need to install a newer VC Redistributable. This is the same case as with the latest 3.6.2 version, but I forgot to mention it here.

Either use installer program, which contains VC Redist, or download and install separately using this link:
https://download.visualstudio.microsoft.com/download/pr/5319f718-2a84-4aff-86be-8dbdefd92ca1/DD1A8BE03398367745A87A5E35BEBDAB00FDAD080CF42AF0C3F20802D08C25D4/VC_redist.x86.exe

Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Crimson Wizard on Sun 26/01/2025 17:15:01
Quote from: Baguettator on Sun 26/01/2025 16:52:25What I wanted to verify with the last version of AGS is a bug I found in the previous version : it seems overlays have a problem. I use an overlay when I right click on a button to make it "selected", it's a dynamic sprite where I draw colored lines on a transparent background. When I was on AGS 3.6, it worked perfectly, but since I'm in 4.0, it's a weird thing : the Overlay seems to take for its graphic the last sprite that was created by the game.

What does "right click to make it selected" mean in terms of script? how is overlay and dynamic sprite declared, how sprite is assigned to overlay? Please give actual details, or better post a script of what you are doing.

Quote from: Baguettator on Sun 26/01/2025 16:52:25By the way, I don't know why sprite 0 was the last dynamicsprite created in script, because sprite 0 is existing in the sprites saved in editor (it's a blank square for me). Perhaps the problem is that overlay's graphic doesn't properly resets to sprite 0 in engine ?

Since v3.6.2 (and in 4,0) Engine no longer reset any objects to sprite 0 when the dynamic sprite is deleted. This was done on purpose, for several reasons.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: eri0o on Sun 26/01/2025 17:50:28
 I think the clone option was removed in ags4 from the graphic overlay create method. If you were using it before you now have to manage keeping the dynamic sprite for the same lifetime as needed for the overlay while it is using it.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Crimson Wizard on Sun 26/01/2025 18:21:14
Quote from: eri0o on Sun 26/01/2025 17:50:28I think the clone option was removed in ags4 from the graphic overlay create method.

It was not removed. I thought about removing it once, but did not do so.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: MrGreen on Tue 28/01/2025 21:45:55
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?
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Crimson Wizard on Tue 28/01/2025 22:03:14
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.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: MrGreen on Thu 30/01/2025 20:07:09
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?
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Crimson Wizard on Fri 31/01/2025 01:53:48
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.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Tarnos12 on Sat 01/02/2025 09:20:23
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!
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Crimson Wizard on Sat 01/02/2025 09:31:28
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.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Tarnos12 on Sun 02/02/2025 15:09:05
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.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Crimson Wizard on Sun 02/02/2025 15:44:10
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.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Tarnos12 on Mon 03/02/2025 10:01:02
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.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: 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.
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Tarnos12 on Mon 03/02/2025 20:00:09
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
Title: Re: AGS 4.0 - Alpha 18 for public test
Post by: Crimson Wizard on Mon 03/02/2025 20:06:06
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.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Sun 16/02/2025 19:19:05
Updated to Alpha 19
(Please use download links in the first post)

Contains all the new features and fixes from 3.6.2 RC1 (https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-3-6-2-beta-1-a-wip-3-6-update/msg636681349/#msg636681349) (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).
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Sat 22/02/2025 22:19:58
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 :

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 ?
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Sat 22/02/2025 23:05:33
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).

Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Sun 23/02/2025 05:59:02
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 :

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.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Sun 23/02/2025 06:26:49
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.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Alan v.Drake on Sun 23/02/2025 10:32:12
This could be the use case for that eBlendReplace which was considered times ago. To simply overwrite destination without any actual blending operation.


- Alan
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Snarky on Sun 23/02/2025 13:31:58
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().
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Mon 24/02/2025 19:26:03
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...
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Mon 24/02/2025 20:50:09
OK, so I think there is a problem in AGS 4.0 ! (last version available).

I just made this game, with a simple code : a GUI with 20 buttons, 2 dynamicsprites arrays with a size of 10 for each.

Ctrl+M creates the dynamicsprites for the two arrays (so 20 dynamicsprites).

Ctrl+N deletes the dynamicsprites of 1 array.

Then, clicking again Ctrl+M makes a weird thing : sometimes, seems random, just the first dynamicsprites is really created (or successfully assigned to the button it should be assigned). But sometimes, they are created as intended, and display correctly.

Let me know if it means something for anyone here ! :)

https://drive.google.com/file/d/1H3Zx3ogYxpGpZRk3VG0rZ7B53sI862RN/view?usp=drive_link
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Mon 24/02/2025 22:01:02
Quote from: Baguettator on Mon 24/02/2025 20:50:09https://drive.google.com/file/d/1H3Zx3ogYxpGpZRk3VG0rZ7B53sI862RN/view?usp=drive_link

Can you please post a SCRIPT, so that I knew what am I testing?
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Tue 25/02/2025 06:05:13
Oh, sorry, I posted the compiled game instead of the game project ! Here it is !

https://drive.google.com/file/d/14JS00QH53-ZVhzpP77eylpqVlzpkXXiN/view?usp=drive_link
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Tue 25/02/2025 08:17:20
Okay, I can confirm that this mistake is present since AGS 3.6.1.
Possibly this is because the Buttons are not redrawn if the recreated image number is the same as was on them earlier, because it cannot recognize that it is a different image. Although I cannot explain why the first button gets redrawn, maybe there's some accident.

Normally you are supposed to also set another NormalGraphic when you delete a dynamic sprite that was on a button.
Adding
Code (ags) Select
gGui1.Controls[i+10].AsButton.NormalGraphic=0;
after the dynamic sprite is deleted will solve this problem.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Tue 25/02/2025 08:34:37
Yes but in the manual, it says that deleting a dynamicsprite that was given to an object (guicontrol etc...) resets its graphic to 0 to avoid problems. So it should be managed by the engine ?
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Tue 25/02/2025 09:14:26
Quote from: Baguettator on Tue 25/02/2025 08:34:37Yes but in the manual, it says that deleting a dynamicsprite that was given to an object (guicontrol etc...) resets its graphic to 0 to avoid problems. So it should be managed by the engine ?

This is an outdated information, it no longer changes to 0 since v3.6.1. The properties keep their value, and it's up to the user to fix them. Engine only ensures that the game will not crash if told to draw an object with missing sprite.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Tue 25/02/2025 11:57:12
Hmm OK, so it's not intended anymore that if I delete the dynamicsprite of a button, its graphic property will be reset to 0 ? It will remain like that for the future versions of AGS ?
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Tue 25/02/2025 12:36:53
Quote from: Baguettator on Tue 25/02/2025 11:57:12Hmm OK, so it's not intended anymore that if I delete the dynamicsprite of a button, its graphic property will be reset to 0 ? It will remain like that for the future versions of AGS ?

Yes, it's intended now to keep exact value that you've assigned.

This is unrelated to the existing problem though, as the engine must still properly redraw an object if a new sprite was created and assigned, regardless of what was assigned earlier.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Tue 25/02/2025 13:38:26
Well something is confusing me.

If I create a button in the editor and let its graphic property to 0, it will have the grey color, even if I launch the game.

If in script, I make button.NormalGraphic=0, it will have the sprite 0 as its graphic, and for me, it's the blue cup from AGS. I can't delete that sprite, but the problem is that it will resize the button.

My script wants to automatically give a sprite for buttons that will have the same background, but not necessarily the same size. So I use dynamicsprites to create them, and give them to the buttons. To optimize my game, I just create the sprites I need (so not the same if I'm in room 1 or in room 2). And so I know that if I let a button without any graphic in the editor (grey square by default), it will be given a sprite when I launch the game. So I have a buttons array "A" to store the buttons that need a sprite if I'm in room 1, and another array "B" to store the buttons that need a sprite if I'm in room 2.

The problem is that I want to give button.NormalGraphic=0 for buttons that don't need a sprite (the array A when in room 2, or the array B in room 1). I thought it would be very useful to make them grey squares as they were when game_start, without changing their size. But the game always change their size because it gives them the bluecup sprite...

I'm sorry if it seems a bit like a "technical problem thread", but I'm just asking here because it could lead to something changing in the engine. I think it could be very good to be able to make buttons' graphics with the grey color as in the editor. At least, make the sprite number 0 something else than a real sprite. Like just a transparent surface with the same width and height than the button. It would make 1 sprite less to have in memory for the game... :D

Am I talking about something weird..? Let me know !
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Tue 25/02/2025 13:39:55
Quote from: Baguettator on Tue 25/02/2025 13:38:26If in script, I make button.NormalGraphic=0, it will have the sprite 0 as its graphic, and for me, it's the blue cup from AGS.

That is wrong, it should display a regular grey button instead. Also it should not resize.

EDIT: I tested this, and it seems to make them ordinary grey buttons, but resizes to a size of real sprite 0.
This behavior exists for a very long time. I tested down to AGS 3.6.0, but maybe it was there earlier.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Tue 25/02/2025 13:42:37
OK, so there is a problem for me. I have, in my sprites, the original bluecup (the one from the game template) as the sprite number 0. I can't delete it (it's unclickable when I right-click on it). Is it normal ?
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Tue 25/02/2025 13:49:14
Double-post just to signal the result of my testing : at game start, buttons with 0 are grey squares, with their correct width and height. IF I change them after in the scripts, they become grey squares, but their size is changed to the sprite number 0's width and height ! For me, bluecup is width 10 and height 6. So very small !

Is it possible to change something in the engine to avoid changing the size ?
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Tue 25/02/2025 13:55:14
Quote from: Baguettator on Tue 25/02/2025 13:42:37OK, so there is a problem for me. I have, in my sprites, the original bluecup (the one from the game template) as the sprite number 0. I can't delete it (it's unclickable when I right-click on it). Is it normal ?

Are you asking if it's normal that you cannot delete sprite 0? If so, then yes it's normal, because sprite 0 is used as a safety placeholder when the engine is told to draw any non-existing sprite.

Quote from: Baguettator on Tue 25/02/2025 13:42:37Is it possible to change something in the engine to avoid changing the size ?

That is a mistake and must be fixed.
From what I can tell, this is a very old bug which existed for many years.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Tue 25/02/2025 13:58:25
Quote from: Crimson Wizard on Tue 25/02/2025 13:55:14Are you asking if it's normal that you cannot delete sprite 0? If so, then yes it's normal, because sprite 0 is used as a safety placeholder when the engine is told to draw any non-existing sprite.

Yes, so no problem, I won't delete it :)

Quote from: Crimson Wizard on Tue 25/02/2025 13:55:14Is it possible to change something in the engine to avoid changing the size ?

That is a mistake and must be fixed.

Perfect !! So many hours I tried to find what wasn't working, I'm happy that it was from the engine. Thanks for helping ! I wait for the next update to see if anything is working !
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Tue 25/02/2025 17:00:22
Temp build for download:
https://cirrus-ci.com/task/5264924911337472

Fixed:
- Dynamic sprites not appearing on buttons after deleting and creating again.
- Buttons resized when assigning NormalGraphic = 0
- AudioChannel.PositionMs not telling real position right after calling PlayFrom() (this was reported for 3.6.2, but applies here too).
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Tue 25/02/2025 17:15:01
Works perfectly for me ! Thanks !
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Wed 26/02/2025 11:59:52
I just got crashes each time I use the SaveGameSlot. For testing, I just used SaveGameSlot(1, "try"), and it crashes.

Here is the crash log :

https://drive.google.com/file/d/12ITmPlSQgarTUPnB3DvXWBJcD2Bt6fxA/view?usp=drive_link

The error message displays :
Illegal exception
An exception 0xC0000094 occurred in ACWIN.EXE at EIP = 0x004307E6; program pointer is +5, engine version 4.0.0.15, gtags (0,0)
AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and contact the game author for support or post these details on the AGS Technical Forum.

I don't know if it's a bug or something wrong in my game ? I got no issue before...
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Wed 26/02/2025 12:34:36
Quote from: Baguettator on Wed 26/02/2025 11:59:52I just got crashes each time I use the SaveGameSlot. For testing, I just used SaveGameSlot(1, "try"), and it crashes.

Here is the crash log :

https://drive.google.com/file/d/12ITmPlSQgarTUPnB3DvXWBJcD2Bt6fxA/view?usp=drive_link

This does not happen in a dummy game, so there have to be conditions under which this occurs.

The exception message like that means a mistake in the engine. 0xC0000094 specifically means "division by zero".

I cannot read the crash dump without the game exe which crashed, but also I would need to know which exact engine did you use, because I would need to use exact matching debug symbols for this.

Another variant for me is to have the crashing game (compiled game file) so that I could run it under debugger.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Wed 26/02/2025 14:19:37
OK, I will finish what I'm working on, will test again the savegameslot function in a newly compiled game, and if it crashes, I'll send you the compiled game with the crash dump ! I'm currently using the last build you sent me, the one with the fixes for buttons graphics and dynamicsprites problems.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Thu 27/02/2025 09:26:21
So, here it is. The message when the crash occurs :

**********************
An exception 0xC0000094 occurred in ACWIN.EXE at EIP = 0x004307E6; program pointer is +5, engine version 4.0.0.15, gtags (0,0)

**********************

And here the compiled game. I made it with the temp build you posted just before (with dynamicsprites fix). The CrashLog is inside. If you want to reproduce it quickly launch the game and when the menu appears, press Ctrl+N. The code is :

SaveGameSlot(1, "try");
Display("fait !");

The crash occurs after I click or press a key to exit the display function. Until that, the crash doesn't occur (don't know why, maybe because SaveGameSlot works at the end of the script..?).

https://drive.google.com/file/d/1VJHiVDGWGeNZVHdjKEu7njZaRNQEYcMG/view?usp=sharing

Do you need anything else ? I hope it will help ! I had no issue when saving with 3.6.1 (and perhaps when I started using AGS 4.0, but I don't remember which version it was)
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Thu 27/02/2025 09:31:22
Quote from: Baguettator on Thu 27/02/2025 09:26:21The crash occurs after I click or press a key to exit the display function. Until that, the crash doesn't occur (don't know why, maybe because SaveGameSlot works at the end of the script..?).

Indeed, saving is done after the end of the script, because AGS cannot save inside a script function.

I will try the build...
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Thu 27/02/2025 10:40:28
Quote from: Baguettator on Thu 27/02/2025 09:26:21The crash occurs after I click or press a key to exit the display function. Until that, the crash doesn't occur (don't know why, maybe because SaveGameSlot works at the end of the script..?).

https://drive.google.com/file/d/1VJHiVDGWGeNZVHdjKEu7njZaRNQEYcMG/view?usp=sharing

I found this happens if you have zero-length dynamic arrays in script.
The fixed engine build will be available here:
https://cirrus-ci.com/task/6628039687143424
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Thu 27/02/2025 12:39:31
Hi, I just tried to save/load with the new version, and I got a crash again. It seems something linked to the engine, and not something linked to my code.

An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x00572656; program pointer is +6, engine version 4.0.0.15, gtags (0,0)

Here is the updated compiled game, with the crash log inside.

https://drive.google.com/file/d/174ekAxu5V3ci3FdxvMUdbWUBGJUOPODh/view?usp=drive_link

You can try the same Ctrl+N to make save called "try", and load it by clicking on the "CHARGER" button you can see in the menu.

The ONLY thing that has changed is that I used that at game_start :

SetGameOption(OPT_SAVECOMPONENTSIGNORE, eSaveCmp_Audio + eSaveCmp_Dialogs + eSaveCmp_GUI + eSaveCmp_DynamicSprites + eSaveCmp_Plugins + eSaveCmp_Cursors + eSaveCmp_Views);

If I disable this function, the loading doesn't crash.

Let me know if you find something !
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Thu 27/02/2025 13:32:23
Quote from: Baguettator on Thu 27/02/2025 12:39:31Hi, I just tried to save/load with the new version, and I got a crash again. It seems something linked to the engine, and not something linked to my code.



The ONLY thing that has changed is that I used that at game_start :

SetGameOption(OPT_SAVECOMPONENTSIGNORE, eSaveCmp_Audio + eSaveCmp_Dialogs + eSaveCmp_GUI + eSaveCmp_DynamicSprites + eSaveCmp_Plugins + eSaveCmp_Cursors + eSaveCmp_Views);


This is happening because when restoring a game without dynamic sprites, all DynamicSprite objects in script are invalidated and assigned "Graphic" to -1. You should clean them up to null after restoring a save, or recreate (if that's suitable).

The crash itself occurs when script is trying to get some property from a invalid dynamic sprite (Width or Height).
Of course the engine must not crash like that. I forgot to add safety checks in the engine to prevent this from happening, so must do that now.

EDIT:
Actually, I found that I made the "invalidation" wrong. When the DynamicSprite is deleted (by calling Delete) it assigns Graphic to 0, which is a "safe placeholder". So I might just do the same for consistency.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Thu 27/02/2025 13:41:38
OK, that's what I thought about. I'm currently bugtracking that.

What I'm currently doing is rebuilding the dynamicsprites in the "on_event" function with the restore_game argument. I presume that when you will fix it, if objects hadn't got their dynamicsprite on resume_game, their graphic property will be set to 0 ?
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Thu 27/02/2025 13:47:37
So, after fixing this in the engine, the game does not crash in the same place, but it errors later with a script error, because it tries to do something with "deleted" dynamic sprites. So the script has to be fixed in any case.

Here's a fixed engine, I built and uploaded it directly to dropbox this time to speed things up:
https://www.dropbox.com/scl/fi/eh2fa6kvow838hu0pfnxs/acwin-4.0.0.15-saverestorefixes.zip?rlkey=yctz3kdyk7oaazzu68ce1fybn&st=vmvod30f&dl=0

Quote from: Baguettator on Thu 27/02/2025 13:41:38What I'm currently doing is rebuilding the dynamicsprites in the "on_event" function with the restore_game argument. I presume that when you will fix it, if objects hadn't got their dynamicsprite on resume_game, their graphic property will be set to 0 ?
No, the other objects are not changed. Only DynamicSprites are invalidated, marked as "deleted".

I don't know if that's correct to recreate all the dynamic sprites on restoring a game. I would restore only those that are required for the current scene.
But then, in a tabletop simulator like your game I would use a custom save system anyway. That would prevent such problems completely.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Thu 27/02/2025 17:47:24
Thanks Crimson !

My question was : if I don't save the dynamicsprites, is it correct to rebuild them (all the needed ones of course) in the on_event function with the "restore_game" argument ?

For me it's important to save all the variables, because they are a LOT in my game (it's not only placing tokens there and there), and I think AGS is doing that better and faster than I would do with script. And moreover, it's not needed if AGS already can do it. The thing is just I don't want 300Mo save files, so I exclude everything that's not needed, especially dynamicsprites. I'm just thinking of what's the right timing to rebuild them, and I thought on_restore_game should be the good one.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Thu 27/02/2025 18:00:46
Quote from: Baguettator on Thu 27/02/2025 17:47:24My question was : if I don't save the dynamicsprites, is it correct to rebuild them (all the needed ones of course) in the on_event function with the "restore_game" argument ?

I suppose that on_event with eEventRestoreGame is a proper place.

Quote from: Baguettator on Thu 27/02/2025 17:47:24For me it's important to save all the variables, because they are a LOT in my game (it's not only placing tokens there and there), and I think AGS is doing that better and faster than I would do with script. And moreover, it's not needed if AGS already can do it.

I don't have a full knowledge of your project, but I doubt you need to save all of them, judging by my own experience. There are likely ones that you don't need to save/restore. It's all about dividing the game into what is a "mission state" and what is not. It's also quite possible that having custom save system will make managing resources like DynamicSprites easier, since they will not be invalidated by restoring a save.

Anyway, this is a big separate topic, and I won't go there further. I just think that it's a mistake to rely on AGS save system if this is not a standard adventure game.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Fri 28/02/2025 08:32:41
At least, I'm improving my game with the new features that allow to exclude many no needed things into the savegames. It's the first step, and little by little, I will see if it's more convenient to make a real custom save system. Thanks for the suggestion :)

I thought about something to suggest, for AGS4.0, if it's not already implemented (perhaps I ignore it !), but it could be a quality of life feature to allow excluding some strings to be added into the translation files. I don't know if it's a nice feature, but I know that debugging strings, or many strings that sometimes don't need to be translated (like characters' names) don't need to be in the translation file, and it could lower their size a bit or a lot.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Fri 28/02/2025 13:19:39
@Alan v.Drake , @Snarky , in regards to drawing transparent color on DrawingSurface,
I implemented 3 new blend modes: Copy, CopyRGB and CopyAlpha:
https://github.com/adventuregamestudio/ags/pull/2695

I've also been considering Snarky's suggestion about having a DrawingSurface.Clear* function pairing each Draw* function, but decided to postpone this and see if it works with BlendModes. Adding the functions is possible, but we'd have to add one for each operation, and keep adding these for each new drawing method in the future, which seems mildly annoying.

Plus I found another use for "Copy" blend modes: complementing/replacing CopyTransparencyMask function, and also cutting holes in GUIs with blended controls, which might allow more hardware accelerated tricks (see PRs description for details).
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Fri 28/02/2025 16:27:03
@Baguettator , this is an experimental build, which adds a new way to draw transparent geometry on DrawingSurface:
https://cirrus-ci.com/task/4560032798343168

if you'd like to test this out,
it requires to set a BlendMode property for this, like:
Code (ags) Select
ds.DrawingColor = COLOR_TRANSPARENT;
ds.BlendMode = eBlendCopy;
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: zoeytrope on Sat 01/03/2025 15:20:23
Hi! Hopefully I'm doing this the right way.

Since update 19 (including the updated versions posted here), I've been having issues with dialog scripting, and I'm unsure if this is a bug or a scripting change since update 18.

Whenever you start a dialog (eg. dDialog1.Start()), it only runs the dialog script with ID 0 instead of correct dialog script. Also, instead of responding to "stop", "goto-dialog dDialog2", etc., it returns to start of dialog script with ID 0.

So basically if you start any dialog, it runs the script with ID 0, and loops that script with no way to exit.

Thanks, and apologies in advance if I simply missed something really silly!

Sample project to illustrate: https://drive.google.com/file/d/1HjBseBUYzGSYRTrR0MkjO4ds54Aw0D1q/view?usp=sharing
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Sat 01/03/2025 18:26:07
@zoeytrope there was a bug which caused engine to discard any script function return value.

A fixed build may be downloaded here
https://cirrus-ci.com/task/5294271038750720
(it will be ready in ~30 mins after me posting this)
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Mon 03/03/2025 19:30:50
A demo of what's coming in the next AGS 4 update:
An example of Button having a BlendMode "CopyAlpha", moving across GUI:

(https://i.imgur.com/Hz5AuKa.gif)

Previously this would require to do a mix of operations over dynamic sprite, with the use of CopyTransparencyMask function.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Mon 03/03/2025 21:03:59
Really nice feature, congrats Crimson Wizard ! I'm unable to test it right now because I want to fix things in my game before updating AGS, but it's really beautiful !
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Wed 05/03/2025 08:50:17
I forgot to post this, this is a new temp build which contains these new modes, in case somebody wants to try:
https://cirrus-ci.com/task/6640724495564800

This build brings back an ability to draw transparency to drawing surface by replacing pixels.
This is done by setting "DrawingSurface.BlendMode = eBlendCopy", which will copy the color to destination instead of merging with the underlying color.

There are also 2 accompanying modes: eBlendCopyRGB and eBlendCopyAlpha, which copy either only RGB part but keep surface alpha, or copy only Alpha but keep surface color. These may be used, for example, to make part of the surface half-translucent while keeping its current image, or vice versa recolor part of the surface while keeping its translucency.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Thu 06/03/2025 04:54:00
OK, perfect !

Now, it's only missing gradient implementation :D
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Thu 06/03/2025 05:33:36
Quote from: Baguettator on Thu 06/03/2025 04:54:00Now, it's only missing gradient implementation

What is that?
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Baguettator on Thu 06/03/2025 23:22:12
I'm not sure if it's the right word, but by "gradient" I think about "dégradé" in french. Like a slow transition from a colour to another one. AGS could need this kind of feature ;) (but could be tricky to implement, I don't know !)

Anyway, I think there's a problem with the FadeIn function. I used it for debugging purpose (to be able to see the "display" function during a room transition, because my transition is fadein/fadeout, so I placed a "fadeIn" function during the "room_onload" function), and just after the fadeIn, my mouse is not visible at all. Is it an engine bug ? Sorry, I can't give more details or try on a dummy game at that moment, I'm just sharing the info now.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Fri 07/03/2025 00:59:14
Quote from: Baguettator on Thu 06/03/2025 23:22:12I'm not sure if it's the right word, but by "gradient" I think about "dégradé" in french. Like a slow transition from a colour to another one. AGS could need this kind of feature ;) (but could be tricky to implement, I don't know !)

That is trivial to do in script, just make a for loop from one color to another, and draw lines.

Quote from: Baguettator on Thu 06/03/2025 23:22:12Anyway, I think there's a problem with the FadeIn function. I used it for debugging purpose (to be able to see the "display" function during a room transition, because my transition is fadein/fadeout, so I placed a "fadeIn" function during the "room_onload" function), and just after the fadeIn, my mouse is not visible at all.

"room load" event is not suited for any animations, because room is not supposed to be displayed at that time. Any animations, including screen effects, custom transitions and on screen messages should be done in "after fade in".
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Marion on Sat 08/03/2025 07:06:22
Hello ! Sorry if this problem has been reported before.
It seems I can't start a dialog from another dialog.
When I start a dialog, all the options work fine, except the one that is supposed to start another dialog. When I choose this option, nothing happens.


// Dialog script file
@S  // Dialog startup entry point
return
@1
return
@2
 player.Neutre();
 cJoueur.Think("I will rest here for a little time.");
 player.Idle();
 FadeOut(5);
 aSave.Play();   Wait(40);  energie=energie+10;
 FadeIn(5);
 player.Joie();
 cJoueur.Think("I feel better.");
 player.Idle();
stop
@3
 dAmeliorerMaisonniveau2.Start();
stop
@4
stop


The @3 option doesn't start the dialog, it just makes the dialog stops.But the @2 works fine.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Sat 08/03/2025 12:19:35
@Marion , haven't you already asked this question?
https://www.adventuregamestudio.co.uk/forums/advanced-technical-forum/ags-won-t-launch-the-correct-dialog/

There was a bug in the latest version of AGS 4, and it's fixed, but the new version is not released yet.
You will have to download a temporary version that contains this fix.
Here's the latest update on our build server:
https://cirrus-ci.com/task/6688808776761344

Scroll down and choose to download either as an installer or archive.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Marion on Sat 08/03/2025 12:40:21
No, it's not the same problem. My previous question was about AGS always starting the dialog 0. In this problem, it doesn't start the dialog at all when it's coded from inside another dialog.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Sat 08/03/2025 12:51:01
Quote from: Marion on Sat 08/03/2025 12:40:21No, it's not the same problem. My previous question was about AGS always starting the dialog 0. In this problem, it doesn't start the dialog at all when it's coded from inside another dialog.

I see, I haven't fixed this problem to the end, I will look into this soon.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Marion on Sat 08/03/2025 12:58:26
Thank you :)
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Sat 08/03/2025 13:27:00
@Marion

Note that in dialogs you don't have to use Dialog.Start command, you can do this instead:

Code (ags) Select
@3
goto-dialog dAmeliorerMaisonniveau2

That seems to work in this version.
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Marion on Sat 08/03/2025 13:44:29
Great ! Thank you !! :)
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Crimson Wizard on Sat 08/03/2025 18:44:26
A build with fixed Dialog.Start and StopDialog in dialog scripts:
https://cirrus-ci.com/task/4778145221443584
Title: Re: AGS 4.0 - Alpha 19 for public test
Post by: Marion on Sat 08/03/2025 20:52:42
Yay !!
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Mon 17/03/2025 01:11:57
Updated to Alpha 20
(Please use download links in the first post)

This is a quite a big update, containing several new scripting features at once. Unfortunately, I was not able to test this extensively, being busy fixing 3.6.2... this does not mean that I did not test at all, but maybe I did not test much enough. If there any new bugs found, I shall make temporary updates as been doing previously.


This update contains all the new features and fixes from 3.6.2 RC2 (https://www.adventuregamestudio.co.uk/forums/index.php?msg=636682240) (excepts ones related to backwards compatibility).


Own changes:

Editor:
- Added BlendMode and Transparency property for GUI Controls.

Scripting:
- Support for dynamic pointer cast: use syntax "pointer as Type" to cast the pointer to either a parent or child type (upcast and downcast respectively).

Script API:
- Added Touch and TouchPointer structs, meant to handle touch controls in script.
- Added MotionPath struct, which lets to read existing game object's motion plan, or create your own and use it as a reference when moving a custom object.
- Added GUIControl.BlendMode property that lets to select BlendMode for any GUI control.
- Added new Blend Modes: eBlendCopy, eBlendCopyRGB and eBlendCopyAlpha.
- Added Character.MotionPath and Object.MotionPath properties that let to get active character's or object's movement plan.
- Added Math.Random(), Math.RandomFloat() and Math.Round() functions.
- Added eRoundTowardsZero and eRoundAwayFromZero rounding styles for use in FloatToInt() and Math.Round() functions.

Engine:
- Support touch input directly, without touch-to-mouse emulation.
- Fixes launching games compiled in Release mode.
- Fixed restoring game saves which contain zero-length dynamic array.
- Fixed goto-dialog and stop commands in dialog script always returning to dialog 0.
- Fixed Dialog.Start() and StopDialog() failing to work in dialog script.



First, the new touch API, it's briefly explained in this topic (with a small demo game):
https://www.adventuregamestudio.co.uk/forums/engine-development/ags-4-touch-input-api/

From now on you no longer have to emulate mouse clicks on touch devices, and may script your game with exclusive controls for touch events. (Although touch-to-mouse emulation is still available as a backup option.)



Dynamic pointer cast finally allows you to cast down from a base pointer to a child pointer.
This feature uses classic C# syntax "pointer as Type". For example:
Code (ags) Select
managed struct Parent {
    int a;
};

managed struct Child extends Parent {
    int b;
}

function game_start() {
    Parent* p1 = new Parent; // create instance of Parent type
    Parent* p2 = new Child; // create instance of Child type

    Child* test_child1 = p1 as Child; // fails, results in null pointer
    Child* test_child2 = p2 as Child; // succeeds, results in a valid pointer
}

This generic syntax also supercedes existing GUI control properties like AsButton, AsLabel etc.
Following two lines, although use different internal mechanism, are supposed to have same results:
Code (ags) Select
Button* btn1 = control.AsButton;
Button* btn2 = control as Button;

NOTE: this feature works with both built-in engine types, and user types declared in script.
It also potentially works with plugins, but only if they are registering the script types correctly; which may not be always the case. In the worst case "as N" done with plugin types will simply return null pointer. Plugins which have this problem may be fixed for AGS 4 though.



New Blend Modes eBlendCopy, eBlendCopyRGB and eBlendCopyAlpha copy color to the destination surface, only RGB part of the color, or only alpha part of the color.
eBlendCopy mode can be used to directly replace pixels on DrawingSurface, and is meant to be used with COLOR_TRANSPARENT and when you want to make surface translucent in some places.
eBlendCopyAlpha is an equivalent of DynamicSprite.CopyTransparencyMask.
eBlendCopyRGB is for when you have a half-translucent surface already and you want to only change RGB color in its pixels, but not transparency level.

There's another application for these modes. If there's a "combined object" with child parts, where the child parts are first drawn over their parent before parent drawn to screen, then these modes could be applied to the child objects to achieve interesting effects, like cutting holes in the parent.
Unfortunately, at the time of writing this, the only real case where this will work is GUI. That's because of how rendering works. If you apply eBlendCopyAlpha to a character, then it will make holes not in other objects below, but in the final game view, so you will "see through" the game into the underlying black screen. Maybe we'll have more opportunities to use this effect with the rest of game objects in the future.

Here's an example of using eBlendCopyAlpha with Button control on GUI:
Spoiler
(https://i.imgur.com/Hz5AuKa.gif)
[close]



Finally, MotionPath struct in script is complementing new pathfinding API, which was added earlier.
There are two uses of this struct.
1. You can get it from a moving Character or Room Object, and read their moving plan and current state.
2. You can create custom MotionPath using its Create methods, and use as a reference to move custom objects.
Right now this struct only supports typical linear movement that AGS uses when walking a character or moving a room object. Maybe AGS will support more sorts of movements in the future versions (e.g. using splines or slerp techniques).
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Eon_Star on Mon 17/03/2025 17:51:06
Hi,

I just created a new game with the 4.0 Patch 20.
I get this error:

(https://img.itch.zone/aW1nLzIwMzE3MTQ3LnBuZw==/original/5BBw14.png)

Thanks
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Mon 17/03/2025 17:59:34
Quote from: Eon_Star on Mon 17/03/2025 17:51:06I just created a new game with the 4.0 Patch 20.
I get this error:

Please note that you can right click on a output panel and select "copy all" then paste the error text directly, without having to make a screenshot.

In regards to this error, from the looks of it it seems like the "gActionBar" GUI have generated a ACTIONBAR constant that has non-latin capital I with a dot (probably from a Turkish alphabet)?
I am not sure how that could have happened.
Does the same happen in the previous versions, like 3.6.2 or 3.6.1?
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Mon 17/03/2025 18:28:11
@Eon_Star, please try downloading this archive and copy the files into AGS 4 editor's program folder:
https://www.dropbox.com/scl/fi/mxqzjef9izvle9q9dpwp5/AGSEditor-4.0.0.16-fixscriptnameuppercase.zip?rlkey=xoep48uhuq9ugfhfampaxbu6t&st=lxf7hiik&dl=0

and see if that fixes the problem.
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Eon_Star on Mon 17/03/2025 18:43:03
Quote from: Crimson Wizard on Mon 17/03/2025 17:59:34
Quote from: Eon_Star on Mon 17/03/2025 17:51:06I just created a new game with the 4.0 Patch 20.
I get this error:

Please note that you can right click on a output panel and select "copy all" then paste the error text directly, without having to make a screenshot.

In regards to this error, from the looks of it it seems like the "gActionBar" GUI have generated a ACTIONBAR constant that has non-latin capital I with a dot (probably from a Turkish alphabet)?
I am not sure how that could have happened.
Does the same happen in the previous versions, like 3.6.2 or 3.6.1?


Yes. Happens with 3.6.1 and upper versions. I am using 3.6.0 P1 right now.


PS:

The patch worked. I will try to open older game files made with 3.6.1.

New problem:

Failed to save room room5.crm; details below
Rooms\5\room5.asc(41): Error (line 41): Undefined token 'RemoveWalkableArea'
Room room1.crm was saved, but there were warnings; details below
Room 1: Hotspot (0) hHotspot0's event Look function "hHotspot0_Look" not found in script Rooms\1\room1.asc.
Room 1: Hotspot (0) hHotspot0's event Interact function "hHotspot0_Interact" not found in script Rooms\1\room1.asc.
Room 1: Region (2) Region2's event WalksOnto function "region2_WalksOnto" not found in script Rooms\1\room1.asc.


Can you help?



Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Tue 18/03/2025 05:06:34
Quote from: Eon_Star on Mon 17/03/2025 18:43:03Rooms\5\room5.asc(41): Error (line 41): Undefined token 'RemoveWalkableArea'

RemoveWalkableArea is deprecated, but iirc may be turned back if you use "Script compatibility level" to "3.99.x Alpha". The new command is Room.WalkableAreas[n].Enabled.

Some information about new WalkableArea struct may be found here in this post:
https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-4-0-early-alpha-for-public-test/msg636661199/#msg636661199

We currently have an issue with how the manual is made, it prevents me from adding AGS 4 changes.
I might try to create a cheat-sheet for AGS 4 as a temporary measure.

Quote from: Eon_Star on Mon 17/03/2025 18:43:03Room room1.crm was saved, but there were warnings; details below
Room 1: Hotspot (0) hHotspot0's event Look function "hHotspot0_Look" not found in script Rooms\1\room1.asc.
Room 1: Hotspot (0) hHotspot0's event Interact function "hHotspot0_Interact" not found in script Rooms\1\room1.asc.
Room 1: Region (2) Region2's event WalksOnto function "region2_WalksOnto" not found in script Rooms\1\room1.asc.

These warnings mean that you have event functions inserted into the hotspot's event table, but not present in the script.
We added these warnings since 3.6.2 to let users know that they have events desynced with the script.
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Eon_Star on Tue 18/03/2025 10:32:07
I will try again and report if there are other issues.

Thanks.
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Eon_Star on Tue 18/03/2025 10:49:46
Hi,

another error occured. Script issuse from the A.S.S. Module:

(https://img.itch.zone/aW1hZ2UvMzQwMzg0Ni8yMDMyNjIzNC5wbmc=/original/J9Hby%2F.png)
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Tue 18/03/2025 11:56:36
Quote from: Eon_Star on Tue 18/03/2025 10:49:46another error occured. Script issuse from the A.S.S. Module:

"savegameindex" is an ancient variable that was deprecated since AGS 2.72. It is no longer available in AGS 4.

The proper way is to use ListBox.SaveGameSlots instead:
Code (ags) Select
lstLoadGames.SaveGameSlots[saveslot];


Note that we have a table of obsolete commands and variables, with their replacements:
https://adventuregamestudio.github.io/ags-manual/ObsoleteScriptAPI.html
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: arj0n on Sun 30/03/2025 03:38:27
Great job on 4.0, team!  :-*

Question:

I'm using AGS Editor .NET 32-bit (Build 4.00.00.15)
When I set the general settings option 'enable debug mode' to false, compile and run the game, it 'crashes' showing the following error msg popup:


Loading game failed with error:
There was error reading game data extensions.
Unknown extension.
Type: id:1.
The game files may be incomplete, corrupt or from unsupported version of AGS.


When I set the general settings option 'enable debug mode' back to true, compile and run the game, it runs fine again.

Am I overlooking something when turning debug off?
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Sun 30/03/2025 05:48:32
@arj0n there was a bug in the engine , a temporary fixed version may be downloaded here:
https://cirrus-ci.com/task/4805609725362176
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: arj0n on Sun 30/03/2025 19:52:27
Great, thank you for the quick repley.
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Baguettator on Tue 08/04/2025 06:21:38
Hi !

I'm trying the new multidimmensionnal arrays system, but I encounter an error when building the game.

Here how I proceeded :

.asc script :
int ressource[TOTAL_RESSOURCES, TOTAL_CATEGORIES_RESSOURCES];
[...]
export ressource;

.ash script :
import int ressource[TOTAL_RESSOURCES, TOTAL_CATEGORIES_RESSOURCES];

It's telling "expecting ]" for the line in ash script.

Any idea ?
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Tue 08/04/2025 12:46:36
Quote from: Baguettator on Tue 08/04/2025 06:21:38Hi !

I'm trying the new multidimmensionnal arrays system, but I encounter an error when building the game.

Please double check that you are using the new script compiler, it's selected in General Settings -> Compiler -> Script compiler.
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Baguettator on Tue 08/04/2025 16:19:05
Oh, thanks, I didn't enable it, I thought it was enabled by default !

I got an error when v4 compiler is activated, and I don't understand what it means :

"Struct_Personnage.ash(97): Return type of 'Personnage::set_Mort' is declared as 'bool' here, as 'void' elsewhere. See line 85"

Here is a part of my script (inside the struct "Personnage"), I indicated the lines mentioned in the error message :

import attribute int Blessure, Maladie, Zombivant, Infecte; // L'usage de ces variables est protégé par la struct
  protected int blessure, maladie, zombivant, infecte;
  import attribute bool Mort; // => THIS IS LINE 85
  protected bool mort;
  // les fonctions suivantes sont internes à la struct, elles ne peuvent pas être appeler directement
  import int get_Blessure(); // $AUTOCOMPLETESTATICONLY$
  import void set_Blessure(int _blessure); // $AUTOCOMPLETESTATICONLY$
  import int get_Maladie(); // $AUTOCOMPLETESTATICONLY$
  import void set_Maladie(int _maladie); // $AUTOCOMPLETESTATICONLY$
  import int get_Infecte(); // $AUTOCOMPLETESTATICONLY$
  import void set_Infecte(int _infecte); // $AUTOCOMPLETESTATICONLY$
  import int get_Zombivant(); // $AUTOCOMPLETESTATICONLY$
  import void set_Zombivant(int _zombivant); // $AUTOCOMPLETESTATICONLY$
  import bool get_Mort(); // $AUTOCOMPLETESTATICONLY$
  import bool set_Mort(); // $AUTOCOMPLETESTATICONLY$ => THIS IS LINE 97

And in the .asc script file, the function is declarated like this (it's empty because I don't want anything able to modify this attribute directly) :
bool Personnage::set_Mort()
{
}

I have no problem with v3 compiler. Is it a bug ?
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Tue 08/04/2025 16:38:27
Quote from: Baguettator on Tue 08/04/2025 16:19:05I have no problem with v3 compiler. Is it a bug ?

v3 compiler lets numerous syntax mistakes pass where it should report error. v4 compiler is more strict.

set_ functions of attributes must be "void", because they set and not return. You have other set_ functions as void above, except set_Mort.

Also, you do not need to declare get_ and set_ functions in the struct, attribute declaration is enough.
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Baguettator on Tue 08/04/2025 20:18:51
Quote from: Crimson Wizard on Tue 08/04/2025 16:38:27
Quote from: Baguettator on Tue 08/04/2025 16:19:05I have no problem with v3 compiler. Is it a bug ?

v3 compiler lets numerous syntax mistakes pass where it should report error. v4 compiler is more strict.

set_ functions of attributes must be "void", because they set and not return. You have other set_ functions as void above, except set_Mort.

Also, you do not need to declare get_ and set_ functions in the struct, attribute declaration is enough.

Thanks for helping !

Is it "I don't need" or "I must not" declare get_ and set_functions in the struct ? Because the compiler indicates errors, I had to remove them from the struct in the .ash file.
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Tue 08/04/2025 20:34:34
Quote from: Baguettator on Tue 08/04/2025 20:18:51Is it "I don't need" or "I must not" declare get_ and set_functions in the struct ?

You "don't need", but may.

Note that "set_" functions must have a "new value" as an argument, otherwise they won't compile properly. I.e.
Code (ags) Select
import void set_Mort(int new_mort);
But I missed what you say about "don't want anything able to modify this attribute directly". In such case you should declare your attribute as "readonly", and "set" function should not be present at all.

Code (ags) Select
import readonly attribute bool Mort;
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Snarky on Tue 08/04/2025 21:44:03
Quote from: Baguettator on Tue 08/04/2025 20:18:51Is it "I don't need" or "I must not" declare get_ and set_functions in the struct ?

You can, but you shouldn't. The effect of declaring them as imports is that they get exposed outside of the module, as part of the API of the struct. In other words, it means that other code can call them directly as functions, instead of just using the attribute (which calls them indirectly).

Typically you don't want that, and since you are annotating them with $AUTOCOMPLETESTATICONLY$ (which is wrong, since the functions are not static; if you simply want to prevent autocomplete from listing them, it should be $AUTOCOMPLETEIGNORE$), I assume you don't. So just take them out.
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Baguettator on Sun 13/04/2025 20:06:29
Thanks for helping, I fixed my code :)

I encounter a problem, it seems a bug from the v4 compiler.

Here's my code:

int ressource[TOTAL_RESSOURCES, TOTAL_CATEGORIES_RESSOURCES];
[...]
Ressource1[0].Text=String.Format("%d", ressource[nourriture][colo]); // This is line 1171

And the compiler displays an error :
Struct_Events_Colonie.asc(1171): An array index cannot follow an expression of type 'int'

Any idea ?
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Sun 13/04/2025 20:27:54
Quote from: Baguettator on Sun 13/04/2025 20:06:29I encounter a problem, it seems a bug from the v4 compiler.

Here's my code:

int ressource[TOTAL_RESSOURCES, TOTAL_CATEGORIES_RESSOURCES];
[...]
Ressource1[0].Text=String.Format("%d", ressource[nourriture][colo]); // This is line 1171

And the compiler displays an error :
Struct_Events_Colonie.asc(1171): An array index cannot follow an expression of type 'int'

Testing this kind of array in an empty project, accessing its elements seem to work.
Please give more details about the variables that you use here:

nourriture,
colo,
Ressource1.

Maybe break this long expression into smaller ones, that might help finding which exactly part has the error. Like this:
Code (ags) Select
int num = ressource[nourriture][colo];
String str = String.Format("%d", num );
Ressource1[0].Text = str;

Other than that, if you are using variables from another script, double check that you have declared an import EXACTLY same way as the variable itself.
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Baguettator on Sun 13/04/2025 21:04:22
Well, "nourriture" and "colo" are enum values :

enum Ress
{
nourriture=0,
...
};

enum Type
{
colo=1,
...
};

Will try to do as you say !

EDIT : OK, it was an error from me, but the compiler didn't indicate the right error/line : it was because I declared "int ressource" just before, but the problem is that "ressource" is already an int[][] in my script. The compiler should have told that "ressource already exists !
Title: Re: AGS 4.0 - Alpha 20 for public test
Post by: Crimson Wizard on Sun 13/04/2025 21:28:27
Quote from: Baguettator on Sun 13/04/2025 21:04:22EDIT : OK, it was an error from me, but the compiler didn't indicate the right error/line : it was because I declared "int ressource" just before, but the problem is that "ressource" is already an int[][] in my script. The compiler should have told that "ressource already exists !

Where exactly did you declare that other "ressource"?

It's allowed to declare another variable of the same name in a different scope. That is a common behavior in programming languages.

For example, if you have a global variable VARIABLE, you may still declare a local variable VARIABLE inside a function, and it will override the global one for the duration of that function.
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Crimson Wizard on Mon 14/04/2025 05:06:42
Updated to Alpha 21
(Please use download links in the first post)

This update contains all the new features and fixes from 3.6.2 RC3 (https://www.adventuregamestudio.co.uk/forums/index.php?msg=636682915) (excepts ones related to backwards compatibility).

Editor:
- In General Settings added "GUI common controls handle only left mouse button" option.
- Fixed default values for Character and Object's Enabled and Visible properties set when upgrading a pre-4.0 game project.
- Fixed default value for "Use old-style voice clip naming rule" setting set when upgrading from older 4.0 alpha versions.
- Fixed newly created WFN fonts had their size multiplier property discarded when a game is compiled.

Compiler:
- Fixed a bug where naming a parameter like its function led to a crash.

Scripting:
- Support regular (non-managed) struct and array variable initializers, where you can specify their element values either in the order of their declaration or as a "name1: value, name2: value" sequence. For arrays the latter would be "0: value, 1: value" and so forth.
  NOTE: this works only for global variables at the moment.

Script API:
- Added DialogOptionsNumbering enum, to use when setting dialog options numbering mode.
- Added multiple new properties to Dialog type: OptionsBulletGraphic, OptionsGap, OptionsGUI, OptionsGUIX, OptionsGUIY, OptionsHighlightColor, OptionsMaxGUIWidth, OptionsMinGUIWidth, OptionsNumbering, OptionsPaddingX, OptionsPaddingY, OptionsReadColor, OptionTextAlignment. Most of these are replacing previously existing old-style variables in "game" struct and OPT_* options. OptionsGUIX/Y and OptionTextAlignment are completely new features.
- Added new game-wide option OPT_GUICONTROLMOUSEBUT that defines whether common GUI controls are affected by the right mouse button or not (InventoryWindows are excluded from this, because they have their own special handling for RMB).

Engine:
- Standard Dialog options now support Right-to-left text mode.
- Fixed a number of Room's script indexed properties not working correctly, such as: Room.Hotspots[], Room.Objects[], Room.Regions[], Room.WalkableAreas[], Room.Walkbehinds[].
- Fixed blend modes not handled correctly by Software renderer.
- Fixed certain blend modes not respecting transparency with OpenGL renderer.
- Fixed default dialog options highlight color had wrong value.
- Fixed Character.FaceDirection() not respecting blocking style parameter.
- Fixed characters and objects not making last planned step when moving.



This update has a new script syntax feature that allows to initialize a struct or array using a "initializer list". Unfortunately, this feature was not fully completed, and only works for global variables. There's a chance that it will be expanded to local variables too in the future updates.

Example for structs:
Code (ags) Select
struct Location
{
    float Longitude, Latitude;
};
struct PointOfInterest
{
    int AdmissionFee;
    Location WhereItIs;
};

PointOfInterest EiffelTower = {
        WhereItIs: { Longitude: 48.8584, Latitude: 2.2945 },
        AdmissionFee: 20 + 3,    // ← Simple 'int' or 'float' expressions are possible
};

Example for arrays:
Code (ags) Select
int Primes[10] = { 2, 3, 5, 7 };
Code (ags) Select
bool IsPrime[10] = {
    2: true,     // ← means, IsPrime[2] is 'true'
    3: true,     // ← means, IsPrime[3] is 'true' etc.
    5: true,
    7: true,
};
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Baguettator on Mon 14/04/2025 14:29:57
Quote from: Crimson Wizard on Sun 13/04/2025 21:28:27
Quote from: Baguettator on Sun 13/04/2025 21:04:22EDIT : OK, it was an error from me, but the compiler didn't indicate the right error/line : it was because I declared "int ressource" just before, but the problem is that "ressource" is already an int[][] in my script. The compiler should have told that "ressource already exists !

Where exactly did you declare that other "ressource"?

It's allowed to declare another variable of the same name in a different scope. That is a common behavior in programming languages.

For example, if you have a global variable VARIABLE, you may still declare a local variable VARIABLE inside a function, and it will override the global one for the duration of that function.

For example :

// In another script :
int ressource [TOTAL_RESS, TOTAL_CATEG];
// This is exported and shared with all other scripts
// ...

// Then in Global Script :
function Myfunction ()
{
  int ressource=Random(8);
    String mot;
    if (ressource==0)
    {
      mot="Carburant";
      ressource=Random(2) + 2;
      if (player.Room==ROOM_EXP) ressource[carburant][exp]+=ressource; // => Compiler says an error here : "An array index cannot follow an expression of type 'int'"
// etc...
}
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Crimson Wizard on Mon 14/04/2025 15:36:00
Quote from: Baguettator on Mon 14/04/2025 14:29:57For example :

// In another script :
int ressource [TOTAL_RESS, TOTAL_CATEG];
// This is exported and shared with all other scripts
// ...

// Then in Global Script :
function Myfunction ()
{
  int ressource=Random(8);

That is the situation that I was speaking about: a variable of same name but in another scope.

Following is a valid case in AGS script, as well as many other programming languages (C++, C#, Java, Python, etc):

Code (ags) Select
int variable; // global variable

function f()
{
    int variable; // local function variable

    if (condition)
    {
        int variable; // local variable of a inner scope (1)
    }

    if (condition2)
    {
        int variable; // local variable of a inner scope (2)
    }
}

The compiler does not treat this as error.

Usually it's advised to invent a naming style in which global and local variables will have different names.
For example: call global variables with some prefix, like "gl_" , or use capital letters in their names, and call local variables in small letters only.
That will also help to quickly distinguish if that's a global or local variable when you see one in code:

Code (ags) Select
int gl_Ressource [TOTAL_RESS, TOTAL_CATEG];

function Myfunction ()
{
  int ressource=Random(8);
  ....
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Baguettator on Mon 14/04/2025 18:58:59
Thanks for explanations !

But, it has changed recently ? I remember errors while compiling, with the message " 'ressource' is already defined". I didn't know it was possible now...

By the way, sorry it's a bit out of the thread because it's not a bug :)
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Crimson Wizard on Mon 14/04/2025 19:29:36
Quote from: Baguettator on Mon 14/04/2025 18:58:59But, it has changed recently ? I remember errors while compiling, with the message " 'ressource' is already defined". I didn't know it was possible now...

No, it has always been like this. The error happens when you have 2 variables of same name in the same scope. Like, two global variables.
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Baguettator on Sat 26/04/2025 12:11:45
Hi !

I'm using the last version of AGS 4.0, and it seems giving a slider a background image doesn't give it the same size as the image itself. So it's a bit annoying because you have to drag it manually or enter the right values in the editor panel.

Is it a bug ?
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Crimson Wizard on Sat 26/04/2025 13:52:07
Quote from: Baguettator on Sat 26/04/2025 12:11:45I'm using the last version of AGS 4.0, and it seems giving a slider a background image doesn't give it the same size as the image itself. So it's a bit annoying because you have to drag it manually or enter the right values in the editor panel.

If you mean that the slider does not resize when you add a image, similar to button, then it has always been like this.
Buttons are the only controls that resize to a new image.
I suppose it's not too hard to implement such behavior though.
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Baguettator on Sat 26/04/2025 21:50:50
That's exactly what I mean :) Sorry for my bad english...

It could be a quality of life feature ! There is no reason it doesn't resize like buttons ?
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Baguettator on Sun 27/04/2025 05:37:32
Sorry for double post, I hope it's not too much "out of thread" if I ask here.


I would like to know how AGS 4.0 is "good" to manage games with high resolution (1920*1080), high quality graphics (like photos as rooms' background), BUT no animation ? I'm thinking about another Point'n click game of this kind, so I'm asking here.

ALso, if it's not a secret, what are the next improvement AGS 4.0 will get about that ? (speed in scripts/sprites management/memory...)

The best for me would be to host my game on the web, but I don't know if the game's size allowed to be hosted on web will be increased ? (with 1920*1080 sprites, it can be quickly heavy, and if I remember well, I have read that it was for about 300Mo max for a web port).
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Crimson Wizard on Sun 27/04/2025 09:26:13
Quote from: Baguettator on Sun 27/04/2025 05:37:32I would like to know how AGS 4.0 is "good" to manage games with high resolution (1920*1080), high quality graphics (like photos as rooms' background), BUT no animation ? I'm thinking about another Point'n click game of this kind, so I'm asking here.

3.6.1 is already good enough for that, and there's a 1920*1080 game just released in 3.6.1:
https://www.adventuregamestudio.co.uk/forums/ags-games-in-production/old-skies-time-travel-adventure-by-wadjet-eye!-demo-available!/

Quote from: Baguettator on Sun 27/04/2025 05:37:32ALso, if it's not a secret, what are the next improvement AGS 4.0 will get about that ? (speed in scripts/sprites management/memory...)

It's not a secret, I do not know what it will get. My planning in this project rarely gets beyond 3-4 tasks.
There's one idea about having sprites loaded as a background task, where they are scheduled and loaded ahead while the game keeps playing. Right now AGS can preload sprites and views by a script command, but it's a blocking operation that stops the rest of the game. Loading resources in background (in a free time between game updates) is the basic way of loading resources today, but when I tried to add this to AGS engine I've met with few issues because of how its code is organized. I might look again later, after I'm done with my current work.

Quote from: Baguettator on Sun 27/04/2025 05:37:32The best for me would be to host my game on the web, but I don't know if the game's size allowed to be hosted on web will be increased ? (with 1920*1080 sprites, it can be quickly heavy, and if I remember well, I have read that it was for about 300Mo max for a web port).

I never heard about such limit. It may be the matter of the web server you're hosting or running on.
EDIT: actually, I suspect that web version may require to load everything into the memory before launching? that's why it takes so long to start up games. I'd need to double check that. Better ask here in the dedicated Web Port thread:
https://www.adventuregamestudio.co.uk/forums/engine-development/ags-engine-web-port/

But obviously each platform has its own limitations. Something that works well on desktop (Windows, Linux, Mac) may not work as well on consoles with less CPU/GPU power like Switch, or when you run in a web browser. Normally you should make separate versions of the game if the same game does not work well everywhere. (Not to mention that these may require different controls)
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Baguettator on Tue 29/04/2025 20:32:26
Thanks a lot for your long answer. Good job for all you are doing !

I double checked, in the thread about web port, it's written "you can't compile games more than 300Mo". But not a big problem for me, I think I will not port my game for the web :)

Also, I have to ask about AGS 4.0 : currently, if I delete some rooms, the ID numbers don't change. I think it's intended, while it could be confusing (but not a real problem...). What do you think ?
Title: Re: AGS 4.0 - Alpha 21 for public test
Post by: Crimson Wizard on Tue 29/04/2025 21:00:38
Quote from: Baguettator on Tue 29/04/2025 20:32:26I double checked, in the thread about web port, it's written "you can't compile games more than 300Mo". But not a big problem for me, I think I will not port my game for the web :)

To be precise what it sais:
Quotethe port won't work in any big ags game (like a game beyond 300MB

That does not mean that you "can't compile", that means that it won't work when running.
Here's an explanation why:
https://www.adventuregamestudio.co.uk/forums/engine-development/ags-engine-web-port/msg636642456/#msg636642456


Quote from: Baguettator on Tue 29/04/2025 20:32:26Also, I have to ask about AGS 4.0 : currently, if I delete some rooms, the ID numbers don't change. I think it's intended, while it could be confusing (but not a real problem...). What do you think ?

The rooms have arbitrary numbers. You may have room 1, 10 and 100. Therefore it makes no sense to update their numbers if any room is deleted.
The rooms are referenced in script by their numbers. If numbers will shift on room deletion, then your scripts will break.

If you need to change some room ID, then you can edit room's Number property (and recent update also has a context menu command for that).