home *** CD-ROM | disk | FTP | other *** search
- --PRESS ESCAPE TO EXIT-- -------------------------------
- MAP-STATION V1.02 DOCUMENTATION
- -------------------------------
- -------------------
- -- Starting note --
- -------------------
-
- This is the complete documentation for the program. A simple on-line
- help is available within the program by pressing [HELP] on the keyboard.
- This help is available at all times except when a file requester or the
- icon bar is displayed.
-
- -----------------------------
- -- Purpose of this program --
- -----------------------------
-
- This program is a game level-map editor which I have produced to aid me
- in designing the levels for a game I am currently in the process of
- developing in assembly language.
- The way a level is made up is out of a collection of graphical
- blocks which can vary in size (usually 16x16 or 32x32 pixels). When the
- blocks are originally created within a paint program they are drawn so that
- they will fit together to make larger objects. If done properly a level of
- a game can take up considerably less memory than having the level made out of
- one big picture (which if the level was of a reasonable size would be
- larger than available memory as a single 320*256 32 colour screen eats up
- over 50k alone) and can look just as good.
- Without a map editor it can be a real chore designing a level in any
- programming language because the block numbers have to be typed in by hand as
- data statements (BASIC), dc statements (ASSEMBLY) etc. This can be a
- laborious process especially if the level is quite big and also you don`t
- instantly know what the level is going to look like.
- A map editor allows you to select a block from the amount available and
- using the mouse paste it onto the level map at any position. This way you
- can see straight away what the level is going to look like when it is in
- the actual game and any mistakes can be corrected or changes can easily be
- made. As more blocks are drawn they can easily be added to the list available
- for use within the level.
-
-
- --------------------------
- -- Usage of the program --
- --------------------------
-
- This editor can be controlled using a combination of icons and keyboard
- presses. Some functions are available using both while others are only
- available using one or the other. The map editor has five separate modes
- which have their own screen and some functions are only selectable when on
- the particular screen related to the function. The five modes are:
-
-
- Block cut - Used for cutting blocks from an IFF picture
-
- Block select - Used for selecting which block to paste onto the map
-
- Block edit - Used for editing existing blocks and making new blocks
-
- Map edit - Used for pasting blocks onto the map and removing blocks
-
- Cut-Buffer mode - Used for grabbing chunks of the map or for creating
- chunks to paste onto the map
-
- The menu is activated by moving the mouse to the top of the screen and
- pressing the right mouse button. The menu bar will then glide to the top
- of the screen and an option can be selected or you can remove the menu (by
- pressing the right mouse button again - with the mouse at the top of the
- screen). At this point the menu will then glide off the bottom of the
- screen.
-
- The menu options are:
-
- Row one
- -------
-
- 1. Load IFF - Loads an iff picture for cutting blocks from (only in Block
- cut mode).
- 2. Load Level - Loads a complete level into level bank (Palette, Blocks,
- Map).
- 3. Save Level - Saves complete level from level bank (Palette, Blocks,
- Map).
- 4. Load Blocks - Loads new blocks into bank.
- 5. Save Blocks - Saves current blocks from bank.
- 6. Load Map - Loads new map into bank.
- 7. Save Map - Saves current map from bank.
- 8. Clear Blocks - Clears blocks from bank.
- 9. Clear Map - Clears map from bank.
- 10. Exit program - Does just that.
-
-
- Row two
- -------
-
- 1. Block Cut - Enter Block-Cut mode.
- 2. Block Select - Enter Block-Select mode.
- 3. No option.
- 4. Block Editor - Enters Block-Edit mode.
- 5. No option.
- 6. No option.
- 7. No option.
- 8. No option.
- 9. Map Editor - Enters Map-Edit mode.
- 10. No option.
-
-
- Row three
- ---------
-
- 1. Store Block - Stores selected block from block-cut screen.
- 2. Merge Blocks - Merges two blocks (One over the other).
- 3. Set no. of Blocks - Set number of blocks available.
- 4. Block X-Flip - Flips edit block horizontally.
- 5. Block Y-Flip - Flips edit block vertically.
- 6. Block Insert - Inserts edit block into bank.
- 7. Block Replace - Replaces block in bank with edit block.
- 8. Erase Block - Clears block from block edit screen.
- 9. Set Map Dimensions - Set new height and width of map (Block-Edit mode).
- 10. No option.
-
-
- Available in all modes
- ----------------------
-
- Load entire level - Select the "Load Level" icon (Row 1, Column 2) to load
- Palette data, Map data and Block data together.
-
- Save entire level - Select the "Save Level" icon (Row 1, Column 3) to save
- Palette data, Map data and Block data together.
-
-
- Block cut mode
- --------------
-
- Load IFF - Select the "Load IFF" icon (Row 1, Column 1) to load an IFF
- picture from which to cut blocks from.
-
- Cut Block - The block to be cut out is outlined using a 16x16 box which is
- moved around with the mouse. The left mouse button is then pressed to lock the
- box onto the block. To grab the block either call up the menu and click the
- "Store" icon (Row 3, Column 1) or press the [G]rab key. The display will then
- momentarily flip to the Block select screen where you store the block by
- clicking with the left mouse button on the place you want it to go. After
- this has been done you will return to the Block cut screen. To release the
- box again press the right mouse button.
-
-
- Block select mode
- -----------------
-
- Load Blocks - Select the "Load Blocks" icon (Row 1, Column 4) and then
- select the name of the block screen to load using a file
- requester.
-
- Save Blocks - Select the "Save Blocks" icon (Row 1, Column 5) and select
- the name of the block screen to save using a file requester.
-
- Delete Blocks - Select the "Delete Blocks" icon (Row 1, Column 8).
-
- Merge 2 blocks - Select the Merge Blocks" icon (Row 3, Column 2) and click
- the left mouse button on the block to use as the background
- and the right mouse button on the block to use as the
- foreground the click the left mouse button on the place to
- store the block.
-
- N.B Any pixels with are set to the background colour
- (colour 0) on the foreground block will show through
- the background block.
-
- Select block for map - Click the left mouse button on a block.
-
- Select block for edit - Click the right mouse button on a block.
-
- Grab block from edit screen - Press F9
-
- Scroll blocks up or down - Cursor Up/Down
-
- Change no. of blocks available - Select the "No. Blocks" icon (Row 3,Column 3)
- You are then able to change the number of
- blocks available on the info bar at the
- top of the screen. The value you enter
- will be scaled to the nearest 20. If you
- the value you enter will be changed to 320
- if it is less than this as 320 is the
- minimum number of blocks allowed.
-
- Block edit mode
- ---------------
-
- Plot a pixel - Position the mouse pointer on the place you require in the
- expanded box and click the left mouse button.
-
- Clear a pixel - Position the mouse pointer on the place you require in the
- expanded box and click the right mouse button.
-
- Area fill - Position the mouse pointer on the area to fill and press
- [Space].
-
- Change map dimensions - Select the "Map Dimensions" icon (Row 3, Column 9)
- then type in the map width and press and then the map
- height and press [Return]. The current map will then
- be cleared and the new map size will be set.
- N.B. If the size you specify for the map exceeds
- the amount of available level bank memory
- then you will need to re-enter the map
- dimensions.
-
- The minimum map dimensions are 20x16. If the
- values entered are any less than this they
- are replaced with these values instead.
-
- Flip block horizontally - Select "Flip-X" icon (Row 3, Column 4) or press
- [X] on the keyboard.
-
- Flip block vertically - Select "Flip-Y" icon (Row 3, Column 5) or press [Y]
- on the keyboard.
-
- Insert block - Select the "Insert Block" icon (Row 3, Column 6). The Block
- select screen will be displayed where you click the left mouse
- button on the position to insert the block after which you return
- to the Block edit screen.
-
- Replace block - Select the "Replace Block" icon (Row 3, Column 7). The block in
- the edit window will then replace the original.
-
- Clear block - Select the "Clear Block" icon (Row 3, Column 8). The edit window
- will then be cleared. This function doesn't affect the actual
- block data - to actually clear the block perform a replace after
- this function (See previous function).
-
- Generate mask for block - Press the "G" key. This will generate a collision
- mask for the block which will then be displayed in the right-
- hand window. This can be edited in the same way as the block
- data except that left-mouse=colour 1 and right-mouse=colour 0.
-
- Change current ink colour - This decides which colour to fill or plot a
- pixel with. To change the colour click the
- left mouse button on one of the 32 different colour
- boxes at the bottom of the screen. To show
- which colour is currently selected there is
- a bar going across the top of the colour boxes.
-
- Change a colour in the palette - Select a colour to change and then alter
- the Red, Green and Blue values adjusting the 3
- slider bars on the screen until the desired
- colour is obtained.
-
- Draw a line - Press the "L" key to initiate, then hold down the left mouse
- button to set the first point and whilst keeping the button
- held down move the mouse to the desired position for the
- second point and release the mouse button. To cancel the line
- press the right mouse button while positioning the second
- point and the screen will be restored. After the line has been
- drawn you are returned to pixel mode.
-
-
- Map edit mode
- -------------
-
- Load a new map - Select the "Load Map" icon (Row 1, Column 6) and then
- select the name of the map to load using the file
- requester. The map will be loaded and the size of the map
- will be taken from the 8 byte header.
-
- Save current map - Select the "Save Map" icon (Row 1, Column 7) and then
- select the name of the map to save using the file
- requester. The map will be saved along with an 8 byte
- header which contains the height and width of the map.
-
- Clear current map - Select the "Clear Map" icon (Row 1, Column 9) and the
- map will then be erased from the screen and memory.
- The map will also be cleared if you change its size
- (See above).
-
- Paste a block - Move the mouse pointer to the desired position and press
- the left button.
-
- Clear a block - Move the mouse pointer to the desired position and press
- the right button.
-
- Pick up a block to use from the map - Move the mouse pointer to the desired
- block and then press the space bar.
- The block under the mouse will then
- become the current block.
-
- Scroll map right - If the size of the map allows it and you are not at the
- right-most position press the right cursor key and the
- map will scroll 1 block right.
-
- Scroll map left - If the size of the map allows it and you are not at the
- left-most position press the left cursor key and the
- map will scroll 1 block left.
-
- Scroll map down - If the size of the map allows it and you are not at the
- down-most position press the down cursor key and the
- map will scroll 1 block down.
-
- Scroll map up - If the size of the map allows it and you are not at the
- up-most position press the up cursor key and the
- map will scroll 1 block up.
-
- Set status bits at map pos - Move mouse to required block on map and press
- (See later section) keys [1] - [7] on main keyboard. That block
- will then be outlined and the status bit will
- be set. Only those bits which are available
- can be set and this depends on the no. of
- blocks set up.
-
- Clear all status bits from map pos - Move mouse to required position and press
- (See later section) [DEL] on the keyboard. All outlines and
- status bits will be cleared.
-
- See status bits set on block - Move mouse to required block. The state
- (See later section) (0/1) of the available bits will be shown
- on the bar at the top of the screen (next to
- screen x and y positions).
-
- ---- If chunk has been grabbed ----
-
- (If chunk is grabbed the size of the chunk is indicated by a different
- mouse pointer showing top and bottom corner positions and the mouse buttons
- react differently)
-
- Paste chunk to map - Press left mouse button at required position.
-
- Clear area the size of chunk - Press right mouse button at required
- position.
-
- Cancel chunk paste mode - Press both mouse buttons together.
-
-
- Cut-Buffer mode
- ---------------
-
- Enter cut-buffer mode - Press the "B" key.
-
- Create a chunk to paste onto map - Select blocks from the block screen and
- paste them down onto the cut-buffer
- screen with the left mouse button
- (Right mouse - Clear block,Space - Grab
- block from cut-buffer screen).
-
- Grab chunk from cut-buffer screen - Press the "Return" key (Main keyboard)
- to initiate function. Press left mouse
- button on top left corner, keep button
- down and move mouse to bottom right
- corner then release button.
-
- Grab chunk from map screen - Press the "Enter" key (Keypad) to initiate
- function. Grab chunk in the same way as if
- from cut-buffer screen.
-
-
- ---------------------------
- -- Technical information --
- ---------------------------
-
- Assembly language fundamentals required to use level data properly
- ==================================================================
- In Basic and most other high-level languages memory is treated in
- the form of variables and arrays which is all the user needs to be
- concerned about to do anything. In machine code however memory is treated in the
- form of memory addresses which can be accessed in three different ways
- depending on the maximum value required to be stored. These sizes are
- called bytes, words and longwords. A byte is a single element in memory in
- which a single AscII character eg. "D" can be stored (1k = 1024 bytes, 1
- meg = 1024k = 1048576 bytes). A byte can store a number between the range
- of 0-255. As you can imagine this is not enough for most purposes so other
- sizes are available (Words and Longwords). A word is two bytes and can
- store a value between 0-65535. A longword is two words (four bytes) and can
- store a value between 0-4294967295.
-
- The map data in case you weren't sure doesn't actually contain the
- graphic data for every block but instead contains a number which relates to
- the corresponding block in the graphics set. I was originally storing each
- block number in a byte but this restricted the amount of blocks that could
- be used to a maximum of 255 so instead I decided to store each number in a
- word (Max. value of 65535). This was more than enough (A longword would
- have been over-extravagant and uneccessary).
-
- I will now explain another fundamental concerning memory systems.
- Decimal is called base 10 (Because there are ten values in the numbering system
- - 0-9). Computers don't work with decimal but instead use two other numbering
- systems called Binary and Hexa-Decimal. Binary is called Base 2 and values can
- be either 0 or 1. Hexa-Decimal is called Base 16 and there is a maximum of
- sixteen values (To make up the extra 6 values the first 6 letters of the alphabet
- are used - A-F i.e 0123456789ABCDEF).
-
- Binary makes use of another method of accessing memory. It accesses
- memory on individual bits. A bit can either be set (1) or clear (0). A byte
- contains 8 bits, a word contains 16 bits and a longword contains 32 bits.
- So as to make this easier to understand I will explain how to convert
- between decimal, binary and hexa-decimal. This may sound unusual but bits
- are referenced from the far right of the address working towards the left.
- The highest bit (Bit to extreme left) is called the Most Significant Bit (MSB)
- and the lowest bit (Bit to extreme right) is called the Least Significant
- Bit (LSB).
-
- Values for bits in a byte (8 bits)
- -------------------------------------------------
- | Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
- | -----------------------------------------------
- | Value | 128| 64 | 32 | 16 | 8 | 4 | 2 | 1 |
- -------------------------------------------------
-
- If you add up the value of all the bits (0-7) you will see that the total
- is 255 which is the maximum value which can be stored in a byte.
-
- From the table you may have gathered that the way to convert from decimal
- to binary is to find out which bits added together make up the number.
- The easiest way of doing this is to get from the table the value of the
- highest bit which is less than the decimal number eg. If we wished to
- convert 100 to binary we would see that the nearest value we could start
- with was 64 (128 is too high). We then subtract 64 from the number which
- leaves us with 36. We then repeat the process and get the bit with the
- value of 32. We subtract 32 from 36 and are left with 4. We see there is a
- bit which is this value. This means that we have converted the number to
- binary. The bits we need to set are bits 6,5 and 2. Even though the bits
- are accessed from the right to the left when a binary value is typed into
- the computer it is entered from bit 7-0 (Left to right). Therefore the
- binary value for 100 (Decimal) is 01100100. Here are a few more examples
- just to get you more used to this.
-
- Decimal 92
-
- 64+16=80
- 80+8=88
- 88+4=92
-
- Bits to use are 6,4,3 and 2
-
- Binary 92 = 01011100
-
-
- Decimal 15
-
- 8+4 = 12
- 12+2 = 14
- 14+1 = 15
-
- Bits to use are 3,2,1 and 0
-
- Binary 15 = 00001111
-
-
- I hope this hasn't confused you too much. If it has don't worry
- about it. When I first started writing in machine code I found it
- confusing but once I had used it for a while it became second nature
- to me.
-
-
- Values for bits in a word (16 bits)
-
- Bit 0 = 1
- Bit 1 = 2
- Bit 2 = 4
- Bit 3 = 8
- Bit 4 = 16
- Bit 5 = 32
- Bit 6 = 64
- Bit 7 = 128
- Bit 8 = 256
- Bit 9 = 512
- Bit 10 = 1024
- Bit 11 = 2048
- Bit 12 = 4096
- Bit 13 = 8192
- Bit 14 = 16384
- Bit 15 = 32768
-
- As you will probably have noticed the value for each bit is twice
- the value of the previous bit. Therefore it's easy to work out the extra
- bits required for a longword (16-31) by doing this.
-
- I will now move on to explain how hexa-decimal fits into this. I
- may as well start off by telling you that it is much easier to convert a
- number from decimal to binary and then from binary to hexa-decimal than
- it is to convert a number straight from decimal to hexa-decimal.
-
- As previously mentioned hexa-decimal has 16 possible digits (0-F).
- A hexidecimal digit takes up four binary bits (Called a nibble - Half a
- byte). Therefore a byte can store 2 nibbles, a word can store 4 nibbles
- and a longword can store 8 nibbles. In case you haven't already guessed
- this is how you do the conversion.
-
- Decimal number 78 = Binary 01001110
-
- This binary number is then split up into two nibbles
-
- 0100 and 1110
-
- These nibbles contain 4 bits (0-3) and the values for each bit are
- taken as follows
-
- Bit 0 = 1
- Bit 1 = 2
- Bit 2 = 4
- Bit 3 = 8
-
- Therefore to work out the hexa-decimal value we place the bits
- below the decimal values as so
-
- Nibble 1 Nibble 2
-
- 8 4 2 1 8 4 2 1
-
- 0 1 0 0 1 1 1 0
-
-
- The value of the first nibble is 4 and the value for the second is
- 7. This means that Decimal 78 = Hexa-Decimal 47.
-
- In this case we required only two nibbles (two hex digits) because
- the number fitted inside a byte. If the decimal number was higher than
- 255 and lower than 65536 it would have been stored in a word (4 nibbles)
- and if the value was 65536 or greater it would have been stored in a
- Longword (8 nibbles).
-
- I hope this section has been understandable. If not keep going through
- it and hopefully you will pick it up and start to find it easy.
-
-
- Memory layout of the level bank
- ===============================
-
- If you don't know any of the fundamentals of assembly language programming
- I strongly recommend that you read the previous section to understand fully
- the following information.
-
- --- Level Header Chunk ---
-
- Longword - "LEV"
- Longword - Size of chunk (Bytes)
- Longword - Size of whole level (Bytes)
- Longword - Offset of colour palette chunk from start of bank
- Longword - Offset of map data chunk from start of bank
- Longword - Offset of block data chunk from start of bank
- Word - World No.
- Word - Level No.
- 20 Bytes - AscII string for world name
- 20 Bytes - AscII string for level name
-
- --- Palette Data Chunk ---
-
- Longword - "PAL"
- Longword - Size of chunk (Bytes)
- Word - No. of bitplanes for level
- Word - Palette type (0 - Normal, 1 - AGA (Not supported))
- Longword - Offset for copper structure
- ? Words - Colour palette data
-
- -- Copper Structure (Not currently implemented but space is reserved)
- Word - Copper type (0 - Normal, 1 - AGA (Not supported))
- Word - Colour number to use for copper (0-255)
- Map-Height*16 words - line colour
-
- --- Map data chunk ---
-
- Longword - "MAP"
- Longword - Size of chunk (Bytes)
- Longword - Map width (Blocks)
- Longword - Map height (Blocks)
- ? Bytes - Map data ((Map-Width*2)*Map-Height) ¹
-
- --- Block data chunk ---
-
- Longword - "BGFX"
- Longword - Size of chunk (Bytes)
- Word - No. of blocks (Maximum)
- Longword - Offset for mask data (Collision masks for blocks)
- ? Bytes - Block data (Gfx) ²
- ? Bytes - Block data (Masks) ³
-
-
- ¹ Each block in the map is stored as a number of word size
- ² Block data is stored in a special format called raw-blit/interleaved
- format. Each block is 16 pixels x 16 pixels and stored in the following
- way:
-
- Word 1 - Line 1 (Bitplane 0)
- Word 2 - Line 1 (Bitplane 1)
- Word 3 - Line 1 (Bitplane 2)
- Word 4 - Line 1 (Bitplane 3)
- Word 5 - Line 1 (Bitplane 4)
-
- Word 6 - Line 2 (Bitplane 0)
- Word 7 - Line 2 (Bitplane 1)
- Word 8 - Line 2 (Bitplane 2)
- .... etc ....
-
- This format is the best way to store graphics for use with the Amigas
- blitter chip as it allows the blitter to draw the block quicker. All
- blocks are stored in sequential order (Block 0,1,2,3,4 etc).
-
- ³ A mask is combination of all the bitplanes of a block and therefore
- contains all the pixels set in a block. There is space for a mask for
- each block in the set but actual data will only be stored here if you
- have specifically generated a mask for a block in the block editor and
- then stored the block again using either the insert or replace functions.
- The purpose of a mask is so that you can see which areas of a block are
- detected as a collision. If you don't know how to detect collisions in
- this way then this feature won't be of much use to you.
-
-
- Further explanation of status bits
- ==================================
-
- As previously stated I decided to use a word to store each block number in the
- map. If you are with me you will see that a word has 65536 values (0-65535) and
- 16 bits (0-15). Therefore the number of blocks available for use with the map
- are 65536. I decided that I was unlikely to use that many blocks and so what
- I did was to allow for the 7 high bits of the word to be used for status
- bits (Bits 15-9). Therefore I implemented a function which produced the
- following actions:
-
- Key-Press Bit set
-
- 1 15
- 2 14
- 3 13
- 4 12
- 5 11
- 6 10
- 7 9
-
- If all 7 of these bits were to be used as status bits that would mean
- that the max number of blocks available would be 512 (0-511). Here is a
- table so you can work out how many blocks will be available depending on
- the number of status bits you will be using:
-
- Max number of blocks No. of status bits
-
- 512 7
- 1024 6
- 2048 5
- 4096 4
- 8192 3
- 16384 2
- 32768 1
- 65536 0
-
- The status bits are then masked out (Cleared) to get the correct block
- number from the word. Individual functions in the game can then be assigned
- to the bits which are free. This way you can make each of the bits perform
- a different kind of function depending on the players position in the level
- eg. Bit 15 could be used to tell your routines that this block cannot be
- walked through because there is a collision zone on that block etc. In the
- documentation I was providing some example uses for the bits and by no
- means do you have to abide by these. It depends totally on how you make use
- of the bits within your routines.
-
- Therefore to find out if any status bits are set on a map position.
- Retrieve the relevant word from the map data into a variable (To see how to do
- this you will need to refer to the Source-Code) and then mask out (Clear) the
- bits which relate to the block number in the variable and then use the
- bit-test instruction (Explained in the Amos manual) to see whether certain
- status bits are set or not.
-
- If you wish to ignore the status bits and just display the block then clear
- all the status bits.
-
- If you are still unsure about the use or purpose of this function then
- please don't hesitate to phone me on (0722) 326057 or write to me. At
- the end of the day though, this is just a minor function within the map
- editor intended to make life easier. It isn't essential to understand what
- it is for.
-
-
- -----------------------
- -- Other information --
- -----------------------
-
- You can contact the following address if you want to know more about the
- program or if you wish to speak to me about anything related to AMOS or
- assembly language (I will try to help you with problems you may have) or
- suggest anything to include in updates.
-
-
- The address is:
-
- 11 MACKLIN ROAD
- SALISBURY
- WILTSHIRE
- SP2 7HB
- ENGLAND
-
- TEL. (0722) 326057
-
- ----------------
- -- Final note --
- ----------------
-
- I hope that you enjoy using this program and that it proves to be
- beneficial to you. - Clive Minnican (Programmer).
-
-
- This program is copyright (c) 1993.
-
-
- -------------XXXXXXXX-------------
-
-