Vectorblade – Level design

Enemies are defined with an EnemyDefinition.
struct EnemyDefinition 
  ds ANGLE8_TABLE,2        ; if zero -> BigBug 
  ds BUG_ENEMY_HP, 0 
  ds ENEMY_STRENGTH,1      ; HP
  ds ENEMY_BULLET_SPEED, 1 ; bug only (for now), lower nibble speed, uppernibble 
                           ; #mt3n, m= 1 can fire missiles, t = 1 can fire target shots, 3 = 1 can fire tripples
                           ; if m = 1 than always missile
                           ; if 3 = 1 than always tripple (if not missile)
                           ; t else
  ds CLONE_INFO, 1         ;ccnnnnnn , cc = number of clones+1 1-4, nnnnn wait bewteen clones 0-63
end struct
As of now two different enemies exist
a) “normal” enemies
b) Big bugs
Normal enemies
– enter the game in patterns
– behavior of pattern and intro can be modified with “ADDITIONAL_TYPE_INFO”
– normal behavior:
    – intro via a pattern
    – after pattern a “delay” is done (enemy invisible)
    – enemy enters screen at a random position at the top of the screen
    – enemy goes to its waiting position
– waiting position:
    – 20 different positions, where enemies wait and “wobble”
    – waiting positions can be defined per level (pointer to waiting position table)
    – from waiting positions attack patterns are randomly initiated
    (count of attack pattern using enemies at the same time can be set via level information)
    – enemies can shoot (count of maximum shots per level can be set per level)
    – probability of shooting (and of bonus drop) can be set per level
The normal behaviour of an enemy can be modified by “ADDITIONAL TYPE” definitions, as of now:
    TYPE_NONE = 0
    TYPE_DIRECT_WAIT = %00000001
    – does not enter a “delay”, will not be invisible, from last “intro pattern” position, the enemy moves to waiting position
    TYPE_DONT_SHOOT = %00000010
    – this enemy can not shoot – never!
    TYPE_DONT_ATTACK = %00000100
    – this enemy will not initiate an attack pattern
    (all three combined can be used to define “blockers”)
    TYPE_DONT_WAIT = %00001000
    – this enemy behaves in a “normal” level like a “kamikaze” attacker
    (it does not enter a waiting position after intro pattern – it “vanishes” instead)
    this can be used to have larger intro waves – but still restrict the overall enemy count to 20 on screen!
Blocker example:
The above shown blockers “protect” the attacking enemies. Each blocker in the example has about 20 hitpoints.
Attack Pattern
Addition to attack patterns 
– attack pattern are really something one would nowadays call “scripted enemy behaviour”. 
Anyway attack sub-pattern definition can now also include “loops” – so the order of sub-patterns 
(in one attack pattern) is not necessarily linear anymore.


Level Definition
1. List of levels
Is a list of all levels (word list of pointers).
List is 0000 terminated – if 0000 is reached the game starts from level 0.
2. Level Definition
                    struct   LevelDefinition 
                    ds       LEVEL_INTRO_PATTERN,2 
                    ds       LEVEL_WAITING_PATTERN,2 
                    ds       LEVEL_ATTACK_PATTERN,2 ; pointer to attack pattern list – pointer to 4 pointers to attack patterns
                    ds       LEVEL_ENEMY_DEFINITION,2 
                    ds       LEVEL_MAX_SHOTS_IN_AIR, 1 
                    ds       LEVEL_MAX_ATTACK_PATTERNS, 1 
                    ds       LEVEL_TYPE, 1 
                    ds       LEVEL_BULLET_BORDER, 1       ; how probable is it that enemies shoots 
                    ds       LEVEL_BONUS_BORDER, 1        ; how probable is it that bonus drops 
                    ds       LEVEL_BUG_DEFINITION, 2 
                    ds       LEVEL_BUG_COUNT, 1 
                    ds       LEVEL_SHOT_DELAY_BUG, 1 
                    end struct 
