AGS 4.0 - Alpha 18 for public test

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

Previous topic - Next topic

Crimson Wizard

#100
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.

Snarky

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()?

Crimson Wizard

#102
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.

eri0o

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-) 

Crimson Wizard

#104
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.

Mehrdad

#105
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.
My official site: http://www.pershaland.com/

Crimson Wizard

#106
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.

Mehrdad

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.
My official site: http://www.pershaland.com/

lapsking

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.

Alan v.Drake

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

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


- Alan

lapsking

@Alan v.Drake

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

Code: ags
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.

Alan v.Drake

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


lapsking

@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.

Crimson Wizard

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.

lapsking

@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

Crimson Wizard

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.

eri0o

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.

lapsking

@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.

boycalledjames

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

eri0o

#119
Hi @boycalledjames !

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

Code: ags
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
...
<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>
...


SMF spam blocked by CleanTalk