Author Topic: C# AGI Interpreter  (Read 60412 times)

0 Members and 2 Guests are viewing this topic.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #60 on: October 07, 2022, 05:57:09 PM »
I can't believe it is coming up 4 years since I last worked on this, and 6 years this December since I began work on it.

I had to read through this topic from the beginning to remind myself where I was up to and what I had tested. So it sounds like I played through KQ1, SQ2 and KQ4 to the end. I also did some exploratory testing on other games, and discovered specific rendering issues in games like MUMG that I fixed. I vaguely recall I still had intermittent issues with saved games but that they were generally working. Rather than continue playing through the rest of the games to the end, and trying to find and fix further issues, I thought it was well past the time I should release an initial build for other people to try out and help find bugs.

I plan to do that this weekend. I'm not far off now. I've worked out how to build an installer for the app, added an icon for it (a random emoji character from Twemoji that I just might keep, as I think it looks cool as an icon, despite not being related), and adding in some of the bare minimum niceties that you'd expect, such as a command line option for game path, and if not present, then checking current dir, and if no game there then pop up a folder selection dialog. And automatic game detection. Oh, and I updated the project to the latest Visual Studio 2022.

What I'm not sure about at the moment is what .NET Framework version to target. By default, it seems to have set it to .NET Framework 4.8. I've read online that there is also a .NET 5 and .NET 6 available, and a .NET 7 preview, but that those are no longer the .NET Framework? Apparently new development should target .NET 6, but Microsoft says that there is no need to migrate existing .NET Framework apps to .NET 6. I've found tutorials online that cover migrating a .NET Framework Winforms app to .NET 5/6 but I'm not sure if it is worth it at the moment. As far as I can tell, .NET Framework 4.8 is available on Windows 7 upwards, so perhaps it is a good one to leave it on for now. It has been around since April 2019.

I should probably mention that I've been building this on Windows 11. Not sure if that makes a difference.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #61 on: October 07, 2022, 07:13:58 PM »
...such as a command line option for game path...

@AGKorson, I was trying to use the command line option in my AGI interpreter ("AGILE") to configure its use with WinAGI, but it appears that the "Optional Command Line Switches" field in the WinAGI Properties dialog doesn't save. I've tried filling it out numerous times, and every time when I reopen the Properties dialog, it is empty again. Attempting to Run the game results in my AGI interpreter starting up in such a way that it is obvious the command line parameters haven't been passed through.

I'm using version 2.2.5 of WinAGI.

Currently my interpreter takes a single command line argument, being simply the path of the folder containing the AGI game files. I've tested it from a DOS prompt and it works fine.

Offline AGKorson

Re: C# AGI Interpreter
« Reply #62 on: October 08, 2022, 02:18:27 AM »
@AGKorson, I was trying to use the command line option in my AGI interpreter ("AGILE") to configure its use with WinAGI, but it appears that the "Optional Command Line Switches" field in the WinAGI Properties dialog doesn't save. I've tried filling it out numerous times, and every time when I reopen the Properties dialog, it is empty again. Attempting to Run the game results in my AGI interpreter starting up in such a way that it is obvious the command line parameters haven't been passed through.

I'm using version 2.2.5 of WinAGI.

Currently my interpreter takes a single command line argument, being simply the path of the folder containing the AGI game files. I've tested it from a DOS prompt and it works fine.

Sorry about that. I'll check it out this weekend and get a fix out shortly.

Offline Charles

Re: C# AGI Interpreter
« Reply #63 on: October 08, 2022, 01:44:09 PM »
What I'm not sure about at the moment is what .NET Framework version to target. By default, it seems to have set it to .NET Framework 4.8. I've read online that there is also a .NET 5 and .NET 6 available, and a .NET 7 preview, but that those are no longer the .NET Framework? Apparently new development should target .NET 6, but Microsoft says that there is no need to migrate existing .NET Framework apps to .NET 6. I've found tutorials online that cover migrating a .NET Framework Winforms app to .NET 5/6 but I'm not sure if it is worth it at the moment. As far as I can tell, .NET Framework 4.8 is available on Windows 7 upwards, so perhaps it is a good one to leave it on for now. It has been around since April 2019.

The whole .Net stuff is such a confusing mess. .NET Framework 4.8 will have the best compatibility, but it's a dead-end. Aside from a minor bugfix release 2 months ago (4.8.1), it stopped development in 2019.  Back about 6-7 years ago, MS rewrote .net from the ground up to make it more platform agnostic. They called the new one .NET Core, retroactively renaming the old one to .NET Framework. That was about the same time they released .Net Framework 4.6.2. They updated both in parallel, and continued to call the new one Core up to .NET Core 3.1. Then the next version they called .NET 5 to make it obvious it was intended to succeed 4.8. Since then .NET 6 has come out, which is the current LTS release.

It's kinda like how Windows XP was the next iteration of the Windows NT product line but still replaced Windows 9x, which was itself a dead-end.

Incidentally, not that this applies to you, but for dll applications to ease upgrading you can compile against something called .NET Standard 2.0, which is a subset of code shared by .Net Framework and .NET. Those dll's will be compatible with both .Net Framework and .Net Core applications. (Not .NET Standard 2.1 though.)

You should be able to compile most of your existing code against .NET 6, but upgrading your project from .Net Framework to .NET isn't a simple 1-click process.  I mean, it's not hard, but changing from one .Net Framework to another .Net Framework is as simple as changing the target in a drop-down; changing from .Net Framework to .NET is not that simple.  There are some pretty fundamental changes to the project files between the two.

