question about AGI-games

Spectre does anyone know how big a WHOLE agi-game can be? I mean when you download it and when it's done - where's tha limit, like 1,5 Mb or what ??? that would be really interesting to know...the other limits for pics, views etc is a well known fact...

pleeez help me/us with this one


regardz // Spectre (working on "Lawman for Hire" - soon to come...)
RaDIaT1oN I don't think that there is a limit on size (in bytes of game data.)  The biggest AGI games I've seen are about 2 Megs, but logic/picture/sound resources can grow large. I haven't dissassembled the original interpreters but I think that these are referenced with short integers, therefore the resources will not exceed 0xFFFF (64 K) bytes.
You also know that you are limited to 16 vols, and each is referenced with a 5 nybble directory entry, so no vols can really be much larger than 0xFFFFF (1 Meg) bytes long.

Doing my calculations going on the 64K resource size limit (which may not be true) Games are limited to 66M, but the 16 vols at 1Meg each obviously limits to 16Meg.

Let me know if this is incorrect.
AGI1122 The size should go up to about 16mb like radiation said. Right now I am working on a game called V and it is about 912kb(almost a mb) so the size can vary depending on the size of the resources in your games. Some time after 1mb is reached a new vol file should appear and contain your new files and data.
Zero I going to try to make my game go to the limit. (if there is one) I want it to be BIG.
Chris(AGISCI I doubt you could make it go to the limit. Just about every resource would have to be giganitic even the ego's view. 16mb is the limit but it is next to impossible to create a game with that size resources. The main reason is that the interpreters are not designed to handle that much data at once and even the new interpreters sometimes have memory problems. NAGI so far is the best but I could not get V to run in NAGI unless I set the script buffer to 255.
sonneveld So you guys want a script buffer with no limits?  I'll fix one up.

Seriously though, if you need that much script space for V, you need to rework your code.

For instance, turn on flag 7 and the script will not be written to.  So, during your intro sequence, turn on flag 7 and turn it off after it's finished.

The script is used to reload all the resources in the exact order they were loaded/discarded.  NAGI and AGI need it for save games and reloading everything whenever the screen renderer is changed.  You're not going to be saving games or toggling monitor types during the intro sequence so it should be alright.

I'll get back to you on limits though.

- Nick
sonneveld Radiation.. you're correct..

The max for a particular resource is around 64k due to 16bit pointers and you couldn't refer to any more than a meg in each resource due to the 20bit dir entry limit.

Now, the number of resources.. in version 2 pc interpreters.. it only actually checks for vols 0...4.  it's version 3 interpreters that allow vols 0...15.  That's why you see Manhunter with so many volumes.

So version 2 games can only have 5 megs.  16 for v3.

- Nick
Zero Well thanks for telling me i appreceate it.  ;D
AGI1122 I don't need NAGI to have no limits it works just fine. Add it only if you want to. It might be usefull for newbies that don't know about script restrictions.

I tried using flag 7 in the original interpreter it still crashed but would let you see more of the game. I don't think it was the script that crashed V. I don't know what caused the crash but NAGI is the only interpreter that works with it. It has something to do with memory but script is not the problem.

I had the script set to 255 on the original and it crashed.
I had the script set to 255 on the NAGI and it worked.
Zero Cool  ;D
sonneveld I'll add some other memory debug code too.
Zero Even cooler. ;D ;D
AGI1122 Boy NAGI just keeps getting better and better. I prefer using NAGI over the original AGI interpreter.

One of these days I will have to make my own interpreter for the fun of it. I have a question for you Nick what is NAGI being programmed in.
RaDIaT1oN I'll take a bet NAGI is written in C.  Most serious programs are.

Nick, will you ever release source code for NAGI, for a Linux port maybe?  I want to play AGI games on linux, but Sarien just didn't cit it, I couldn't finish Space Quest (1.1A).  So I started working on my own, AGIL, available at http://www.elite.za.net/.  It's functional, but NAGI looks cooler (haven't used it, don't have 'doze).
AGI1122 I remember somewhere reading that he would release the source code after he finishes NAGI, cleans up its code, and ports it. At least that is what I remember reading from somewhere.

You think it was written in C. Probably, most professional programs are written in C. Too bad I don't have C. All I have is Visual C++,Visual J++,Visual Basic,and Visual FoxPro. I guess I will have to use one of these to make my own interpreter. Which would you think would be better to try it in.
RaDIaT1oN I would recommend getting Linux or FreeBSD.

If you are stranded with 'doze you can get Mingw32: http://www.libsdl.org/Xmingw32/
It's a free (sort of) unix like environment with a C compiler for 'doze, what the 'doze port of AGIL is compiled in.
For DOS you can get DJGPP: http://www.delorie.com/djgpp/  More native DOS like, but also gcc (GNU C compiler).

I don't recommend using Micro$oft anything.  But C++ if you have to.
AGI1122 Microsoft is all I have so I don't really have a choice. As for linux I am not even too sure of what it is I have never seen or used it.
RaDIaT1oN Chris: Linux is a free Unix like operating system.  You have internet access, and therefore a choice: You can download it.  What I meant is stear clear of Micro$oft compilers, using GCC under DJGPP (DOS), mingw32 (Windoze) is fine (but not posix compliant, gives me some trouble.)

Nick: It has been said that V only works in NAGI,  after making 2 small changes to AGIL is runs fine.  The first was to add "V" to the list of AGI prefixes, this I can easily fix to look for *dir.  The bigger problem is that the messages (in the logic files) are excrypted with "Avis Durgan", when writing AGIL I assumed that whould be the case, but found that in sierra's games the messages in AGI3 games were not excrypted (maybe not all games).  How does your interpreter determine whether the messages are encrypted or not?  (If it is possible that games have some messages encrypted, but not all, this would possibly explain some strange behaviour in Gold Rush!)
AGI1122 Let me rephrase that. V will only work in windows with NAGI. Where can I get linux I think I would like to try it. Also about how big of a download would it be.
Zero Thanks for telling me.  ;D
sonneveld My god, I didn't realise this thread had been updated.  Must have been all those "zero" updates.

NAGI is written entirely in C.  It's source will be released when I'm happy with it.. it's getting there.  I use the mingw compiler/library set.. it's pretty good until you want to use a function that isn't implemented by microsoft's libraries.. like snprintf. Probbaly why there's so many buffer exploits.

I like what you're doing with AGIL and I will have to try it when I have time.  Too much night shift work. :(

I think you've figured it out yourself but AGI v3 only uses the XOR encryption for logics if the resource isn't compressed.  I'm guessing Sierra figured LZW compression was good enough encryption and tried to save some cpu cycles.

Good luck Radiation.

Script buffers.. I hacked up a linked list for the scripts but I'll leave it for a later version of NAGI.  It will break backwards compatiblity with older saves AGAIN and I want to try and implement some sort of more modular save game format so I don't feel so guilty with each new NAGI release and more backwards incompatibility.

- Nick
sonneveld Radiation:

have you looked at NAGI's standard.ini system?  It's my idea of defining different interpreter versions and letting games associate with them.

The idea was to make it interpreter independant so Sarien or even AGIL could use the same database.

Also, does AGIL support save games?  I wanted to try make some sort of standard save system that would work across the different interpreters.  Sarien's got a nice IFF system worked out so we could all work off that.

- Nick
Zero Coool.  ;D
AGI1122 I am going to try out that mingw and try to make my own interpreter.

I don't think I will add any new implimentations like mouse support I will just try to make it run games using the basic AGI functions.

Lets just hope I am not too rusty at programming because it has been a few years. Besides doing programming in AGI logics that is ;D.
Zero Your not rusty at all. Your smater then me when it comes to agi.  ;D
AGI1122 When it comes to AGI yes I know a lot but the interpreter itself I don't know much about except how to open it in C++ and change the id and make a v3 game. Trust me I am rusty but I will remember more of it sooner or later.

I just tried downloading mingw and when it made it to 92% it jumped to 100% then when I tried to open it it says This file is not a valid zip file blah blah blah. Does anyone know how to fix my problem with the download manager that comes with widows or where I can get a better download manager.
Joel Visual C++ is capable of compiling programs written in C, so if you've got it then you do have a C compiler.

However, the version I've got (professional edition) will only create code that runs under DOS or Windows. If you want to port your code you'll need a different compiler (and you'll need to avoid things like MFC).
Nailhead
I'll take a bet NAGI is written in C.
RaDIaT1oN Sorry, Nailhead.  Note that I said MOST.  When I started writing AGIL I was better with Pascal than C, but Pascal has irritating limitations, like no type casting.  Also (mine) objects to pointer arithmetic.  Also no portable.  Also nobody else would even look at the code.

Nick, AGIL has a simple savegame thing, but it's not good at all.  Just dumps everything I could think of to a file (250k).  I also have no idea how the savegames in the original worked, no the script size thing does nothing, and the savegame just saves a list of resources loaded at the time the game is saved, the restore function loads these. I realize that this breaks some things, like when unloading resources all more recently resources loaded are supposed to be freed, but in AGIL they aren't.  There really aren't memory limitations like this on modern PC's anyway.  I doubt that you could learn anything from my code, the only advantage over NAGI is that it runs in Linux. You can get an generic snprintf() implementation that works on mingw32, but I don't know about the license, that is why I'm not using it.  AGIL just uses sprintf in 'doze and DOS. If you define a universal savegame format I will do my best to implement it, but I might need an explanation of the script, and any other stuff left out of the spec.

Chris, when I started writing AGIL I was seriously rusty at C, you don't want to even see some of the code I wrote.  Didn't make it into any releases.

AGI1122 It has been about 3 years since I written my last good quality program. It was a dos password protection system that I made and still use on my computer. It gets called in autoexec.bat I have the password written to a seperate file and use 2 other programs that I made earlier to encrypt and decrypt it using my own special table.

As for the mingw I can't get it. Every time I try it does that jump to 100% thing. The only way I can get files larger than 3mb is if someone sends it by mail. Would anybody be nice enough to download it and send it to me by mail to AGISCI@aol.com I know this is a big thing to askfor but better ask and get a no than not to ask at all.
Nailhead
Sorry, Nailhead.
sonneveld Radiation:

re snprintf:
nah, I wouldn't need it at the moment.. Whenever I use sprintf, I allocate enough room for all the variables at their max size and never use another string without checking it's size. Sierra implemented their own printf and sprintf.. when I have the time I was going to implement a snprintf out of it.. shouldn't be too hard.

When I have time (perhaps tomorrow), I'll start working on a tutorial page with all the tutorials I have cached along with some script info..

if you just save all the resources in the order they were loaded.. that would be just as good.  the script also saves add.to.pic information but that's it.  I wouldn't worry about the fact that AGIL dumps everything because that's basically what sierra did.  They arranged all the important information into a struct and just read/wrote it when they save/restored.  

and in regards with serious C programming.. I hadn't written any serious project before NAGI.. let along a project that used more than one C source file, makefiles, digital sound.. blah blah..  I tried Jave before that (not for AGI.. just other stuff) but only because the uni I go to was using it for programming subjects.

anyway.. it's a big learning experience. :)

- Nick
RaDIaT1oN Similar to me.  I once started writing a lemmings clone for Linux in C++, but my hdd failed.  For school I wrote (what I think) is quite a cool program in Turbo Pascal.  But AGIL is my first real and public project.  I never published anything else.

I should use save the add.to.pic info in my savegames, at the moment I dump the graphics buffers which is why the saves are so large.  The next release will have multislot savegames, and these will include a discription.  Also I have no idea how the graphics buffers were arranged in the original interpreter, I would think something more like Sarien. I thought of doing something like that, but my hugh graphics buffers were just easier to implement.  

Does NAGI have any inline assembler?  The temptation to use asm is overwhelming, but I resist in the intrest of portability.

If this is your first real projects, it's damn excelent.  And dissassembling stuff aswell.  I will try this sometime.  I want to remake Monezuma's Revenge.  But this will be far simpler than AGI, It's just one .COM file (but it does some bad things.)


sonneveld No inline but I was thinking about it for some part of it.. The thing is, the original interpreter was designed for XT's so I have no trouble with speed.

The only bit I can think of is for the future pc speaker support.. but that's probably a bit way off atm.

And when you're thinking about working on the montezuma project.. I'd be happy to join in if you want some people to help..

- nick