LEVEL_INTRO_PATTERN one word pointer to level intro patterns, definition see there.
LEVEL_WAITING_PATTERN one word pointer to level waiting patterns, definition see there.
LEVEL_ATTACK_PATTERN one word pointer to level attack patterns, definition see there.
LEVEL_ENEMY_DEFINITION one word pointer to level enemy definition, definition see there.
Number of enemy bullets that are allowed to be “in the air” at one time.
Capped to maximum number of enemy bullets (10).
Number of enemies that are allowed to enter an attack pattern at the same time (no limit).
A combination of following values and bit fields
Value (only one of these at a given time)
LEVEL_TYPE_NORMAL   =        1 
LEVEL_TYPE_BIGGY    =        3 
LEVEL_TYPE_BONUS    =        4                            
LEVEL_TYPE_BOSS1    =        5 
LEVEL_TYPE_BOSS2    =        6
LEVEL_TYPE_BOSS3    =        7 
LEVEL_TYPE_BOSS4    =        8 
And bits in combination of the above entry:
LEVEL_TYPE_SHOP_AFTER  =     %10000000 
LEVEL_TYPE_WARP_AFTER  =     %01000000 
A probablility value that an enemy will shoot.
Only one enemy can shoot in each game round.
A random value is determined (0-255) if the random value is equal or less the value given here – 
the shot will be initiated.
A probablility value that a dead enemy will drop a bonus
A random value is determined (0-255) if the random value is equal or less the value given here – 
a bonus will spawn.
If there this is a bug, a pointer (word) to the bug definition is given. A level can only have ONE
kind of bug.
Count of bugs this level has (only if bug level).
Delay value (in game rounds) a bug will delay between shots (not random!).
Intro pattern is 0000 terminated list of 3 values of an intro line.
struct IntroLine
end struct
Is a word pointer to an intro pattern definition (see there).
If 0 pattern is taken with original values, if !=0, then
all x positions in the pattern are mirrored.
A count of enemies this intro pattern is applied to.
The actual enemy information is taken from the LEVEL_ENEMY_DEFINITION of the level definition.
Is a list of positions (y,x) where the enemies will “wait”.
Each spawned enemy receives a unique id. 
Only 20 enemies are allowed at any one time MAX.
The unique id of the enemy (0-19) is an index to the y,x position within this list of waiting coordinates.
Is a list of exactly 4 attack pattern definition.
If an enemy of a level is randomly chosen to attack the player, than randomly one of the four attack
patterns that are valid for the level is chosen and used.
Each one of the four entries is a pointer to an ATTACK_DEFINITION (see there).
Is simple “counted” list of enemy definitions.
It consists of two parts
a) a count (byte) of enemy definitions to follow
b) a list of (count) enemy definitions to use in the level
While the level is initialized (and the enemies enter with the intro pattern) above counter of 
enemies is kept and the counter modulo the “count”(of enemies defined) is matched to the enemy list.
An enemy definition list for a level looks like:
                    db       2                            
                    dw       enemy1 , enemy2
Than e.g. the first ten enemies would be enemy1, enemy2, enemy1, enemy2, enemy1, enemy2, enemy1, enemy2, enemy1, enemy2.
The modulo ensures that always an enemy definition is available however many enemies spawn and also allows for
small lists.
An intro pattern definition consists of several parts.
   struct IntroPattern
     byte delayBetweenSpawn
     byte initialDelay
     PatternLineList  (zero terminated list of)
   end struct
Is a delay value between enemies spawning (in game rounds).
This delay should be chosen in regard to the movement speed of the enemies.
Delay befor this pattern starts (in game rounds). This might be necessary to be defined
when more than one pattern definitions are used.
A 0000 terminated list of PatternLine definitions.
This is no pointer! The following bytes represent the structure PatternLine until a line
end is reached (adders are both 0000 AND the angle must be 0)
The definition is as:
  struct   PatternLine 
    ds       P_YPOS, 1 
    ds       P_XPOS, 1 
    ds       P_YADD, 2 
    ds       P_XADD, 2 
    ds       P_ANGLE,1 also loop destintion
    ds       P_PAD ,1 
  end struct 
