Page 1 of 1

Release - ACK Mega Patch (partial feature set)

Posted: Fri Jul 16, 2010 11:10 am
by rld
The first installment of the "ACK mega patch" is ready for download at:

http://www.mediafire.com/ack-mega-patch

Here are the features I have working so far:

1) The following commands may be optionally blocked by
setting variable bits: LOOK, GET, DROP, ATTACK, TALK.

2) Fixed the combat message displayed by the "HIT PLAYER WITH WEAPON" action.

3) The 'info' screen can optionally be skipped, going directly to the inventory screen.

4) Encumberance calculations can be optionally ignored.

5) The D variable can be set to record the direction that the player is attempting to move in. This allows things like terrain that can only be crossed in one direction to be implemented.

6) A new optional set of formulas can be used for generation of weapon damage and armor protection values. This allows 'die-roll' types of formulas, so a weapon could be set up (for example) to do 3d6+2 points of damage.

7) The "T" variable can be set to trigger a 'time stop' when set to a non-zero value. While time is stopped, creatures will not move or attack, although the player can still attack and talk to them normally.

8) Region names can now be displayed for worldmap-type regions (above the map, centered) in the same manner that room names are displayed in room-type regions.

9) Fixed the touch macro, which can now be triggered by ranged as well as melee weapons. When the touch macro runs, the X and Y variables are set to the location of the creature that triggered the touch macro.

The ZIP package for the patch contains more documentation of these changes, the binary patch files (ACK02.EXE and ACK02.OVR) that need to be copied into the ACK distribution, and the modified source files.

Side note - anyone who would like to mirror this file on their own site, go ahead. Mediafire is free and relatively easy to use, but it does seem to throw a *lot* of pop-up ads at you when you download a file.

Posted: Fri Jul 16, 2010 9:05 pm
by Heather Harrison
Thanks. Some of these will be immediately useful as I work on the Ultima II remake. I have downloaded it, and I'll begin trying it out soon. I will let you know how it works out.

Heather

Posted: Sat Jul 17, 2010 10:36 am
by Garth's Equipment Shop
Wow great work rld!

Posted: Thu Jul 22, 2010 10:37 pm
by Heather Harrison
So far, it works well. I'm using the creature touch macro, the dice roll feature, and the negate time feature. It is nice to have the touch macro fixed, and the dice roll feature for weapons and armor helps combat to make more sense.

Good work.

Heather

Posted: Tue Sep 28, 2010 10:50 am
by rld
Version 0.2 of the ACK mega-patch has been uploaded to the same link as shown above.

Changes in this version:

Code: Select all

o  When the player calls up the inventory list, or selects an 
   item for the Use, Drop, or Ready commands, the transparency mask
   for the item icon is now masked out (displayed as black).

o  Added extended hooks to DRAW macro command to allow arbitrary 
   tiles to be drawn from the standard and alternate tilesets.

o  Added extended hook to DRAW macro command to allow additional 
   tilesets for the standard set to be loaded on-the-fly.

o  Automatic experience granting (from creature kills) can be 
   disabled by setting bit 11 of the Z variable to 1.

o  Creatures may now be set to be invulnerable (always take zero
   damage) to certain types/classes of weapons.  The 'type' of a
   weapon is stored as a bitfield in the low byte of the weapon
   weight field, while the 'invulnerable to weapon X' flags for
   a creature are stored in the low byte of the creature's EXP
   field.

   Weapons may be of no type or one or more types; creatures may
   be invulnerable to no weapon types, or one or more weapon 
   types.

   This feature is enabled by setting bit 12 of the Z variable to
   1.

o  A specified macro (with its number stored in the high byte of
   the T variable) may now be called automatically upon game
   restore.

   This feature is enabled by setting bit 13 of the Z variable to
   1.

Posted: Wed Sep 29, 2010 12:47 am
by Heather Harrison
These changes look useful. I will download it and try them out. The ability to swap tilesets will be helpful with my Ultima II remake. Since it is so large, it will be nice to vary some of the tiles to give locations their own unique feel.

Thanks.

Heather

Posted: Fri Oct 08, 2010 11:25 am
by Garth's Equipment Shop
I'm sure i asked this before somewhere but a search of thread titles and reading through those I thought might be where I asked turned up nothing so I'll just ask again.

Can you two please explain to me this setting a certain bit of a variable? And low or high byte? This is all greek to me. :P

