Author Topic: C# AGILE  (Read 83315 times)

0 Members and 1 Guest are viewing this topic.

Offline Collector

C# AGILE
« on: November 02, 2018, 11:32:17 PM »
BTW, lance, not to hijack the thread, but did you get any further with your C# interpreter?
« Last Edit: May 29, 2024, 06:38:21 PM by Collector »


KQII Remake Pic

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #1 on: November 03, 2018, 08:38:56 AM »
I haven't worked on it since May 2017, but I really must get back to it. I had just finished the save game feature at that point, so should be able to try playing through a few games now.


Offline Collector

Re: C# AGI Interpreter
« Reply #2 on: November 03, 2018, 10:13:20 AM »
Perhaps I should split this off its own thread and leave this thread for Nickyv2003's question.
KQII Remake Pic

Offline Collector

Re: C# AGI Interpreter
« Reply #3 on: November 04, 2018, 10:22:34 AM »
Split from Nickyv2003's walkthrough thread.
KQII Remake Pic

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #4 on: November 04, 2018, 11:42:01 AM »
I haven't worked on it since May 2017, but I really must get back to it. I had just finished the save game feature at that point, so should be able to try playing through a few games now.

I've reinstalled Visual Studio, checked out the source code again, and started trying to work out where I got to. It looks like I was starting to work on decoding the sound resources. The AGI Library didn't support that, so I was starting to add that in. I lost my old local checkout of the code when my Windows VM died at some point mid last year. A good thing I was regularly pushing the code to bitbucket.

I think I still had to return to the rendering at some point. It was mostly in line with the original AGI interpreter, but there were a few areas where it wasn't quite right. To be honest though, it would only have been in quite obscure scenarios and probably difficult to notice.

Offline Collector

Re: C# AGI Interpreter
« Reply #5 on: November 04, 2018, 04:02:36 PM »
Did I ever give you the source to the Visual AGI sound editor? They never got around porting it to C# from C++, but it may be of some help. And if you get anywhere with adding it to the AGI Library it could help with adding it to the rest of Visual AGI IDE. At that point the only big thing left for it would be the compiler. I did contact Gustaf Wennerholm on Facebook a while back. He probably be interested if we managed to complete Visual AGI.
KQII Remake Pic

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #6 on: November 05, 2018, 02:17:43 PM »
Yes, I think you did send it to me, and I have got it somewhere. I will probably take a look at it to get some ideas.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #7 on: December 26, 2018, 01:33:07 PM »
I've been making some progress on the C# AGI interpreter. The sounds are now playing. I went down the route of using some SN76489 emulation code to generate 16 bit  sample data at 44100 samples per second. The SN76489 is the sound chip used in the IBM PC Jr and therefore what Sierra coded the original AGI interpreter to output to. As you probably know, all the AGI sounds had four part sound as a consequence of this, the fourth voice being noise. I found some SN76489 emulation code already available on the Internet written in C#. It was part of a VGM Player written in C#. The author had ported the code to C# from another project. I thought I'd see if I could make use of it in this C# AGI interpreter. Seems to do the job well. When an AGI sound is played, the interpreter now uses the raw SOUND data to feed into the SN76489 emulation to produce the samples, then wraps it up with Wave file headers, and then plays it as a Wave file memory stream. I've tried playing the generated Wave file data with three different media playing libraries. One is the built in C# SoundPlayer, which works but isn't as flexible for checking whether the background sound has finished playing. I've also tried the NAudio and CSCore libraries. CSCore seems the nicest from what I've seen so far.

So its coming along. I'm now starting to play through a few games to pick up more bugs. Found a few already. I'll keep doing that for a few weeks I think.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #8 on: December 27, 2018, 06:19:48 AM »
I've finally managed to get to the top of the beanstalk in KQ1, with the help of the saved game functionality. Even with it it took me about 15 minutes to get to the top.  :)

So this is now as far as I've got through playing KQ1 with the new C# interpreter. In the process of climbing the beanstalk, I exhausted all the free saved game slots and wrapped around to overwrite the first one again. Seems I have a bug in there somewhere, because it then falls over when I try to restore it. Should be easy to track down. I suspect that it is incorrectly keeping track of the number of saved games and doesn't account for the limit. Something like that. I'm going to fix that first then continue on with playing KQ1 through to the end. I'm about two thirds through the game I'd say.

Offline Collector

Re: C# AGI Interpreter
« Reply #9 on: December 27, 2018, 09:12:29 AM »
Nice to see progress.
KQII Remake Pic

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #10 on: December 28, 2018, 11:19:33 AM »
Seems I have a bug in there somewhere, because it then falls over when I try to restore it. Should be easy to track down. I suspect that it is incorrectly keeping track of the number of saved games and doesn't account for the limit. Something like that. I'm going to fix that first then continue on with playing KQ1 through to the end. I'm about two thirds through the game I'd say.

Turns out that there were two bugs in there. One bug exposed the other one. Both are fixed now, and saving and restoring games seems to be fully working.