In short:
 P_YPOS, P_XPOS (bytes) starting coordinates.
 P_YADD, P_YADD (words) hi/lo values to add to a 16bit coordinate.
                        if both are zero this is taken as “end of definition”
                        The values are “adds” to go from the above given P_YPOS, P_XPOS to the next lines P_YPOS, P_XPOS values.
                        The size of these values are determined by the excel sheet and there using the provided “speed”.
 P_ANGLE         (byte) The angle to be used for the enemy display (0-7)
 P_PAD           (byte) Pad byte to have a size of eight.
It is possible to loop within one pattern definition list.
In order to initate a loop, following conditions must be met
– P_YADD, P_XADD must both be 0 (words)
– the P_ANGLE than denotes the (1 based) pattern definition count within this PatternLineList.
– if you loop the P_YPOS, P_XPOS of the loop initiating pattern should be the same as the 
  P_YPOS, P_XPOS of the loop destination pattern
– if you build loops within intro patterns, there is no way to “break” the loops, the
  enemies must be destroyed by the player, otherwise the enemies do not leave of their own!
  Definitions can be build using the excel sheet provided.
An attack definition is a terminated (by 0000 as first two bytes) list of different types of patterns.
The different single pattern definitions one complete attack pattern can have are applied
one after another untill the list is terminated (or the attacker is dead).
Depending on the kind of pattern the meaning of the data in one pattern line differs.
One pattern line is 4 bytes long.
All have in common, that the second byte of the definition describes the type of attack pattern.
Following three types are possible:
In addition to above three pattern a fourth type is available: SINGLE_ATTACK_JUMP
with that definition the next pattern line can be accessed via a “jump” to a different pattern.
Thus reuse of sub parts of complete patternlist definitions is possible.
The structure used for such a jump is:
  struct   SingleAttackPatternLine 
    ds (byte)      not used
    ds (word)      address of patternline in attack pattern
  end struct 
This is the most simple attack type.
That pattern moves the enemy from the current position to the position the player resides at the moment
the pattern is initiated.
The structure used:
  struct   SingleAttackPatternLine 
    ds (byte)      SINGLE_ATTACK_SPEED
    ds (byte)      fill up to 4 bytes with 0
  end struct 
Speed with which to attack. All coordinates and movement are calculated in game in relation to
start position and player position.
This pattern moves the enemy from the current position to the absolut position denoted by the pattern.
The structure used:
  struct   SingleAttackPatternLine 
    ds  (byte)     SINGLE_ATTACK_SPEED
    ds  (byte)     YPOS
    ds  (byte)     XPOS
  end struct 
This pattern moves the enemy from the current position to coordinates relative to its current position.
The structure used:
  struct   SingleAttackPatternLine 
    ds  (byte)     not used
  end struct 
Since relative movements are in general more complex than the other attack patterns, this one
uses an additional structure to define relative movement.
The additional structure pointed to by RELATIVE_MOVEMENT_PATTERNLIST (see there) consists of a number of
relative movement definitions. With this “outsourcing” reuse of sub-parts is possibly (e.g. looping).
Is a list of terminated (0000) 8 byte wide relative pattern definitions.
The definition is as:
 struct   PatternLine 
    ds       P_YPOS, 1 ; relative
    ds       P_XPOS, 1 ; relative
    ds       P_YADD, 2 ; movement 16 bit
    ds       P_XADD, 2 ; movement 16 bit
    ds       P_ANGLE,1 ; 0-7
    ds       P_PAD ,1 
 end struct 
The definition is very similar to the definition of PatternLine for the intro patterns.
In short:
 P_YPOS, P_XPOS (bytes) destination relative coordinates.
 P_YADD, P_YADD (words) hi/lo values to add to a 16bit coordinate.
                        The values are “adds” to go from the above given P_YPOS, P_XPOS to the next lines P_YPOS, P_XPOS values.
                        The size of these values are determined by the excel sheet and there using the provided “speed”
 P_ANGLE        (byte)  The angle to be used for the enemy display (0-7)
 P_PAD          (byte)  Pad byte to have a size of eight.
Definitions can be build using the excel sheet provided.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.