Does this make it possible to use a variable more than once in a game? Can you use a bit of a var and still use the same var normally elsewhere in game?

Also if the megapatch requires certain variables to remain unused in a game that uses megapatch, then the patch probably ought to include a list of variables for the game designer to make sure he/she avoids using other than for megapatch related purposes.

Posted: Mon Oct 11, 2010 11:41 am
by rld
Garth's Equipment Shop wrote: Can you two please explain to me this setting a certain bit of a variable? And low or high byte? This is all greek to me. :P
If you look at the ACK manual, the 'general-purpose' variables (A through Z and A2 through Z2) are divided into two groups.

The first group (A-G and A2-G2) can hold values in the range of 0-255, while the second group (H-Z and H2-Z2) can hold values from 0-65535 (the manual says 65534 but this is most likely a typo).

The reason these range restrictions exist is because of the amount of computer memory that is used to store these variables.

The smaller variables (A-G, A2-G2) have one byte of storage (8 bits) for each variable. The variables are stored in binary format, which means that each bit represents the presence or absence of a power-of-two value. The values for all 8 bits are summed to form the value of the variable. Using the typical convention, 'bit 0' represents the smallest value bit and 'bit 7' represents the highest value bit, so the values represented by each bit are:

bit 0 - 1
bit 1 - 2
bit 2 - 4
bit 3 - 8
bit 4 - 16
bit 5 - 32
bit 6 - 64
bit 7 - 128

So, for example, if you store the value 23 in one of these variables, this is represented by setting bits 0, 1, 2, and 4 to 1, and all other bits to 0, so the value is:

variable = 128*0 + 64*0 + 32*0 + 16*1 + 8*0 + 4*1 + 2*1 + 1*1
or,
variable = 16 + 4 + 2 + 1 = 23.

If you set all the bits in the variable to 0 (binary value 00000000b), this represents 0, and if you set all the bits in the variable to 1 (binary value 11111111b), this represents the sum of all the bits, or 255.

The larger variables are stored using 16 bits (maximum value 65535) which operate in the same manner.

For the 16 bit variables, you can also consider them as the sum of a 'low byte' and a 'high byte', where each byte is 8 bits. If you look in the ACK source code, this is actually the way these variables are stored internally, such that

variable value = (low byte value) + (high byte value * 256)
Garth's Equipment Shop wrote: Does this make it possible to use a variable more than once in a game? Can you use a bit of a var and still use the same var normally elsewhere in game?
No, you are using the same variable in either case. For example, if you have variable A set to 10 (binary value 00001010b), and you set bit 7 to 1, the new value of variable A will be 138 (10001010b).
Garth's Equipment Shop wrote: Also if the megapatch requires certain variables to remain unused in a game that uses megapatch, then the patch probably ought to include a list of variables for the game designer to make sure he/she avoids using other than for megapatch related purposes.
The list of variables used is included in the 'readme.txt' file in the megapatch ZIP. The current list is: W, X, Y, and Z.

Variables T and D are also used, but only if you have the corresponding features enabled by setting the appropriate bits in variable Z.

Re: Release - ACK Mega Patch (partial feature set)

Posted: Tue Oct 12, 2010 8:22 am
by Tdarcos
rld wrote:The first installment of the "ACK mega patch" is ready for download at:

http://www.mediafire.com/ack-mega-patch

The ZIP package for the patch contains more documentation of these changes, the binary patch files (ACK02.EXE and ACK02.OVR) that need to be copied into the ACK distribution, and the modified source files.

Side note - anyone who would like to mirror this file on their own site, go ahead. Mediafire is free and relatively easy to use, but it does seem to throw a *lot* of pop-up ads at you when you download a file.
I'll go along. I've downloaded the file and uploaded it to my company's website. This file can be downloaded from
http://viridian-development.com/ack_mega.zip

Posted: Fri Nov 19, 2010 11:11 pm
by Garth's Equipment Shop
rld wrote:
Garth's Equipment Shop wrote: Does this make it possible to use a variable more than once in a game? Can you use a bit of a var and still use the same var normally elsewhere in game?
No, you are using the same variable in either case. For example, if you have variable A set to 10 (binary value 00001010b), and you set bit 7 to 1, the new value of variable A will be 138 (10001010b).
Ok wait, I think i followed you up to this point. So how did you just add 10 to bit 7's value of 128? You can set bit seven directly without it automatically resetting the other bits you already set before? I thought that the only way to set any bits was to assign a value to the variable. Like set A=128 which would simply reset the variable and all 7 bits to
10000000 thus cancelling out the previous value of 10 or whatever was declared before.

