Author Topic: Any AGI engine upgrade projects? Looking for better graphics.  (Read 241 times)

0 Members and 1 Guest are viewing this topic.

Offline OgreVorbis

Any AGI engine upgrade projects? Looking for better graphics.
« on: November 25, 2024, 11:43:26 PM »
There is a conundrum that I have regarding the Sierra engines (both AGI and SCI) and as a result, I keep using AGS (Adventure Game Studio) for all my projects even though they would be more suited to a Sierra engine. I absolutely love text parser games, but there is a problem with AGI and SCI.

The problem is that AGI's graphics are simply too low resolution to be of any value to me. Do understand that I am a retro enthusiast and love pixelated graphics, but I find the AGI engine graphics are just too low to express any sort of real artistic qualities. I think the SCI engine is perfect, graphics wise. The 320 x 200 vector graphics and the bitmap VGA graphics are both great. The problem, however, is that SCI uses that esoteric scripting engine with Lisp syntax. I honestly think it is horrible. I find that I just can not code proficiently enough in it to make a real game with it. I can tell that even if I get smoother over time, it will still hamper my development speed too much.

I would honestly pay someone to do this:
Can someone please upgrade the AGI engine (fork the code) and upgrade the graphics to be just like SCI. I'm not asking for hi-res - just 320 x 200 EGA or VGA bitmap graphics (mode 13h). Forget the vector graphics (unless it's easier) and just use bitmap (or PCX) files for the backgrounds. Maybe the graphics code from the SCI engine could be ported over to AGI? That would be perfect. We'd then have an engine that is easy to use (scripting wise) and would also allow people to express themselves artistically.

I really believe the main reason why this community is small and the AGS forums are so big is because of this exact reason. It's unfortunate when I see somebody using AGS to make a game that is exactly like an old Sierra game (like Julia Minamata's - The Crimson Diamond).

SCI = horrible scripting language
AGI = too primitive graphically

I would love to help to make something like this a reality. If anybody could point me to the region of code that does the AGI graphics, maybe I could look at it and see if I can figure something out. I do have programming experience in C, but I am not proficient in low level DOS code.



Offline lance.ewing

Re: Any AGI engine upgrade projects? Looking for better graphics.
« Reply #1 on: November 29, 2024, 09:35:53 AM »
There does already exist a hack that gives the AGI interpreter 256 colours for both the pictures and the views, where the pictures are no longer vector based but bitmap. The resolution is still 160 wide though, so I assume that that is still too low resolution?

When you say upgrade the AGI engine (fork the code), are you referring to the original AGI interpreter code? If so, unfortunately we don't have a full copy of all of the original AGI interpreter source code. We are lucky to have about 80% of it. The people that implemented the various hacks for the original AGI interpreter would have hacked in small machine language hacks into the executable. It might be possible to do something like that to provide what you want, but I think it might get a bit tricky, as it isn't as "easy" as what the 256 colour hacks did. The problem with a higher width resolution is that it changes many things across the interpreter. The LOGIC file format will have to change, for example, since setting the position of views on screen will need to represent a number bigger than 256, so will require more than one byte. That's just one example. I personally wouldn't be able to update the original AGI interpreter to do that. AGKorson understands the internals of the original AGI interpreter better than anyone, so could probably give a more authorative answer, but I'm guessing it would be a lot of work, even for him.

If you are not necessarily referring to the original AGI interpreter, but could instead live with one of the fan-made AGI interpreters (of which there are quite a few now), then the problem would become easier. The updates to the fan-made AGI interpreter wouldn't be too difficult to make, but you'd then require an AGI editor suite that supports the new formats. As I say, the LOGIC files would be different, the PICTURE and VIEW files would be different. An editor like WinAGI wouldn't understand the format, unless a special fork of that was also created.

I think that the "easiest" way to achieve what you want would be a custom build of WinAGI and AGILE. It would then be its own thing, but closer to AGI than AGS.

Offline AGKorson

