Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Radiant on Wed 12/05/2004 16:31:52

Title: Plugin compatibility suggestion
Post by: Radiant on Wed 12/05/2004 16:31:52
Suggestion:
plugin DLLs don't work in the Linux or Dos versions. Now it may be useful to be able to use the same game data file for both Linux and windows... this could be done if the Linux version of the AGS runtime simply ignores the DLL function calls. In the AGS editor I could supply a list of external functions; in windows these are linked to the DLLs, in Linux they are not.

Title: Re: Plugin compatibility suggestion
Post by: Kweepa on Wed 12/05/2004 17:38:46
That depends on what the plugin is doing.
For example, just ignoring the maths plugin would be very bad.
Also, for calls that return values the stack would at least have to be padded.
Title: Re: Plugin compatibility suggestion
Post by: Privateer Puddin' on Wed 12/05/2004 17:42:11
CJ said plugin authors would be able to make their plugins for the linux version too one day?
Title: Re: Plugin compatibility suggestion
Post by: Pumaman on Wed 12/05/2004 21:17:32
Interesting idea. The scripting system could 'stub' the functions I guess, but of course it would depend on the plugin as to whether this was possible. For a purely graphical plugin where it would just look less pretty without it, it's a possibility - but as Steve says, if the plugin is used for vital calculations by the scripting, it can't really be worked around.

This could be specified on a plugin-by-plugin basis I guess - but it's a low-priority feature.
Title: Re: Plugin compatibility suggestion
Post by: Hollister Man on Thu 13/05/2004 04:52:48
I have never tried using AGS on another platform, does it crash if a plugin is used?

If it could be made not to, we could use a game. variable to detect what platform engine was being used, and to make the script conditional.  Much like an HTML frames page that is properly written will tell you if you're using a browser that does not support frames, or direct you to a page that is written for such browsers.  You could conditionally replace a plugin-fire with an animated sprite, for instance.
Title: Re: Plugin compatibility suggestion
Post by: Radiant on Thu 13/05/2004 17:02:03
Sounds good, Hollister.

Actually, do a lot of people use the Linux and Dos versions of AGS?
Title: Re: Plugin compatibility suggestion
Post by: Gilbert on Fri 14/05/2004 02:15:08
Not many I guess, but there're still some.

At least I'll be one who will use DOS version whenever possible.
Title: Re: Plugin compatibility suggestion
Post by: modgeulator on Fri 14/05/2004 09:14:22
I think Pumaman said something like 98% of visitors to the site are using Windows.
Title: Re: Plugin compatibility suggestion
Post by: Radiant on Fri 14/05/2004 15:29:49
By the way, doesn't the Windows version of AGS run under Wine? (windows emulator for Linux)? That would solve some issues.
Title: Re: Plugin compatibility suggestion
Post by: Hollister Man on Fri 14/05/2004 15:37:48
That's like running Virtual PC on a Mac, then running it that way.  Its not actually running on the Mac, just a *virtual pc* inside the mac. ;) lol
Title: Re: Plugin compatibility suggestion
Post by: Pumaman on Fri 14/05/2004 16:31:51
The DOS and Linux engines will load a game that uses plugins, but when they attempt to initialize a script that uses a plugin function, they will exit with an "undefined function" error.
Title: Re: Plugin compatibility suggestion
Post by: Radiant on Fri 14/05/2004 16:54:24
Hm... so would it be possible to make a simple way around this, like a If_Windows_running () function? So that the Linux interpreter simply ignores the relevant bits of code...
(low priority of course, I'm just curious)
Title: Re: Plugin compatibility suggestion
Post by: Scorpiorus on Fri 14/05/2004 17:20:40
As I remember a global system.os variable holds the engine version - dos, windows or linux.

Title: Re: Plugin compatibility suggestion
Post by: Pumaman on Fri 14/05/2004 23:16:22
Yep, you can do that to find out the OS, but it won't help here, since the runtime error will occur when it loads the script file (since at that point it attempts to resolve all external function calls). Therefore you'll never get a chance to run the code to check OS.
Title: Re: Plugin compatibility suggestion
Post by: Scorpiorus on Sat 15/05/2004 00:14:16
Yep, so what if for the linux version the engine would initialize pointers to external functions with some internal error-handling function that aborts the game when gets called (with the error message saying that the function doesn't have implementation).

Thus we can have optional calls in the script:

if (system.os == OS_WINDOWS) {

   pluginFunction1(); //external functions
   pluginFunction2();
   pluginFunction3();

} else {

   // Workaround code if possible
}

   pluginFunction4(); //game will be aborted with theÃ,  linux engine to tell that an alternative code is not provided;

EDIT: This way the engine will behavior correctly just in case if the pluginFunction4() implements vital math calculations or whatever.
Title: Re: Plugin compatibility suggestion
Post by: Pumaman on Sat 15/05/2004 11:26:53
Sounds like a good idea to me, I'll add it to my list.
Title: Re: Plugin compatibility suggestion
Post by: Scorpiorus on Sun 16/05/2004 14:43:52
I appreciate it's a low priority but if it will be implemented, a good idea would be to have a function telling if a certain plugin is available (returns NO for both dos and linux). Thus a developer can decide (on game start and on restore, for example) whether to run the game or quit when a vital dll is not linked.
Title: Re: Plugin compatibility suggestion
Post by: Pumaman on Sun 16/05/2004 21:45:49
Good idea - though currnetly, the Windows engine won't load the game if a plugin is missing.