I'm also wondering why you list the bits backwards from largest to smallest when you add them up to get the resulting variable value. why not just stick to their logical order which is lowest bit = lowest value.. bit 0 = 1... bit 7=128...in other words this:
rld wrote:variable = 128*0 + 64*0 + 32*0 + 16*1 + 8*0 + 4*1 + 2*1 + 1*1
or,
variable = 16 + 4 + 2 + 1 = 23.
becomes:

variable = 1*1 + 2*1 + 4*1 + 8*0 16*1 + 32*0 + 64*0 + 128*0
or
variable = 1 + 2 + 4 + 16 = 23

Much less confusing for non-mathematicians like me. :P I suspect you have some good reason for typing it out backwards though.

Posted: Fri Nov 19, 2010 11:43 pm
by Garth's Equipment Shop
Hey rld, in the documentation for the megapatch v0.2 could you provide a simplified scheme or table showing exactly what value you would assign to Z or other variable, to achieve the corresponding desired patch feature?

Oh wait, can more than one feature be used if they all use the same variable? I'm guessing you have to decide which features you want, look up the bit values that correspond to each, add them up, then plug that total into the variable to turn them on. Right?

So there would be a different total value for Z for every combination of features one wishes to put into their game right? Hmm. Maybe what we need then is some kind of simple calculator that instead of numbers you select the features you want and when you press the equals or add button it produces the total value you would plug into Z?

Posted: Tue Nov 23, 2010 1:13 pm
by rld
Garth's Equipment Shop wrote: Ok wait, I think i followed you up to this point. So how did you just add 10 to bit 7's value of 128? You can set bit seven directly without it automatically resetting the other bits you already set before? I thought that the only way to set any bits was to assign a value to the variable. Like set A=128 which would simply reset the variable and all 7 bits to
10000000 thus cancelling out the previous value of 10 or whatever was declared before.
You can use the following two bit operations in macros to set/clear individual bits in a variable without affecting other bits in that variable:

Logical AND - SET <variable> = <variable> & <value>
Logical OR - SET <variable> = <variable> | <value>

Here's how this works. Focusing on 8-bit variables for simplicity, the value of each bit is

bit 0 - 1
bit 1 - 2
bit 2 - 4
bit 3 - 8
bit 4 - 16
bit 5 - 32
bit 6 - 64
bit 7 - 128

To set a bit in a variable, do a logical OR of that bit's value with the variable. For example, to set bit 3 (value 8) in variable C, do

SET C = C | 8

To clear a bit in a variable, do a logical AND of (255 - bit value) with the variable. For example, to clear bit 5 (value 32) in variable B, do

SET B = B & 223
Garth's Equipment Shop wrote: I'm also wondering why you list the bits backwards from largest to smallest when you add them up to get the resulting variable value. why not just stick to their logical order which is lowest bit = lowest value.. bit 0 = 1... bit 7=128.
It doesn't really matter; you could do it either way. Writing it from highest bit to lowest matches the way you read it when written in binary (left to right), with the highest bit on the left and the lowest bit on the right:

Decimal: 65
Binary: 01000001
Value: 0*128 + 1*64 + 0*32 + 0*16 + 0*8 + 0*4 + 0*2 + 1*1 = 65

The easiest way to get familiar with all of this is to get a good calculator (either a physical one or a software one on your computer) that can do calculations in decimal, hex and binary, and just play around with it. The 'calc' program that comes with Windows can display decimal/binary and can also do logical operations like AND, OR, etc.

Posted: Tue Nov 23, 2010 1:21 pm
by rld
Garth's Equipment Shop wrote: Oh wait, can more than one feature be used if they all use the same variable? I'm guessing you have to decide which features you want, look up the bit values that correspond to each, add them up, then plug that total into the variable to turn them on. Right?
That's correct. So for the feature changes enabled by setting bits in the Z variable, the bit values are as follows:

1: Z.0 - Set to 1 to block [L]OOK
2: Z.1 - Set to 1 to block [G]ET
4: Z.2 - Set to 1 to block [D]ROP
8: Z.3 - Set to 1 to block [A]TTACK
16: Z.4 - Set to 1 to block [T]ALK
32: Z.5 - Set to 1 to skip Info screen
64: Z.6 - Set to 1 to ignore encumberance
128: Z.7 - Set to 1 to store direction in var D
256: Z.8 - Use die-roll system for weapon and armor calculations
512: Z.9 - Check T for time freeze
1024: Z.10- Display region names for worldmap regions
2048: Z.11- Don't automatically grant experience from killed creatures' EXP fields
4096: Z.12- Use flags in creature EXP and weapon weight for resistant to weapon X feature
8192: Z.13- Call macro T(high) after a game restore

