[SOURCE CODE] AGS Editor: Portable (No install) Version

Started by helios123, Wed 13/04/2011 19:40:21

Previous topic - Next topic

helios123

This is an attempt to make a portable version of the AGS Editor, where access to Windows Registry will be kept to a minimum. Conditional compilation is used to ensure that the same code can be used to make both the normal as well as the portable versions.

Changes made:
A new file which defines Registry and RegistryKey classes is created. The classes defined in this file mimic the methods provided by classes with the same name in the Microsoft.Win32 namespace. These classes will either access the Windows registry, or read/write from an xml file on the disc, depending upon the version (normal or portable) being built.

See the Readme for details.

The download includes only the modified files and Readme.

Note:The details about obtaining the source code of the AGS editor can be found here. The /dev folder is the
one which should be checked out.

Download here.

Comments, suggestions and criticisms are always welcome.

Edit: Apr 14, 2011: It appears that the word portable in the subject is getting interpreted as cross-platform. Hence, updated the subject line to make the nature of the code change more clear.
Please note that this is still a Windows only version of the editor, the only difference being that it has reduced dependence on the Windows Registry, enabling it to be run from removable (flash, USB, etc.) drives.

Update: Apr 30, 2011: Added null checks in code.
That's all for now,
helios123

Wyz

I applaud any effort made to make programs portable. Even though I rarely use them, the moments I do I treasure that they exists, because mostly it is without warning. Such moments could be: off to relatives but I need to work on a game, or I'm testing something out real quick and need a clean environment. When they occur I'll be very happy with this I can already tell. :)

I hope this gets branched in the future, good show!
Life is like an adventure without the pixel hunts.

Armageddon

Just think about it, making a game on the iPad while relaxing in your favorite chair.

Gilbert

This is not what the word "portable" here refers to though, if I understand your meaning.

monkey0506

You're right Gilbot, this isn't a version that has been ported to a non-Windows OS, and seeing as the source is still in C# (same as the "normal" AGS Editor source), it has the same limitations in OS-portability as the "normal" editor.

This source is marked as "portable" because it will use a local XML file if the system registry cannot be written to (for example, if you are running AGS from a USB drive under a Windows user that does not have rights to modify the registry)..as per the original post.

hedgefield

I'd say 'no install required' would be the gist of it, right? Not that I ever had problems running AGS on multiple PC's from one folder in my Dropbox, but it's a nice initiative, and perhaps the first step in making the engine a little more receptive to other OSes in the future.

Gilbert

More or less, but some portable programmes are still distributed in installer form (which are basically just self-extract archives so that you can move or copy freely the created folder anywhere). To be more exact, portability means that the programmes can be (sorta) run from anything (be it an USB thumbdrive, a removable hardisk or whatever) and anywhere (i.e. you can move it to any folder any time and even run it from another computer*), as opposed to normal modern programmes that may cease to function if you move them to other drives and folders, or another computer, apart from the ones that you installed the programmes to. Usually non-portable programmes will use some registry entries to store their info., settings, etc. but portable ones may write these information to files within the programmes' own folders, so that settings may be retained even after you start the programmes from other folders or even other computers.

*Note that, if a programme has some requirements for it to run (such as .NET framework), you still need the computers to meet such requirements to run it even if it is the portable version.

Pumaman

Are there actually any Windows PC's set up to deny access to the HKEY_CURRENT_USER branch of the registry?

AGS doesn't try to write to the LOCAL_MACHINE key, and CURRENT_USER should always succeed, unless the sysadmin has gone crazy with their permission restrictions...

helios123

Quote from: Pumaman on Sun 17/04/2011 15:52:18
Are there actually any Windows PC's set up to deny access to the HKEY_CURRENT_USER branch of the registry?

AGS doesn't try to write to the LOCAL_MACHINE key, and CURRENT_USER should always succeed, unless the sysadmin has gone crazy with their permission restrictions...


:o That is not the reason for writing this code change.

The idea is that if you are working from a USB drive, removable harddisk, etc., the user settings, i.e. Recent games list, image editor, etc. may not always be available if the settings are read from HKEY_CURRENT_USER branch of the registry, as the data will reside on the machine and not on the removable drive.

If, on the other hand, the settings are stored on the removable device itself, then it does away with the need to set up the editor preferences if you plug your removable drive into a different machine. Also, the code change is such that paths on the removable drive can be reconstructed whenever required.

For example, let us say that when the Portable  (no install) version is run for the first time, there will be no settings.xml, and the editor will start with the default settings. Now the user configures the editor as required. Also, most of the times, the image editor and games folders will also reside on the removable drive.
While saving the settings, the drive letter (along with the colon) will be replaced with a placeholder, and while reading, it will be replaced with the drive letter which Windows has assigned to the removable drive, thus ensuring that the paths stay valid on any machine.


To make this point more clearer, please take a look at the below example, given in more detail (this is also briefly explained in the Readme available in the download archive):
Spoiler

