UTILITY: AGS Auto-Detect (BETA)

Started by tzachs, Mon 09/01/2012 23:12:14

Previous topic - Next topic

tzachs

Introduction

This utility is supposed to help in situations where you deploy your game but it won't start for some of the players since the configuration you chose initially is not supported on their computer.
It allows the developers to configure a pre-set list of desired configurations for their game, from the one that will provide the best experience to the least favorable one, to try only if all other configurations are not supported.

How does it work?

1. Put the AGS Auto-Detect executable in your game folder (the executable is located in AGSAutoDetect\bin\release, only the exe file itself is needed).
2. Instead of running your game file, run AGS Auto-Detect.
3. AGS Auto-Detect searches your system for the installed DirectX version on your computer, and for all supported resolutions on your computer.
4. It then reads the existing configuration file and checks if the existing configuration (both DirectX and resolution) is supported by the hosting computer. If the existing configuration is supported, it simply runs the game.
5. If not, then it goes over a pre-set of desired configurations, from the most wanted to the least wanted, until it finds a configuration that is supported by the local computer. If it finds it, it will edit the configuration file, save it, and run the game.
6. If no supported configuration is found on the computer, it will default to the safest configuration possible (that I know of): DirectDraw & windowed, save it to the configuration file and run the game.

System Requirements

The only requirement for AGS Auto-Detect to run is DotNet 2.0 installed on the local computer.

Configuration

The source code is provided, so that you can configure several or more of the following items. You'll need Visual Studio 2008, and then double click on AGSAutoDetect.sln to open the code.
When you finish doing your changes, right click on the solution and click build, the executable in the Release folder should change to include your changes.

1. Icon. You'll probably want to set an icon and rename the program to your game name, so that people will double click on AGS Auto-Detect to play the game (renaming the original game with AGS to an obscure name will follow).
To set the icon, select the project, right click on it, select Properties, select the Application tab, and you'll see an option to select the icon.

2. Set the desired configurations for your game. I've provided a default list of preferred configurations for each resolution as I saw fit. My knowledge on the subject of how to make the game look the best is limited though, so if you want to change you can do it via changing the source (also, if you have better knowledge than me, please share it so I can upload a better version with better defaults).
Each game resolution comes with its own set of defaults, so to see the default list, you must know your own game resolution.
Let's take for example the 320x200 resolution. In the project you'll see the Desired Configurations folder, open it and then open the Resolutions folder under it. Double click the R320x200.cs file, and you will see the following code:
Code: ags

public List<ConfigFileData> GetDesiredConfigurations()
        {
            return new List<ConfigFileData> 
            {
                new ConfigFileData { IsD3D = true, Filter = FilterType.StdScale2},
                new ConfigFileData { IsD3D = true, Filter = FilterType.StdScale2, Letterbox = true},
                new ConfigFileData { IsD3D = true, Filter = FilterType.None},
                new ConfigFileData { IsD3D = true, Filter = FilterType.None, Letterbox = true},
                new ConfigFileData { IsD3D = false, Filter = FilterType.StdScale2},
                new ConfigFileData { IsD3D = false, Filter = FilterType.StdScale2, Letterbox = true},
                new ConfigFileData { IsD3D = false, Filter = FilterType.None},
                new ConfigFileData { IsD3D = false, Filter = FilterType.None, Letterbox = true},
                new ConfigFileData { IsD3D = true, Filter = FilterType.StdScale3},
                new ConfigFileData { IsD3D = false, Filter = FilterType.StdScale3}
            };
        }


The first item in the list is D3D and x2 filter, so that's the first configuration that AGS Auto-Detect will try (assuming the one in the configuration file was not supported).
If that configuration is not supported, the second item will be tested, which is D3D, x2 filter and letterbox (which effectively changes the 320x200 resolution to 640x480 resolution).
If that fails, the next item will be tested, and so on.
You can add, remove and change those items as you see fit.

ConfigFileData is the object that contains the desired configuration, and besides the properties that was set in the default, other properties that can be set include:
ColorDepth, Windowed, RefreshRate, SmoothScaledSprites and DowngradeGraphics.
All of these has appropriate settings in the setup program we all know and love.

