Notes on aiming, generators and triggers

Eero Tamminen eero.tamminen at
Sun Jan 2 17:08:22 EST 2005


Ulf, below are some thoughs on how we could proceed next with making
Airstrike more flexible and have goal oriented gameplay.  Most of items are
from the TODO list I came up for myself during the weekend while doing the
bonuses. I'd like your comments on them (because I'm not sure how to achieve
all of them :)).


* Add to sprite type structs counters for how many sprites of the given
  type have been created and killed, and how many of them are live.
  - Modify these counters when sprites are created/killed (in sprite.c?).
  - Add clearing of these stats to (to sprite_types.c?) and call that
    on level unload.

* Implement global aim for objects and shell syntax:
   - aim <sprite type> <tag> [ai]
   and make bonuses use the same mechanism.  If 'ai' is set, objects should
   use that instead of the default following ai.  This is probably best done
   by having the aim as additional information in the sprite type structs:
   struct {
      sprite_type_t type;	/* current sprite type stuff */
      int createcount;		/* how many created on this level */
      int killcount;		/* how many killed on this level */
      char *aim;		/* which tagged sprite to aim for, if set */
      ai_t aim_ai;		/* AI to use in aiming, if set */
  This will be fun to do from the builtin Airstrike shell while testing,
  aiming all the sprites of certain type to an earlier tagged sprite.
  I will add support for that at least for birds (using tag instead of the
  global aim thing currently used for the bird leader) and bonuses, but it
  would be great if you could look into getting the AI part of this

* Get old features back to the biplane:
  - MSG_BOMB (instead of ifdeffed out MSG_FIRE)
  - New control message and keyboard shortcut for this
  - Add bonus for biplanes for getting more bombs

* Questions:
  - How non-sprite things can be objects and tagged?
    This is needed for getting generators and triggers below to work...

* Add generator object:
  - generator <name tag> <sprite type> <x> <y> [rx] [ry]
  When this gets activate message, it creates a sprite of the given
  type to the x,y co-ordinates.  If rx and/or ry are given, the creation
  happens at given random positive/negative offset.  Generator gets
  the activation messages from trigger.  Same generator can get messages
  from multiple triggers.

* Add triggers:
  - trigger <name tag> <object tag1,tag2...> <event type> [type specific 
  Sends activate message to the tagged object when an event of the given
  type happens.

  Object tag "level-done" is a special one for setting LEVEL_DONE flag
  and "level-winner" for setting the level "winner" member to the player
  who completed the level.

  Available event types and their options would be:
  - timer <ms>
    - activation happens after each <ms> millisecs period
  - random <min ms> <max ms>
    - activation happens at random time interval
  - spritekill <sprite type> <min kill count>
  - spritecreate <sprite type> <min create count>
    - whether player (or other objects) have created/killed
      enough of these types of objects
  - spriteactive <sprite type> <min count> <max count>
    - triggered if number of live sprites of given type get into
      given range
  - proximity <x> <y> <r> [above|below|left|right]
    - if one of above|below|left|right is set, proximity is checked
      only in that direction
    - sends MSG_SET_TARGET message, not activate
  - aicontrol <ai> <tag>
    - used to check whether player has gained control of an object
  - tagkill <tag>
    - used to check whether player has killed marked object
  Only proximity trigger needs to scan through live sprites.  Timer is
  trivial and create & kill counts can be gotten from the current level.
  No idea how aicontrol and tagkill could be checked.

* Add trigger activation and inactivation to the shell as triggers
  are by default inactive:
  - activate <trigger tag>
  - inactivate <trigger tag>
  An example level:
  level_name "Zeppelin birds"
  description "Kill two zeppelins and then persist for 15 secs an assault of 
the birds to finish the level"
  # create two zeppelins to kill
  sprite zeppelin 200 400
  sprite zeppelin 600 400
  # start generating birds...
  generator bird-generator bird 400 300 200
  trigger bird-timer bird-generator timer 500
  # ...and finish level in 15 secs...
  trigger level-timer level-done timer 15000
  # ...once the zeppelins have been killed
  trigger end-trigger bird-timer,level-timer,level-winner spritekill 
zeppelin 2
  activate end-trigger
  # create player
  sprite biplane 400 50 tag=p1plane
  ap player1 p1plane
  # and aim any birds at player
  aim bird p1plane

* Use generators & triggers for current items which are not supposed
  to disappear (level specific behaviour):
  - birds
  - zeppelin
  - balloons

* Make a new "zombie" AI that just follows an object
  ("tag"ed eg. as "follow") using the updated
  "mech_follow" function (give tag instead of an object)

* Use the "zombie" AI on:
  - The zeppelin on certain levels
  - Follow bonuses (currently done with global_aim):
    - Airballoon
    - Bird (leader)
    - Zeppelin
    - Missile

* Add text message backs, sprite_types.c::sprite_say:
  ui_tag_pos -> ui_message?

* Get more bonus features to the biplane:
  - MSG_BONUS: fuel

* Fix sounds (see sound_fx.h)

	- Eero

Btw. Things I'm not going to look into are multiplayer and plane dying

More information about the airstrike mailing list