Re: Any AGI engine upgrade projects? Looking for better graphics.
« Reply #2 on: November 29, 2024, 07:41:20 PM »
If you want to have something that would run in MSDOS, there is no practical way to expand the resolution. First hurdle is reformatting all resources to use words instead of bytes, then rewriting every graphics function (drawing functions and commands that manipulate graphics). It would be a complete rewrite of the AGI engine. If you're going to do that, then just create something new. (Which is what Sierra did with SCI.)

In the Power Pack mod I developed, AGI is modified to use the MSDOS graphics mode that provides 80 column text. That was relatively easy and doesn't involve any changes to resource formats. As I was working on that, I had to wonder why Sierra never did it. I think AGI games look significantly better when using 80 columns for text instead of 40. But it doesn't address screen resolution for graphics- 160x200 is all you're going to get out of AGI.

The second hurdle is memory management. AGI uses a single 64K segment of memory (allowing easy memory access with just a word value as the offset). Doubling the screen width from 160 to 320 would effectively double graphics resource sizes. It might not seem like a lot, but it is! For anything other than simple fan games, AGI is already severely memory-restricted. You want more graphics? Then you get less scripting and less detailed word dictionaries to make it all fit. Just take a look at some of the late AGI games from Sierra and see what kinds of tricks they had to perform to make everything fit.

In the Power Pack I was also able to create a separate segment to hold text resources, which frees up a substantial amount of memory. But there's no way to easily expand that to cover other resources - most of the game's functions need to be able to address graphics and the overlay resources from within the same segment. (Which is why available memory is even less than 64K- the overlays have to be in the same segment and take up ~7K or 8K depending on version).

As far as forking the source, Lance is correct that original source is not fully known. But that's a trivial matter- The program is a very simple MSDOS EXE file. It disassembles quite easily, and source code is not difficult to create that provides 100% compatibility. The NAGI engine is exactly that. (It probably wouldn't be that difficult to fork NAGI and create a version that outputs an MSDOS program file if you really wanted to do it - time consuming I imagine, but not difficult).

Bottom line is that AGI is inherently limited in graphics due to its memory model and resource formats. To get more resolution you have to go beyond AGI. Just like Sierra did. Like you though, I really dislike their move to the LISP syntax. Frankly, it's the primary reason I never had much interest in studying SCI.

Probably not what you were hoping to hear. But if you did want to poke around in AGI internals, I have fully disassembled all AGI versions, with detailed annotations. I'd be happy to share that with you if you want. I would also suggest looking at NAGI's source. As I said, it was created from disassembled AGI.  And you could take a look at the fragments of source that are available. And I'd be happy to answer any specific questions you might have.

As far as a practical implementation of 'Hi-Res AGI', I agree with Lance that something like his AGILE engine (which is currently under active support) along with an editing suite to handle the resources (WinAGI potentially, but I'm not currently interested in adding support for custom resources) is your best option.

Offline OgreVorbis

Re: Any AGI engine upgrade projects? Looking for better graphics.
« Reply #3 on: December 04, 2024, 03:58:47 AM »
If you want to have something that would run in MSDOS, there is no practical way to expand the resolution. First hurdle is reformatting all resources to use words instead of bytes, then rewriting every graphics function (drawing functions and commands that manipulate graphics). It would be a complete rewrite of the AGI engine. If you're going to do that, then just create something new. (Which is what Sierra did with SCI.)

In the Power Pack mod I developed, AGI is modified to use the MSDOS graphics mode that provides 80 column text. That was relatively easy and doesn't involve any changes to resource formats. As I was working on that, I had to wonder why Sierra never did it. I think AGI games look significantly better when using 80 columns for text instead of 40. But it doesn't address screen resolution for graphics- 160x200 is all you're going to get out of AGI.

The second hurdle is memory management. AGI uses a single 64K segment of memory (allowing easy memory access with just a word value as the offset). Doubling the screen width from 160 to 320 would effectively double graphics resource sizes. It might not seem like a lot, but it is! For anything other than simple fan games, AGI is already severely memory-restricted. You want more graphics? Then you get less scripting and less detailed word dictionaries to make it all fit. Just take a look at some of the late AGI games from Sierra and see what kinds of tricks they had to perform to make everything fit.

In the Power Pack I was also able to create a separate segment to hold text resources, which frees up a substantial amount of memory. But there's no way to easily expand that to cover other resources - most of the game's functions need to be able to address graphics and the overlay resources from within the same segment. (Which is why available memory is even less than 64K- the overlays have to be in the same segment and take up ~7K or 8K depending on version).

As far as forking the source, Lance is correct that original source is not fully known. But that's a trivial matter- The program is a very simple MSDOS EXE file. It disassembles quite easily, and source code is not difficult to create that provides 100% compatibility. The NAGI engine is exactly that. (It probably wouldn't be that difficult to fork NAGI and create a version that outputs an MSDOS program file if you really wanted to do it - time consuming I imagine, but not difficult).