I've been slowly moving all my personal and professional projects to .NET 6, and it's been pretty painless for the most part. The biggest hurdle for me was Visual Studio's WinForms designer is buggy on HighDPI displays.  They have a workaround, but that broke in Visual Studio 17.3.1... haven't been able to test later versions, so I've stuck to 17.2.6 for now.
« Last Edit: October 08, 2022, 01:49:14 PM by Charles »

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #64 on: October 09, 2022, 08:17:55 AM »
I now have a github action set up on my repo that builds the AGILE installer package whenever I push to the master branch. So for those who are interested in trying it out already, you can download the package from the latest successful build here:

https://github.com/lanceewing/agile/actions/workflows/build.yml

When you install it, it's going to give you warnings about being an unknown publisher, as that's what I am at the moment  ;D. I'll need to look into how to resolve that.

I know that there are still bugs in the interpreter, in fact a couple of older games fell over when I tried them today, but I wanted to make something available to others already to try out, otherwise I'll probably be testing it forever. If anyone finds any bugs, please let me know, either by posting to this topic, or by raising an issue on the github repo.

I'm keen to know what people think of it.  :D
« Last Edit: October 09, 2022, 08:19:40 AM by lance.ewing »

Offline Collector

Re: C# AGI Interpreter
« Reply #65 on: October 09, 2022, 04:25:38 PM »
It's not building for me. It is not finding the AGI library. Is this your modified AGI library from Visual AGI? Are you going to release the library source, too?

I am using VS Community 2019 on Win10, not sure if that makes any difference other than the installer project is incompatible.
KQII Remake Pic

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #66 on: October 09, 2022, 05:03:47 PM »
I'm using the latest Visual Studio Community 2022. The GitHub action workflow is building it fine but that is probably because I've told it to use windows-latest, which has VS 2022 on it. Yes, the AGILibrary is the one built from my fork of your repo, but I would have also compiled that with VS 2022.

Rather than building from source, have you tried installing and running the built installer from the github action that I linked to? The latest successful build has an artifact called AGILE.zip that you can download, extract and then install by running the setup.exe.

Ah, okay. It looks like the artifact isn't able to be downloaded by other people for some reason. I've just viewed the page, and although the artifact is shown, it doesn't have the link to download it. Not ideal. When I'm logged in, I get the download link. I think I might need to upload a proper release to the releases section as maybe I'm the only one who can see the download link.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #67 on: October 09, 2022, 05:11:10 PM »
Okay, for now I will attach the latest build to this message for people to try. I'm interested to know if it actually runs on people's machines.


Offline doomlazer

Re: C# AGI Interpreter
« Reply #68 on: October 09, 2022, 05:42:28 PM »
Seemed to work well on win10. SQ1, SQ2, KQ3,  Black Cauldron, Manhunter SanFran all launch and work fine on the first few screens. I played PQ1 until I crashed the cruiser with no issues. Seems pretty solid so far!

Edit: it freezes on the soon to be finished SQ1 French translation, but that uses the AGK string hack to support extended characters.Might be nice to see support for that down the road.
« Last Edit: October 09, 2022, 05:54:31 PM by doomlazer »

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #69 on: October 09, 2022, 06:59:56 PM »
Thanks. Great to know that it is working fine for someone else, particularly on Win 10, as I hadn't tried that myself yet. I've been running on Win 11.

Regarding the memory hack, yeah, I was wondering whether I might be able to support that at some point. Would be interesting though, as obviously the code injection itself wouldn't work. Perhaps I can somehow recognise those calls, for certain features, and activate the same features in response. It would break as soon as someone slightly tweaks the injected code though.

Offline MusicallyInspired

Re: C# AGI Interpreter
« Reply #70 on: October 09, 2022, 07:23:36 PM »
Just trying SQ2 now. Works great. The noise channel of Tandy 3-voice comes out a little gimped though. It doesn't sound like it should. For reference, just skip the intro of SQ2 and listen to Roger sweeping the space deck.
Brass Lantern Prop Competition

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #71 on: October 09, 2022, 08:41:50 PM »
Yeah, I'll probably have to go back to the sound, particularly the noise. Do the tone voices sound okay?

In what way is the noise gimped? Do you have a link to a video of SQ2 running on an IBM PC JR for comparison? Original machine rather than emulator. I couldn't find one online for SQ2. There are other games, like BC, but couldn't spot SQ2. I've been trying to implement it based on the SN76496 chip, and what is known about it, but I don't think it is quite right yet.

Offline Collector

Re: C# AGI Interpreter
« Reply #72 on: October 09, 2022, 10:04:50 PM »
Just tried it on KQ4 v2.0. It takes quite a while to load, but seems to run well after it does. This is on Win10 x64 Pro. After tomorrow I'll get a day off and will explore it some more. I still want to try to get it to build on my system. Guess I'll have to install 2022. Do you have any extensions installed that are required? How current is the AGI library on your fork?
KQII Remake Pic

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #73 on: October 10, 2022, 02:54:09 AM »
Yeah, KQ4 is one that I've also noticed takes a while to load. AGILE actually decodes everything up front, which makes it a lot quicker when ego is walking between the various rooms, but for some of the larger games, the delay up front is noticeable. I haven't looked into where the majority of the time is being spent. The LZW decompression of all the V3 resources, in addition to decoding all the resources, might be why the V3 games take a while longer to load. How many seconds would you say it is taking to load KQ4 for you?

The only extension I have installed is the Visual Studio Installer Projects 2022 extension.

Regarding whether my fork of the AGILibrary is current in bitbucket, yes, all the code has been pushed.

Offline Collector

Re: C# AGI Interpreter
« Reply #74 on: October 10, 2022, 07:19:04 AM »
If you cannot speed up the loading, perhaps add a message that it is loading the game so the user knows it is working. At first I thought that AGILE failed to launch.
KQII Remake Pic


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.048 seconds with 24 queries.