Let drive letter of the removable drive is say J:.
User is running the editor for the first time. The preferences are entered and the game folder is J:\Projects\TheGame. The image editor path is J:\editors\imageedit.exe.
When the preferences are saved, the paths will be saved as {*_XMLRegistry_Drive_Replacement_String_*}\Projects\TheGame and {*_XMLRegistry_Drive_Replacement_String_*}\editors\imageedit.exe respectively.

Now suppose a different machine is used the next time, and Windows assigns K: as the drive letter to the removable drive. Then while reading from the XML, {*_XMLRegistry_Drive_Replacement_String_*} will be replaced by K:, resulting in paths which are valid on the new machine. This means that the editor will show the game folder in the 'Continue a recently edited game' dialog, as well as launch the image editor when the user wants to edit any sprites from within the editor.

Both these things cannot be possible if the settings are stored in the Windows registry under HKEY_CURRENT_USER. Also, even if the removable drive is plugged into the same machine always, there is no guarantee that it will be assigned the same drive letter all the times (e.g. a new hard disk was added, and hence the letter earlier assigned to the drive is now used for a hard disk partition, or multiple USB drives are plugged into the machine, etc.).
[close]
That's all for now,
helios123

Shane 'ProgZmax' Stevens

This is a grand idea.  I love portable versions of apps as they are much easier to backup and re-use on demand.

jumpjack

This thread did not last so long....
Does it exist today a portable version of AGS? I don't like running executable installers for programs which do no need direct access to advanced system resources. Isn't AGS just an interactive video player, in last instance?
Even better it would be to have an online version of AGS, so as not to download anything, I've seen several "miracles" made with WASM!

Khris

You don't have to run the installer:
https://www.adventuregamestudio.co.uk/releases/finals/AGS-3.6.1P5/AGS-3.6.1.27-P5.zip

You do need the proper .NET Framework installed but in case you don't, Windows should offer to download it as soon as you try to run the editor.

Crimson Wizard

Is this a question of portable Editor or portable engine (game runner)?
At first I thought you are speaking of the former, but then you referred to it as "interactive video player" which sounds like the game engine.

As Khris said, Editor may be downloaded in an archive and simply unpacked. It does still have system requirements (.NET framework and VC Redist) but other than that may run, for example, from a flash drive that you insert into a random machine.

As for the engine, it has a Web version, that may be be run on a web server and played in a browser. Multiple game developers have used this to create online versions of their AGS games on itch.io, for instance.

PS. But... why dig out a 13 years old forum thread for this?

jumpjack

Quote from: Crimson Wizard on Wed 07/08/2024 17:14:52Is this a question of portable Editor or portable engine (game runner)?
I was talking about editor.

QuoteAt first I thought you are speaking of the former, but then you referred to it as "interactive video player" which sounds like the game engine.
Also the editor is just a matter of "showing images and saving data", from O.S. point of view.

QuoteAs Khris said, Editor may be downloaded in an archive and simply unpacked. It does still have system requirements (.NET framework and VC Redist) but other than that may run, for example, from a flash drive that you insert into a random machine.
Sorry, could not find it.

QuotePS. But... why dig out a 13 years old forum thread for this?
Because this is just what both google and internal search engine reply to query "AGS portable".

Crimson Wizard

Quote from: jumpjack on Wed 07/08/2024 17:26:09
QuoteAs Khris said, Editor may be downloaded in an archive and simply unpacked. It does still have system requirements (.NET framework and VC Redist) but other than that may run, for example, from a flash drive that you insert into a random machine.
Sorry, could not find it.

The download section on the website is inconvenient in my opinion,
but you may find zip download of the latest stable editor under "More downloads for ..." spoiler on this page:
https://www.adventuregamestudio.co.uk/site/ags/

jumpjack

I am getting this error upon running portable 3.6.1: "AGS.Native.dll" file not found or missing dependencies.

Maybe it's due to missing C++ redistributable... but no clues about it in the message.


P.S.
How do I attach images to forum?

Khris

This sounds like you didn't extract the entire zip file first. If you just open it and double-click the exe, Windows will extract it to a temporary folder and run it from there, which means all the other files will be missing.

Right-click the zip, then pick "Extract all".

As for attaching images, I do this:
1) upload to https://imgur.com/
2) right-click the image and open it in a new tab
3) copy the URL (ending in .jpg, .gif, .png)
4) put this in your post
Code: ags
[img]URL_HERE[/img]

Crimson Wizard

#17
So, it's not really "portable"... it would likely become "portable" if it had VC libraries linked along with the program. Engine does that in order to avoid forcing players to install VC redist along with the game. It might be possible to create a Editor distribution that has VC libs linked with the Editor program too, it's just that there was not much of the explicit demand for that in the past.

Necessary VC redistributable may be found by the link on the same page (https://www.adventuregamestudio.co.uk/site/ags/)
Direct link is: https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x86.exe

jumpjack

Quote from: Khris on Thu 08/08/2024 11:15:57This sounds like you didn't extract the entire zip file first.
No, the file was there, but I can now confirm that the editor was not able to find it until I installed C++ redistributable. Once installed, the editor started fine.

SMF spam blocked by CleanTalk