Patch:Speed

From KeenWiki
Jump to: navigation, search

This page is a brief tutorial on how speed works in the Commander Keen games and how speed patches can be created. A related tutorial page is Patch:Sprite speed, patches involving game speed can be found at Patch:Game Speed.

Speed is distance covered divided by time taken, therefore there are two ways of controlling speed, namely working with distance or time. The first type of patch is he more common and involves patching the distance something moves over some cycle of time. This is almost indistinguishable from actual speed. These speeds are usually in pixels (16ths of a tile) or 16ths of a pixel (256ths of a tile.) with 'positive' speeds ($0000W-$7FFFW) being right or down and 'negative' speeds ($8000W-$FFFFW) being left and right. There are of course exceptions, notably for sprites. A notable feature of these patches is that values closer to zero make things slower.

The other type of speed patch involves patching the time between moves of a fixed distance. An example is some Keen Galaxy sprites which move a fixed distance every time they animate, so making them animate faster makes them move faster too. A notable feature of these patches is that negative values or zero (Infinite speed) cannot be used and that making the values closer to zero makes things speed up.

The second kind of speed patch also applies to things we think of as having a speed that do not move, such as how fast tiles aniamte or how fast the game plays.

It is possible to patch speeds in decimal, like all patches, which may be simpler for newer modders. A speed of +-10 looks better than $000AW\$FFF6W. However values of 0-256 patch only one byte, which can cause problems. Otherwise patching speeds is quite simple, both action and normal speeds require a simple two byte patch.


Examples

This patch changes the Yorp's walking speed in Keen 1; the first value is walking left, the second value walking right. (Both speeds being equal.) Notice negative values can be used.

Patch: Keen 1
%patch $1A1C $FFC4W 
#If right of Keen after searching (Move left)
%patch $1A14 $003CW
#If left of Keen after searching (Move right)

This patch changes the speed of the pink shot in Keen 5 It's speed can be altered with other patches, but simply changing the animation speed will alter how fast it moves. Notice that negative values cannot be used and decreasing the value makes the shot move faster.

Patch: Keen 5
#Pink shot's speed
%patch $32184 $0008W
#Animation speed 1
%patch $321A2 $0008W
#Animation speed 2
%patch $321C0 $0008W
#Animation speed 3
%patch $321DE $0008W
#Animation speed 4


This patch alters how fast tiles animate in Keen 3. Doubling this value will halve the tile animation speed. Only values of 1 or greater are valid.

Patch: Keen 2
#How fast tiles animate
%patch $80EE $03
#In-game
%patch $8B14 $03
#Main Menu level (Intro, title, story screen, etc.)