Bottom line is that AGI is inherently limited in graphics due to its memory model and resource formats. To get more resolution you have to go beyond AGI. Just like Sierra did. Like you though, I really dislike their move to the LISP syntax. Frankly, it's the primary reason I never had much interest in studying SCI.

Probably not what you were hoping to hear. But if you did want to poke around in AGI internals, I have fully disassembled all AGI versions, with detailed annotations. I'd be happy to share that with you if you want. I would also suggest looking at NAGI's source. As I said, it was created from disassembled AGI.  And you could take a look at the fragments of source that are available. And I'd be happy to answer any specific questions you might have.

As far as a practical implementation of 'Hi-Res AGI', I agree with Lance that something like his AGILE engine (which is currently under active support) along with an editing suite to handle the resources (WinAGI potentially, but I'm not currently interested in adding support for custom resources) is your best option.

Excellent post. I really appreciate your time.

I understand. Maybe it would be easier to instead replace the script interpreter in SCI to use something more C-like? The end result of that would be almost exactly what I'm looking for also. I'm going to assume that that would also be a major project. However, I wonder if the SCI script engine runs some VM with a type of byte code? (you know, like Java or C# does). Cause if it works that way, then it might not be too challenging to write a new language that compiles into that byte code.

Anyway, I'll look at NAGI for some inspiration, however, I do want it to run on MS-DOS. That's one of my issues with AGS. DOS was the birthplace of these types of games and retro enthusiasts are often going to want to run games like this on period correct hardware. I think I may end up going the route of simply writing my own engine using the DOS version of Allegro. Given that it will be purely a text parser with graphics, I think that might be the easiest way. I think if I just write the C code elegantly, I might be able to make an include file which you could include to make an almost script engine w/o having a script engine if you know what I mean. If I just expose the right functions, it could make the compiled C code work like a sort of scripting language. It would certainly be much faster that way.

Offline Kawa

Re: Any AGI engine upgrade projects? Looking for better graphics.
« Reply #4 on: December 04, 2024, 05:35:14 AM »
There's already been an attempt to have a C-like syntax for SCI, so you're not the first to have this idea.

It didn't go anywhere.

Offline pmkelly

Re: Any AGI engine upgrade projects? Looking for better graphics.
« Reply #5 on: Yesterday at 09:28:11 PM »
Kawa, I was just browsing through the files in your SCI stash and in original/TOOLS.zip I found the following, which I was not aware of previously:

Code: [Select]
ATOS.EXE     - AGI to SCI source code translator
It seems to work when run against some of the original LSL1 files. Not sure if the resulting code compiles, but interesting to see that they actually had developed such a tool. I wonder what it was used for?

Offline lskovlun

Re: Any AGI engine upgrade projects? Looking for better graphics.
« Reply #6 on: Yesterday at 10:59:48 PM »
@pmkelly: In my experience, it doesn't work. It's hard to make it generate any output at all, and the paradigmatic differences between AGI and SCI mean that it can't do a very good job. I'm sure they tried, but if you read the history of how KQ4 came to be, there was a lot of crunch time where external programmers had to be brought in.


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

Page created in 0.083 seconds with 23 queries.