adventuregamestudio / ags

AGS editor and engine source code
Other
705 stars 159 forks source link

'All the way down' crashes on linux even with the plugins built #790

Open i30817 opened 5 years ago

i30817 commented 5 years ago

The plugins it needs are libagslua.so and libags-spritefont-plugin.so. They're on the main repo (with another name for libagsspritefont), so just copying a build of them by looking for the .so's in the Plugin dir allows the game to try to start.

https://gamejolt.com/games/all-the-way-down/43678 However, it then crashes with


Adventure Game Studio v3.5 Interpreter
Copyright (c) 1999-2011 Chris Jones and 2011-2019 others
ACI version 3.5.0.12

Initializing allegro
Initializing game data
Located game data file: /media/i30817/Huggin/Downloads/games/AllTheWayDownV1/deepuns3.exe
Opened game data file: game28.dta
Game data version: 44
Compiled with: 3.3.0.1167
Setting up game configuration
Logging scipt to "warnings.log"
Data directory: /media/i30817/Huggin/Downloads/games/AllTheWayDownV1/
Voice pack found and initialized.
audio.vox found and initialized.
Setting up window
Initializing TTF renderer
Initializing keyboard
Initializing mouse: number of buttons reported is 3
Sound settings: digital driver ID: 'AUTO' (0xffffffff), MIDI driver ID: 'AUTO' (0xffffffff)
Trying to init: digital driver ID: 'SDL2' (0x53444c32), MIDI driver ID: 'DIGI' (0x44494749)
Installed digital driver ID: 'SDL2' (0x53444c32), MIDI driver ID: 'DIGI' (0x44494749)
Install exit handler
Initialize path finder library
Game GUI version: 117
Plugin 'ags-spritefont-plugin' loaded as 'libags-spritefont-plugin.so', resolving imports...
Plugin 'agslua' loaded as 'libagslua.so', resolving imports...
[PLUGIN] AGSSpriteFont: Init fixed width renderer
[PLUGIN] AGSSpriteFont: Init vari width renderer
[PLUGIN] AGSSpriteFont: Register functions
An internal error has occurred. Please note down the following information.
If the problem persists, post the details on the AGS Technical Forum.
(ACI version 3.5.0.12)

Error: [Lua] attempt to call a string value

***** ENGINE HAS SHUTDOWN

Not a big deal if it's supposed to be incompatible, but just checking.

Speaking of weird games with plugin dependencies, Donnie Darko needs agscreditz.so but it doesn't fail when trying to run it on linux without it (it doesn't have a port, just windows specific source) leading to a runtime crash in game (i'm still not sure if i finished the game or it uses the plugin not on a ending).

ghost commented 5 years ago

lua plugin is severely outdated, which may be a reason, or one of them.

i30817 commented 5 years ago

The short freeware game 'Salt' by the makers of primordia has the same error.

Here is the game: https://plnehry.idnes.cz/salt-recenze-c93-/Download.aspx?id=D131027_996267

ghost commented 5 years ago

Running same version of the engine but with original windows agslua.dll from the game package actually works. So I guess there's an inconsistency in lua plugin. Perhaps the sources are either newer or older. I recall we had continious trouble with lua plugin which had numerous updates and some did not work correctly.

i30817 commented 5 years ago

all the way down has (according to exiftool)

a original lua5.1.dll of version:

File Version Number             : 5.1.4.0
Product Version Number          : 5.1.4.0
File Version                    : 5.1.4

and a agslua.dll doesn't have a version (ofc).

diff proves both dlls are the same on both games, so if one is solved, both are (though i don't know of other games using the lua plugin that might get broken). I agree that the incompatibility is likely to be in agslua, not lua5.1 dlls.

i30817 commented 5 years ago

'Barely Floating' is another game with a lua dependency that breaks.


Plugin 'agslua' could not be loaded (expected 'libagslua.so'), trying built-in plugins...
No placeholder functions for the plugin 'agslua' found. The game might fail to load!
Loading game failed with error:
Script link failed.
Runtime error: unresolved import 'LuaValueList::Add^1'.

and if we place libagslua.so (and considering that lua5.1 is installed as part of the system) on the game dir:

Plugin 'agslua' loaded as 'libagslua.so', resolving imports...
An internal error has occurred. Please note down the following information.
If the problem persists, post the details on the AGS Technical Forum.
(ACI version 3.5.0.13)

Error: [Lua] attempt to call a string value

Anyway, i always remove lua5.1 package after trying this. I don't think depending on the user to install lua would be the right move even if it worked.

rofl0r commented 5 years ago

Error: [Lua] attempt to call a string value

sounds like a debugging session is due

ghost commented 5 years ago

I mentioned this above, lua plugin was in development and had several versions. I believe one should begin with a research to find out which version is currently referenced in our repository (it is linked as submodule), and which versions are used in these games, if plugin is backwards compatible, and so on.

Error: [Lua] attempt to call a string value

Question also is, whether this is an error caused by incompatibility between lua scripts in game and plugin or by incompatibility between lua plugin and a new engine.

i30817 commented 5 years ago

Wouldn't it be easier to try to adapt the glue plugin to work with the current release of lua5.1? Were people using this plugin actually coding lua scripts/code or just calling bindings?

edit: ninja'ed

i30817 commented 5 years ago

The fact that error occurs in all games at startup makes me think it's between the plugin and the dll, but that raises the question of if the game devs could send strings as lua code as part of the plugin interface if they wouldn't screw up in the same way.

https://stackoverflow.com/questions/4036743/scite-lua-string-comparison-raises-attempt-to-call-a-string-value

Has a likely culprit on the comments: != confused for ~=

or maybe this: https://stackoverflow.com/a/35225536/214260

or maybe one of these: https://www.lua.org/manual/5.1/manual.html#7 or these: https://www.lua.org/manual/5.0/manual.html (search for "Incompatibilities with version 4.0")

i30817 commented 5 years ago

Error: [Lua] attempt to call a string value

sounds like a debugging session is due

GDB is not helping on this case, even on a debug build -

Error: [Lua] attempt to call a string value

[Thread 0x7fffeffff700 (LWP 12815) exited]
[Thread 0x7ffff59da700 (LWP 12814) exited]
***** ENGINE HAS SHUTDOWN
[Thread 0x7ffff43ea700 (LWP 12816) exited]
[Inferior 1 (process 12805) exited with code 0133]
(gdb) bt
No stack.
rofl0r commented 5 years ago

GDB is not helping on this case, even on a debug build -

yeah, i meant looking for where the error comes from an setting a bp there

i30817 commented 5 years ago

Wouldn't you have to build lua51.so for that? Anyway, i'm not that knowledgeable about debugging to do that, my experience is limited to 'build debug, wait for crash, backtrace - so i fear I'll be of little to no help.

though now that i think about, it's obvious why the bt didn't work. The error is in lua, and it's caught and 'handled' by the engine by exiting normally, if with a error, not a crash. And even if info from the crash location in lua was kept, that wouln't necessarily help because the actual code is being assembled either in the agslua plugin or the game code as strings that lua only knows 'appear' from somewhere. Or at least that's what i suspect might happen. Breakpoint in the lua dll then examining the source string to match to parts of agslua may be the only way indeed.

rofl0r commented 5 years ago

a start could be to modify the lua source code to instead of displaying mentioned error message use abort(); (or even better __asm__("int3"); - that would cause getting a backtrace in gdb, and then the memory contents can be examined