So, if you want to use the 'ignore encumbrance' feature, the 'time freeze' feature, and the 'resistant to weapon X' feature, you should set variable Z to 64+512+4096 = 4672.

In binary, this is 1001001000000. You can see in this form that bits 6, 9, and 12 are set to 1, corresponding to the three features we selected above. (You are counting from right to left here, and the rightmost bit is bit 0.)

Posted: Tue Nov 23, 2010 3:46 pm
by Garth Lurking
Holy crap lol. Confusing as hell but I think I follow. Oh an you went up to 13 bits there. Thats for 16 bit variables?

Could you show an example of an actual line in a macro that sets just one bit of a variable? Also one that sets all 8 bits at once.

And if it is possible to use this bit setting technique on other variables would it be possible to check a certain bit for a certain value or range of values like you would a normal variable? could you show an example of that too? :D

Posted: Wed Nov 24, 2010 10:06 am
by rld
Garth Lurking wrote:Holy crap lol. Confusing as hell but I think I follow. Oh an you went up to 13 bits there. Thats for 16 bit variables?
Right. The bit value list for an 8 bit variable is:

bit 0 - 1
bit 1 - 2
bit 2 - 4
bit 3 - 8
bit 4 - 16
bit 5 - 32
bit 6 - 64
bit 7 - 128

16 bit variables include the above, plus:

bit 8 - 256
bit 9 - 512
bit 10 - 1024
bit 11 - 2048
bit 12 - 4096
bit 13 - 8192
bit 14 - 16384
bit 15 - 32768
Garth Lurking wrote: Could you show an example of an actual line in a macro that sets just one bit of a variable? Also one that sets all 8 bits at once.
Here are a few examples.

Code: Select all

SET A = A | 1       &#40;set bit 0&#41;
SET A = A | 8       &#40;set bit 3&#41;
SET A = A | 96      &#40;set bits 5 and 6 - 32+64&#41;
SET A = A & 254     &#40;clear bit 0&#41;
SET A = A & 223     &#40;clear bit 5&#41;
SET A = 15          &#40;set to 00001111 binary,
                     setting bits 0,1,2,3 and
                     clearing bits 4,5,6,7&#41;

SET Z = Z | 2048    &#40;set bit 11&#41;
SET Z = Z | 32768   &#40;set bit 15&#41;
SET Z = Z & 31743   &#40;clear bits 15 and 10&#41;

If you enter in a value above 32767 in a macro, it will display it as a negative number; this is due to the way ACK handles signed values in macros. The number is still correct internally, however, so don't worry about it.
Garth Lurking wrote: And if it is possible to use this bit setting technique on other variables would it be possible to check a certain bit for a certain value or range of values like you would a normal variable? could you show an example of that too? :D
From Chris' change notes:

"New operators for macros: & (and), and | (or). Useful for bitwise operations, allowing you to store lots of yes/no values in a single variable. For example, "SET A = A | 64" and "IF A & 64 THEN...""

So, you can check if a bit is set in a variable with

IF <variable> & <bitvalue> THEN ...

using the bit values listed above. So, for example you could check to see if bit 4 was set in variable A with

IF A & 16 THEN 8

Also, Wikipedia has good explanations of the logical AND (&) and logical OR (|) operators; see:

Logical AND

Logical OR

I am the key master. Are you the logic gate keeper?

Posted: Thu Nov 25, 2010 5:08 am
by Garth Sierpinski
So great that there are more observant and knowledgeable people around here than I that do not mind offering me a hand up once in a while when i need it. Thanks rld. Armed with this new information I shall boldly go where no Garth has gone before!

Posted: Thu Mar 10, 2011 4:48 am
by BlueTemplar
Hi everyone,

rld I send you a mail about a modification in the source code, have you received it ?

Posted: Thu Mar 10, 2011 11:17 am
by rld
BlueTemplar wrote:Hi everyone,

rld I send you a mail about a modification in the source code, have you received it ?
I got it, thanks. I will look at adding those changes to the 0.3 patch.

I started a new thread for your question on using the 'restore game' macro patch feature.