Author Topic: Logic resource length  (Read 3943 times)

0 Members and 1 Guest are viewing this topic.

Offline lemur

Logic resource length
« on: October 07, 2002, 05:30:30 PM »
Hi,
Does someone know what maximum length in bytes logics have? For example how big can Logic.002 be without getting problems?

Just wondering cause I've gotten some strange errors where prints are cut and only the first 5 characters are printed. Everything seems to be correct in the code and I get no complaints when I compile.



Offline Nick Sonneveld

Re:Logic resource length
« Reply #1 on: October 07, 2002, 07:11:04 PM »
Well you usually have 32k of free memory when you get to load your own resources.  However, it sounds like a compiler problem though.

- Nick
Nick Sonneveld  |  AGI Dev  |  NAGI

Offline Andrew_Baker

Re:Logic resource length
« Reply #2 on: October 08, 2002, 12:46:47 AM »
I didn't know there was a maximum script length.  I know from experimentation that you can only have 256 #messages, though..
I hope you realize that one day I will devour the Earth.

Offline Joel

Re:Logic resource length
« Reply #3 on: October 08, 2002, 01:01:47 AM »
I think the maximum size of any resource is 65535 bytes, because all the resources have to be stored in the VOL files for the game, and the VOL file only allocates two bytes to store the length of each resource.

I think the limit on messages goes something like this: no more than 256 different messages and the combined length of the messages can't make the whole compiled logic file more than 65535 bytes. You also have to factor in that, for each message number, there has to be a two byte offset that tells where the message is relative to the start of the message section in the compiled logic. Those are included in the 65535 byte limit.

Offline Joel

Re:Logic resource length
« Reply #4 on: October 08, 2002, 01:03:05 AM »
BTW, just because the max. resource size is 65535 byte doesn't mean that a game would work with resources that big. There is a limited amount of memory in each room (65535 bytes total, I think, which includes loading logic 0 and all the views).

Offline Nick Sonneveld

Re:Logic resource length
« Reply #5 on: October 08, 2002, 01:14:33 AM »
actually I think you can access more than 256 messages but I haven't played around with it too much since I think the current compiler won't allow it.

commands like print and display can only access the first 256 messages since you can only send a byte as an argument.. but you can also refer to messages within messages..

"message = %m500"

I'm pretty sure that internally, the agi interpreter reads these numbers as a 16 bit number but I haven't been able to check if it will work properly (I haven't checked load routines 'n stuff yet).

The only reason why I'm interested is because I'm looking into ways to sort of "compress" messages by looking for common strings and taking them out.  If you already have 256 messages defined (like in a quiz or a debug logic) then it would be nice if you could resort to other methods.

- Nick
Nick Sonneveld  |  AGI Dev  |  NAGI

Offline Joel

Re:Logic resource length
« Reply #6 on: October 08, 2002, 02:09:37 AM »
According to the AGI Specs, at the beginning of the text section, the compiled logic stores how many messages there are in a one-byte value (probably so the message offset list can be compressed significantly in the average case...with that byte, only the messages that actually exist need offsets stored).

So, actually, the limit is 255, not 256.

Offline Nick Sonneveld

Re:Logic resource length
« Reply #7 on: October 08, 2002, 05:30:13 AM »
heh.. whoops.  like I said, I still hadn't really looked into it much.  easy to miss (if you don't read the specs) since a lot of values are passed around as words in the interpreter.

the compression idea still stands though.  it might not be as effective as I hoped, but I'll still look into it.

- Nick
Nick Sonneveld  |  AGI Dev  |  NAGI

Offline lemur

Re:Logic resource length
« Reply #8 on: October 08, 2002, 01:45:35 PM »
Thanks guys, I'll see if this will cast some light on this troublesome bugshadow. (?) :-)

Offline Nick Sonneveld

Re:Logic resource length
« Reply #9 on: October 08, 2002, 08:45:02 PM »
once again, if you want, post me the compiled logic and it's source and I'll have a look if you want.

- Nick
Nick Sonneveld  |  AGI Dev  |  NAGI

Offline Eigen

Re:Logic resource length
« Reply #10 on: October 10, 2002, 06:54:59 AM »
Sometimes I get a error message: "Need -56435 have -45348" But if delete some code lines it disseapears. Any thoughts?
Artificial Intelligence Competition

Offline Nick Sonneveld

Re:Logic resource length
« Reply #11 on: October 10, 2002, 07:25:08 AM »
depends.. it might not depend on your logic as much as other things.  it might depend on whether you load too many views or you've converted some music to agi format and it's very large.

- Nick
Nick Sonneveld  |  AGI Dev  |  NAGI

Offline Andrew_Baker

Re:Logic resource length
« Reply #12 on: October 10, 2002, 02:57:30 PM »
Off-topic:  Also, if you use the teleport ("tp") command, you won't reclaim your buffer like you would if you entered a room normally.

On-topic:  So, I'm looking for a way to accurately gauge the limit of my logic files.  Can I view the file size of the compiled logic and use that as a proper yardstick?
I hope you realize that one day I will devour the Earth.

Offline Joel

Re:Logic resource length
« Reply #13 on: October 10, 2002, 05:47:26 PM »
What makes you think that you don't get your buffer back if you use "tp"?

In my game, the tp command is carried out by calling new.room.v(). Unless yours is implemented differently, it should behave no differently than a call to new.room().

I don't believe the max. buffer or max. script numbers ever go down, but the actual amount of memory used does go down.

Offline lemur

Re:Logic resource length
« Reply #14 on: October 10, 2002, 09:52:22 PM »
Must've been some temporary glitch with the compiler. Now everything's working as it should. But this way I learnt alot of good to know things about memory handling in AGI.


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

Page created in 0.06 seconds with 20 queries.