AGS 4.0 - Alpha 24 for public test

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

Previous topic - Next topic

Baguettator

Quote from: Crimson Wizard on Sun 07/09/2025 14:15:47In this case it should not be Click function, because it's not the "click" list box event, but "OnSelectionChanged".
The problem is not that there is no such function to be called directly, but because in AGS GUI controls are working inconsistently. In a normal ui framework a listbox control would trigger a event whenever its selection is changed by command too. In other words, when you set SelectionIndex, the listbox should call its "SelectionChanged" function.
That is what should be done here, not a click simulation.

I agree ! Also, having a On_Click Event, called before selection of the item, could be useful in some cases, if we have a On_Selection_Changed event too.

Another suggestion for listboxes : is it a good idea to allow using sprites for things like selected index, each item's background, listbox's background ? I know we can do that by script and using buttons or overlay, but perhaps it could be nicer if it's built-in ?

Crimson Wizard

#481
Quote from: Baguettator on Yesterday at 09:33:49Another suggestion for listboxes : is it a good idea to allow using sprites for things like selected index, each item's background, listbox's background ? I know we can do that by script and using buttons or overlay, but perhaps it could be nicer if it's built-in ?

There's a thread that I opened regarding the possible GUI overhaul:
https://www.adventuregamestudio.co.uk/forums/editor-development/gui-controls-update-proposal/

Please post your suggestions about GUI there.

The trouble here is that with all the suggestions posted here in this thread they are going to be lost in the many many pages of this thread. I already have a hard time of looking for the past suggestions up here. On another hand, people who are looking for the information on the latest update and issues with it will also have hard time to find such discussions.