Each property of these that was not set, will be taken from the existing configuration that was saved to file.
That means that in my example, if the letterbox was checked when you deployed your game, there isn't really any difference between the first item and the second item in the default list.

3. How the game will be found and run.
AGS Auto-Detect assumes that besided itself and the setup file, the only other executable in the folder is the game file, and so it will run it. This will probably work for almost all AGS games, but if you happen to have another exe file in your folder, you might want to change that logic. Simply double click the Game.cs file, and alter the Run method with the logic of your choice.

What's not in there (yet)?

1. Adding side borders to wide screen monitors. AGS has a more complicated logic when this option is checked. It somehow searches itself for a fitting resolution and adds the borders. Since I don't know how this logic works, I can't deduce if a configuration with this option on is supported or not, so for now I didn't add it.
If someone here knows how it works, please tell me, so I'll include this option as well.

2. Smooth scaled sprites (and probably other features as well) require a "fast CPU" in order to run. Since I don't know how fast the CPU should be so that I can reasonably assume that it will work, I don't check against it at all.
If someone here knows what is a reasonably fast CPU, please tell me and I'll see how to add those tests as well.

3. Older AGS versions. Ideally I would want to support AGS 2.7 and upwards, but I haven't really done tests, and I don't know what changes the configuration files have between those versions. If anyone knows (or wishes to test), please tell me.

Testing
Since there are tons of available system configurations in the world, there is a 100% percent chance that it won't always work as intended.
So please, if you can run it on your computer, on your game (or other games), and with different initial setups and give me feedback, I would appreciate it.
If you do find something wrong, please send me the following:
1. What's your game resolution?
2. The original configuration file your game has (acsetup.cfg).
3. Did you make any changes to the source?
4. There's a log that's generated called AutoDetectLog.txt, which I will also need.

Since almost no testing has been done so far, I recommend not to use it on actual released games as of yet, until I will get sufficient feedback to assume that it works in most cases.

License

I think I'll go with Creative Commons License.
Meaning you can use it in freeware and commercial games, credits will be appreciated but not necessary.

Future Plans

In following versions, I thought of also including a new setup program, that will only present to the player with the options that are supported on his computer, and will also be configurable so that unwanted items can be hidden (while still maintaining a nice look to it).
Any thoughts on this are also welcome.

Download

Get it here:
AGS Auto-Detect
 


Ghost

Awesome! That really sounds super-useful, and is a great step into reducing Dumbest-Possible-User messups- I'll give it a try!

Calin Leafshade

Hey Tzach,

I wrote a c# library that can extract information from an AGS exe. Things like resolution, colour depth, game name and stuff. (Essentially its a c# implementation of CJ's clib) Would that be useful to you? I was going to use it to make a winsetup replacement but if its useful to you then you are also welcome to it.

Dualnames

Several of that stuff can be somewhat attained by the acsetup.cfg file.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

tzachs

Thanks for the offer Calin.
Like Dualnames said, I already parsed the data from the cfg file.
I wonder if there are any advantages of extracting the data from the exe instead of using the cfg.
One thing that I can think of is that the cfg file can be changed by outsiders while the exe data is safe, though I doubt that anyone will actually change it.
Is there any other advantage? Why did you decide on that instead of the cfg file?

Calin Leafshade

Well the main reason I extracted the data from the exe is that the 'defaultres' option is only present in later versions on the engine.
Also, you can't always guarantee that the config file will be present (although granted mostly it will).

However I suppose that your tool would only be used on the newest versions of AGS so there isnt much benefit.

I guess the main reason i chose to do it that way is that it seemed 'cleaner' somehow to get the info from the exe.


Dualnames

Quote from: Calin Leafshade on Wed 11/01/2012 00:15:24
Also, you can't always guarantee that the config file will be present (although granted mostly it will).

You can always "force" the developer to create it. If I'm not mistaken the acsetup.cfg is created when the winsetup.exe is run for the first time.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

tzachs

Ideally I want it to support games made with AGS 2.72 as well, so if the defaultres option does not exist in there, that's a good enough reason for me to switch to your library.

SMF spam blocked by CleanTalk