And I just finished playing through to the end of KQ1!    :)

The strange thing is that I've noticed a few issues when playing my Ruby Cast  demo. I'll have to check those out. I'm surprised I didn't see similar issues in KQ1. They are the kind of issues, to do with sentence recognition, that I would have thought would have affected KQ1 as well. But maybe Ruby Cast is more broken than I thought. I'll have to try it in the original AGI interpreter and compare.


Offline lance.ewing

Re: C# AGI Interpreter
« Reply #11 on: December 30, 2018, 04:27:14 PM »
The strange thing is that I've noticed a few issues when playing my Ruby Cast  demo. I'll have to check those out. I'm surprised I didn't see similar issues in KQ1. They are the kind of issues, to do with sentence recognition, that I would have thought would have affected KQ1 as well. But maybe Ruby Cast is more broken than I thought. I'll have to try it in the original AGI interpreter and compare.

I have now fixed the parsing issues that I had noticed in The Ruby Cast. I can see why they didn't affect KQ1. I did find some rooms in SQ2 where the bugs could be seen though. But all fixed now.

I fixed a number of other bugs as well, including a long standing picture bug with the Space Quest 2 title screen. Turns out that the Visual AGI library had a bug in it where it wasn't executing "Fill" commands in some scenarios where it should have been.

The only bug I'm aware of that is currently outstanding is associated with sound playing. It seems that it holds down some notes for too long. It isn't obvious with most sounds, but there are a few where a note is held down for far too long. I'll start looking at that now.

And then after that I'll be adding AGI v3 support to Visual AGI's AGI Library. Should be straight forward.

Offline Collector

Re: C# AGI Interpreter
« Reply #12 on: December 31, 2018, 03:27:33 AM »
I'll be interested to see the changes to the library.
KQII Remake Pic

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #13 on: January 01, 2019, 05:17:44 PM »
The only bug I'm aware of that is currently outstanding is associated with sound playing. It seems that it holds down some notes for too long. It isn't obvious with most sounds, but there are a few where a note is held down for far too long. I'll start looking at that now.

And then after that I'll be adding AGI v3 support to Visual AGI's AGI Library. Should be straight forward.

The sound bug has been fixed now, and I have also added the ability to load AGI V3 games.

So far I have tried KQ4, Gold Rush, MH1, and MH2. Haven't tried the AGI V3 build of BC yet. - For KQ4, the whole opening story played through fine, with the music playing nicely in the background. Didn't spot any issues. But after the game itself started, ego's loop wasn't changing when I changed walking direction. It did, however, change loops properly and as expected when ego walked into water, which means the mechanism itself is fine, but for some reason the default ego View isn't switching loops. I will take a look at that over the next day or so.

In Gold Rush, I spotted a minor issue to do with the user input prompt. Might take a look at that one tonight.

In MH1 and MH2, both games fell over with an Exception. Haven't taken a look to see why yet. In the case of MH1, the opening story/credits played through fine, but in MH2, it crashes almost immediately. I haven't yet implemented the AGI V3 specific commands, so might be to do with that. I guess I'll find out soon.

Offline lance.ewing

Re: C# AGI Interpreter
« Reply #14 on: January 05, 2019, 07:10:41 AM »
For KQ4, the whole opening story played through fine, with the music playing nicely in the background. Didn't spot any issues. But after the game itself started, ego's loop wasn't changing when I changed walking direction. It did, however, change loops properly and as expected when ego walked into water, which means the mechanism itself is fine, but for some reason the default ego View isn't switching loops. I will take a look at that over the next day or so.

I've fixed this one but it was an interesting problem. The main Rosella ego View has 5 loops. Not certain yet whether the extra one was in the original game or whether it inadvertently was added at some point when loaded into an editor. I'll try to rule that out soon.

I discovered another issue to do with non-default base priority values. KQ4 uses a base priority of 73. My priority band calculations were incorrectly using this. It has now been fixed.

I'm quite keen to try playing the whole of KQ4 through now and see where I get to.

In Gold Rush, I spotted a minor issue to do with the user input prompt. Might take a look at that one tonight.

Also fixed.

MH1 and MH2, both games fell over with an Exception. Haven't taken a look to see why yet. In the case of MH1, the opening story/credits played through fine, but in MH2, it crashes almost immediately. I haven't yet implemented the AGI V3 specific commands, so might be to do with that. I guess I'll find out soon.

There were several issues with the Manhunter games. Their logic scripts seem to do things that pretty much none of the other games do. This revealed a couple of areas where I wasn't quite doing things the same as in the original AGI interpreter, particularly around room changing and game clock updates. That is fixed now.

It is now possible to play both MH games. The main thing outstanding is the hold.key and release.key AGI v3 commands. Currently without them it means the round ball "ego" that you move around on the maps doesn't stop moving if you stop pressing the cursor key. Shouldn't take much to implement hold.key and release.key to resolve this.



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

Page created in 0.033 seconds with 23 queries.