This current forum thread is meant for a) announcing version updates, b) explaining how to work with it, and c) reporting their bugs.
As stated in the rules for this section:
https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/***-forum-rules-***-read-before-posting!-52436/
The new feature suggestions should go to "Engine/Editor Development" section.
Questions on scripting something normally go to "Beginner/Advanced Tech Support" section.

Pax Animo

Issue: Severe Performance Drop During Dialogue

Description
I'm creating a text-based game in AGS. The game has no sprites and doesn't use any "draw-to-surface" code. Everything compiles and runs smoothly under normal conditions.

However, when a dialogue starts via dDialogue.Start();, performance drops dramatically. The FPS counter (show_fps = true) does not appear on screen, but Task Manager shows the game's Power Usage jumping to Very High. Once the dialogue ends, performance returns to normal and Power Usage drops back to Low.

Steps to Reproduce

Run the game.

Start a dialogue with dDialogue.Start();.

Observe performance drop and high power usage.

End the dialogue.

Observe performance returning to normal.

Expected Result
Dialogue should run smoothly, with performance consistent with the rest of the game.

Actual Result
Dialogue causes a dramatic performance drop, with Task Manager showing high power usage. Ending the dialogue immediately restores smooth performance.

Environment

AGS Version: [4.0]

Operating System: [Win 10]

Renderer: [Direct3D / OpenGL / Software] I've tried all 3

CPU/GPU: [AMD 6300, GTX 970]
Misunderstood

Crimson Wizard

#483
Quote from: Pax Animo on Yesterday at 15:27:05Issue: Severe Performance Drop During Dialogue

Description
I'm creating a text-based game in AGS. The game has no sprites and doesn't use any "draw-to-surface" code. Everything compiles and runs smoothly under normal conditions.

However, when a dialogue starts via dDialogue.Start();, performance drops dramatically. The FPS counter (show_fps = true) does not appear on screen, but Task Manager shows the game's Power Usage jumping to Very High. Once the dialogue ends, performance returns to normal and Power Usage drops back to Low.


I do not observe this problem in common circumstances, that is if I make a new blank game from template, create a dialog with few options, and run it.

As usual, I would need more information in order to diagnose this problem.
First of all, please specify the full version (4-digit number) of AGS that you are using, just to be sure that we are trying the same one. This full version may be seen in Help->About dialog.

About FPS not shown, you mention you have a "show_fps = true" line, do you mean that you have it config file, have you added it yourself? It should be "show_fps = 1" instead, because engine does not parse "true" and "false" in config file.


Then, I am not sure what could be causing such behavior, so can only try few things.
1. Does it matter whether you run the game from the Editor or a game exe from Compiled/Windows folder?
2. Does the performance drop occur when dialog options are displayed, or when some of the options is run (that is - dialog script runs)?
3. How big is the dialog, how many options does it have?
4. Do you use standard dialog options, or scripted custom dialog options rendering?
5. You say that it's a text based game, what exactly is shown on screen when dialog is on? Are there any more visual elements shown when dialog is running, compared to when it's not running? Can you post a screenshot of your game?
6. Are there any scripts running while dialog is on? If yes, then what happens in them?

Pax Animo

#484
Quote from: Crimson Wizard on Yesterday at 18:22:42Then, I am not sure what could be causing such behavior, so can only try few things.
1. Does it matter whether you run the game from the Editor or a game exe from Compiled/Windows folder?
2. Does the performance drop occur when dialog options are displayed, or when some of the options is run (that is - dialog script runs)?
3. How big is the dialog, how many options does it have?
4. Do you use standard dialog options, or scripted custom dialog options rendering?
5. You say that it's a text based game, what exactly is shown on screen when dialog is on? Are there any more visual elements shown when dialog is running, compared to when it's not running? Can you post a screenshot of your game?
6. Are there any scripts running while dialog is on? If yes, then what happens in them?


AGS: AGS 4 - Alpha 24
Full release number: 4.0.0.20

I've set Display FPS on screen to True in Default Setup > Misc.

1: Compiled and tested—issue persists.

2: As soon as the dialogue options appear, they appear as soon as the dialogue starts.

3: Performance drops even with as few as 5 options.

4: Yes, No.

5: Only basic GUI elements (boxes/labels) are present—nothing complex that should cause this.

6: No other scripts or processes are running in the background. No scripts running in repeatedly_execute() or always_execute().

I'll sort out a screenshot soon, but the GUI is extremely basic.

This is all done via a clear template.


Misunderstood

Crimson Wizard

@Pax Animo Could you actually send me the compiled game, or the game project via PM? I have no definite ideas about what may be causing this, so being able to run the game itself will help me to understand.

Pax Animo

#486
I
Quote from: Crimson Wizard on Yesterday at 19:46:14@Pax Animo Could you actually send me the compiled game, or the game project via PM? I have no definite ideas about what may be causing this, so being able to run the game itself will help me to understand.

I'll send you the project file ASAP (probably tomorrow)

I should have mentioned a few more details and will do now-- The game res is 1920x1080 and I've added a new font file. with that file I've added new fonts and use different size multipliers for each font.
Misunderstood

Baguettator

Quote from: Crimson Wizard on Yesterday at 13:11:19
Quote from: Baguettator on Yesterday at 09:33:49Another suggestion for listboxes : is it a good idea to allow using sprites for things like selected index, each item's background, listbox's background ? I know we can do that by script and using buttons or overlay, but perhaps it could be nicer if it's built-in ?

There's a thread that I opened regarding the possible GUI overhaul:
https://www.adventuregamestudio.co.uk/forums/editor-development/gui-controls-update-proposal/

Please post your suggestions about GUI there.

The trouble here is that with all the suggestions posted here in this thread they are going to be lost in the many many pages of this thread. I already have a hard time of looking for the past suggestions up here. On another hand, people who are looking for the information on the latest update and issues with it will also have hard time to find such discussions.

This current forum thread is meant for a) announcing version updates, b) explaining how to work with it, and c) reporting their bugs.
As stated in the rules for this section:
https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/***-forum-rules-***-read-before-posting!-52436/
The new feature suggestions should go to "Engine/Editor Development" section.
Questions on scripting something normally go to "Beginner/Advanced Tech Support" section.


Oh sorry, I thought discussing futur features shoul be here. I will pay attention of that !

Pax Animo

Quote from: Crimson Wizard on Yesterday at 19:46:14@Pax Animo Could you actually send me the compiled game, or the game project via PM? I have no definite ideas about what may be causing this, so being able to run the game itself will help me to understand.

Sent.

I resolved the issue with the FPS not displaying, which revealed that the performance drop occurs as soon as the game loads and becomes more severe when a dialogue is triggered. As a test, I set all GUIs to not visible, which significantly improved FPS.
Misunderstood

Crimson Wizard

#489
Quote from: Pax Animo on Today at 08:24:57I resolved the issue with the FPS not displaying, which revealed that the performance drop occurs as soon as the game loads and becomes more severe when a dialogue is triggered. As a test, I set all GUIs to not visible, which significantly improved FPS.

Do i have to enable GUIs back (and which ones) in the project that you've sent me in order to see the full problem, or they are all on there?

On another note, you've said that you are using editor 4.0.0.20, but I can see that the project is saved with 4.0.0.19.
Noting this just to be certain that we compare same version of the game.

EDIT:
I tried the game you sent me, and I do not see any FPS drop whatsoever, it runs stably at 60 FPS for me.
I tested the compiled exe found in _Debug, and also recompiled the project myself and tested; the result is the same.
It has a "Software" renderer chosen as default for some reason, which must be slower and is not recommended for high-res games, but it does not seem to matter in this case.

For the reference, I have a 10+ old old PC, Win 7, CPU is i5-6500, gfx card GTX 960. Although that should not matter with a simple game.

Pax Animo

OK, thanks for trying. It's really strange—I've tested the game on three very different systems. On a modern one, it held 60 FPS until the dialogue started, then it halved. On an old laptop, it couldn't get above 5 FPS. On my own system, I first noticed the issue. Since it's such a small project, I'm going to rebuild it in a new template this evening to see if anything changes.
Misunderstood

Crimson Wizard

#491
Quote from: Pax Animo on Today at 13:52:41On a modern one, it held 60 FPS until the dialogue started, then it halved. On an old laptop, it couldn't get above 5 FPS. On my own system, I first noticed the issue.

Alright, so I decided to make another test. Engine has a mode called "infinite fps" when it runs as fast as possible. This may be turned on by running game exe from command line with "--fps" option, and then press Ctrl+E while in game.

This mode is very useful, because it lets detect performance drops when the game still runs above 60 FPS.

Testing the game compiled in AGS 4.0.0.19, the results on my PC are:
- With Software renderer: 190 FPS, but drops in dialog to 130 FPS (edit: it's random, sometimes it goes below 100)
- With Direct3D: 1800 FPS, but drops in dialog to 60 FPS
- With OpenGL: 1000 FPS, but drops in dialog to 50 FPS

So this confirms the fact that there's a serious performance drop. (Also, it's strange that OpenGL is almost half as less performant than Direct3D),
This is really very strange. I must investigate this further.


Crimson Wizard

Pax Animo, there's something else strange, I noticed that you are using "Size multiplier" for TTF fonts. Is there some reason to use this multiplier instead of using different font size? Normally you would just import the font at the higher size, that would also improve font quality in higher resolutions.
"Size multiplier" is meant for bitmap fonts primarily, because they do not scale on their own.

Crimson Wizard

So, this performance bug was introduced somewhere in 3.6.2, and got transferred into AGS 4.

Pax Animo

Quote from: Crimson Wizard on Today at 15:21:48So, this performance bug was introduced somewhere in 3.6.2, and got transferred into AGS 4.

I'm glad you managed to observe the issue, as it didn't make sense to me that it was happening on multiple systems. I suppose it's a win/lose situation: good that the bug is now identified, but unfortunate as it creates more work for the team. As for the fonts, I had a feeling I was doing it wrong and planned to look into it later—thanks for confirming.
Misunderstood

Crimson Wizard

Alright I found the change that caused this, there's a silly mistake in one of the latest 3.6.2 patches; because of it the engine is in endless loop of recreating all the gui textures while dialog options are on the screen.

SMF spam blocked by CleanTalk