-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.6.0: Perfect Tides crashes in 3.6.0 (Mac) #1973
Comments
Unrelated to the bug, but does not OpenGL work in 3.5.1? |
No:
And I don't think it's expected to work. The 3.6.0 release notes mention:
|
Oh, I had bad memory, this is how OSX port used opengl prior to 3.6.0 (quoting a comment from a different ticket):
|
So, this is interesting. I did not have this crash on Windows, but then I found out that the ASSERT that you reference is disabled by default in our builds. I only get this when rebuilding the engine with Allegro ASSERTs enabled (by declaring This originates from the call to EDIT: sadly, returning null from |
After more testing in AGS 3.2.1 and 3.5.1, apparently DynamicSprite.Create never really cared about the arguments. Here's my test run: In all the successful cases DynamicSprite object reports exact Width and Height it was requested (including -1 x -1 case). EDIT: well, the problem is clear, the question now is which behavior to implement while also keeping compatible with existing games... |
ags/libsrc/allegro/CMakeLists.txt Line 194 in 38d0dd3
Uhm it looks like it's there on the CMake, so this flag is enabled in debug builds on macOS that are done through CMake (I need to update the stream api moved around in the Xcode project, so that may not be working for a different reason) and also and also in Android debug builds. I think we never officially build Emscripten for debug, so web builds are not affected.
Why not following the instructions from our README? If there's something wrong it may be required to fix those. Btw, I am not sure those instructions on notarization are correct, as Apple changed things there recently. |
Pushed 82194b2, which will enforce minimal size of 1 x 1 and proceed (with a warning to a game log). Not the perfect solution, but this is just to keep old games working. |
Also, while testing, I noticed that the computer chat is made horribly slow. It drops game fps from 40 to 15-16. I wonder if it's a game's or original module's problem. |
It makes sense to me that debug mode is enabled in debug builds. I did notice that building it in XCode placed the binaries in /Debug, but I don't know XCode well enough (/at all) to figure out any other way to build it, and it never caused problems up till now.
Because I never knew there was a readme with instructions for building on Mac. It's a pretty natural progression: the link has good explanation of how to get Windows AGS games to run on Mac, with a pre-built app bundle for two engine versions. Then if you want some other engine version, it also has step-by-step instructions on how to build it yourself right below. Now looking at the readme, yeah, I think it could be improved. I mean, it starts out talking about icons. That's just about the LAST think you need to worry about if you want to get an AGS game to run on Mac. And the way it presents alternative processes is just confusing. (And couldn't we distribute an official pre-built app bundle for each version of the engine, rather than ask every Mac user to build their own?) |
There have been an issue open for this: #1333. |
My knee-jerk answer is that either throwing a script exception or returning NULL would be the right behavior if the bitmap dimensions are illegal. Then you'd need a backwards-compatible script option for running older games, of course. The assertion failure in Debug mode is probably OK? There just needs to be a well-documented way to make non-debug builds for Mac.
We could ask in the module thread. (Or first examine the module code to see how it's meant to run, I suppose.) |
@messengerbag could you check if building from commit 82194b2 fixes the issue? It's a compatible hack, will create a bitmap of minimal valid size instead. We may change it to return null in case of bad parameters in the future major versions (like ags4). |
Just a thing, using cmake by telling it is a release, there shouldn't be that assert.
If this doesn't work though, then there is a bug in the CMakeLists.txt, which is a possibility. Edit: ah, in that website the CMAKE_BUILD_TYPE is not specified, this makes it default to Debug build - which btw should be notably slower. |
Hmm... And yes, it no longer crashes, but the scene is now extremely laggy. As you said:
This is not the case for me with 3.5.1. The difference is very noticeable in this build. |
I tested once more with both original game (made in 3.5.1.11 apparently) and 3.6.0. 3.5.1.11 gives around 24 fps for me with 1 chat window, and 14 with 2 chat windows. So, obviously there's a curious regression in 3.6.0. On another hand, it's been already quite slow in 3.5.1, which is an issue on its own (maybe the module is working inefficiently, or used inefficiently). I will try to figure out what is making it slower in 3.6.0 though. UPDATE: my first guess was that it's related to the sprite update / deletion that checks all possible objects to ensure they are cleared of a sprite's reference (because that was expanded in 3.6.0), but disabling these checks does not fix anything (it stops chat windows from updating visually on screen, but game is still as slow). |
Found the commit that caused the slowdown: c34f0c9 So, what that commit did (besides the later disabled part), was the periodic system events poll inside the long scripts. But it only supposed to be running when the script does not return to the engine for a long time. UPDATE: hmm yes, apparently the script operations under which the "hanging" test is done are performed so frequent in this script, that testing for a passed time alone costs around 5 fps. Perhaps I could disable this check, the downside would be that you won't be able to close a game window again if script is hanging for real. This problem may only be properly resolved by moving game logic (along with the script execution) to a separate thread, while keep polling events on a main thread. |
|
I haven't been able to test it properly on my computer. I've tried to use Quartz Debug to measure the framerate, and it reports: 3.5.1: runs at 60 fps at all times, even with 2 chat windows. However, this does not seem to reflect the actual refresh speed. The scrolling animation when a new line appears in the chat window completes in <1 second on 3.5.1, but takes >25 seconds on 3.6.0. How are you getting your numbers? |
It's not really ags/Engine/script/cc_instance.cpp Line 845 in b4f937a
As for Line 497 in b4f937a
In retrospect I should have set it to 1/GetGameSpeed, or just 1/60. But apparently, this is not the most important thing here.
Running with BTW, the game is set to run at 40 fps normally. |
Okay, I removed the whole check added by c34f0c9. Here's the commit made on release-3.6.0 branch: 5c0fdb2 |
I read a bit about |
Apparently the event pending was also done incorrectly, because it did not reset the
It's in several places around the code, in frame delay calculation, input handling. It's easy to see if you search for I made a simple test, counting how many times the time test is done sequentially while the script is running, and it shows numbers in the range of 16000 to 30000 in that game scene in question. EDIT2: The results for that scene are: |
There is some interesting discussion here: microsoft/STL#624 Apparently if we know the duration range (do we need to go up to seconds or at most milliseconds?) and precision, there are ways to do it a bit faster. |
Hmm, I replaced the AGSClock declaration with EDIT: it still slightly slower, like 0.5-1.5 fps slower , randomly. |
There is also Looking on GitHub there isn't a readily available cross-platform library with this so my guess is using |
Hm, alright, I got persuaded to try and rethink this instead. In the end I did even more slight optimizations, like doing time check only once per 1000 JMPs. The reason I did not do this originally was that I was concerned about some script actions that may take long time but don't take many loops. Please see the latest commits at release-3.6.0 branch. Compared to the last 3.6.0 release this "won" around 9-10 fps on my system in that scene, which is massive... EDIT: also pushed to master branch now. |
@ivan-mogilko unrelated, but does running in unlimited frame mode (fps on + ctrl+e) gives you even more fps gains there? I think I found the commit that introduced that AGS_Clock f2ab428 |
Thanks! Though I can't seem to get it to work with the original 3.5.1 Steam app bundle. Calling it with that command line option displays framerate info in the 3.6.0 builds, but running it the exact same way (and the same cfg options) with the officially distributed version shows nothing. It doesn't require a debug build of the engine, does it? In any case, in my 3.6.0 build the framerate drops from 40 fps (60 fps when set to unlimited) to 1 fps with one chat window, and to 0.5 fps with two. |
@messengerbag , I am sorry because it was some messages above, but make sure you are using the Btw you can also just copy the binary |
This clearly indicates you are building a debug build of the engine, it contains too much extra check and assertion code.
No, it fps command should work always, regardless of the engine build and game settings. |
Yes; on the title screen it rised fps from ~3000 to 3300. Just to clarify, I used system_clock only for the timeout check, introduced new typedef AGS_FastClock for this purpose. Other places still use AGS_Clock = std::steady_clock. |
I believe this should be closed, as the original reported bug has been fixed. In regards to the slowdown, @messengerbag, I propose to test with the latest release-3.6.0 branch (and use the "release" engine build), but if the problem persists I think it's best to open a separate issue. |
Describe the bug
Running the game Perfect Tides (released in an AGS 3.5.1 Mac version for Steam) with a v3.6.0 engine build on MacOS, it crashes at a certain point with the error message:
The line in question is
ASSERT(width >= 0);
increate_bitmap_ex()
The point at which is crashes is a sort of cutscene where the main character goes on her computer and an in-game AIM chat window pops up. The game uses Khris's ChatDisplay module to display the chat window.
AGS Version
It crashes on Mac in both v3.6.0.44 and v3.6.0.47, built by me from source according to the instructions here. I've also tried running it both in OpenGL and with software driver, fullscreen and windowed, and it does not make a difference.
It does not crash in the official Mac build that Steam distributes (running ACI version 3.5.1.16, compiled with 3.5.1.11).
I have not been able to test on Windows to see whether the problem is limited to Mac or applies to 3.6.0 generally.
Game
Perfect Tides v1.0.1, official Mac version as shipped on Steam
Savegame before crash: agssave.029
My latest home-built AGS app bundle (into which I drop the game files): ags_3.6.0.47.app
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Game should not crash. An in-game chat window should pop up.
Additional context
The reason I want to run it in 3.6.0 is that because of the awkward resolution (640x480), the game cannot be cleanly scaled to full-screen, and ends up with uneven pixel scaling using the software driver. In 3.6.0 I can use OpenGL and supersampling to get even pixel scaling (with anti-aliased edges).
The text was updated successfully, but these errors were encountered: