Goal oriented gameplay (was: generators, triggers and aiming)
Eero Tamminen
eero.tamminen at netsonic.fi
Mon Jan 10 16:30:54 EST 2005
Hi,
Here's the new TODO list with updated generator, trigger and aim syntax.
TODO (goal oriented game play)
====
* Get old features back to the biplane:
- Disable plane controlling once it's gotten too much damage
- Kill plane after a while after it's gotten enough damage
* Make everything in Airstrike an object: ai, trigger, generator etc.
* Add types to objects:
- Member for the object type
- Parent link that points to parent object type
- Helper function that traverses the type tree to root and checks
whether object or it's parent type had requested type
- Cast macros for the base types: sprite|mech|trigger|generator|ai|aim
using the helper/traverse function. If cast macros are compiled
without debug, they do just casting, not the check
- Everywhere objects are cast, these macros are used
* Note: Sprite capabilities and attribute checks are handled with
messages (e.g. MSG_IS_WALKING). This is needed by triggers
* Add to object type struct counters for how many objects (sprites) of the
given type have been created and killed (live = created - killed).
- Modify these counters when objects are created/killed
- Add clearing of these stats to and call that on level load or unload.
* Add generator objects:
- generator <name tag> <sprite type> <x> <y> <generator type> [options]
When this gets activate message, it creates a sprite of the given
type to the x,y co-ordinates. Same generator can get messages
from multiple triggers.
Available generator types and their (additional) options would be:
- player <index> <count> [tag]
- Assigns an AI given from Airstrike command line to the sprites:
airstrike -level <nr> <ai-1> <ai-2> <ai-3> <etc>
- If 'tag' is set, tags the sprite (needed e.g. for aiming)
- Monitors the sprite and creates a new when old dies <count> times
- Whe activated, sets player# as alive on the level
- When count has finished, sets player# as dead for the level,
see "playerdead" and "playeralive" triggers
- With count some levels or players can have less lives
- singleton <count>
- Creates a new sprite once the old one has been killed, but does it
only for a certain number of times. This can be done by checking
the object type live count (= created - freed objects), it doesn't
need to ref the object
- random <rx> <ry>
- The creation happens at given random positive/negative offset
- ai <ai>
- Sprites are generated with given AI
* Add triggers:
- trigger <name tag> <object tag1,tag2...> <event type> [options]
Sends activate message to the all given tagged objects when an event
of the given type happens. Used to trigger generators, aims and other
triggers, or even individual tagged objects.
Object tag "level-done" is a special one for setting LEVEL_DONE flag
and tag "level-fail" for setting LEVEL_FAIL flag. "level-winner" tag
is for setting the level "winner" member to the AI of the sprite that
completed the level (triggered level-end condition).
Available event types and their options would be:
- playerdead <count>
- Activation happens when at least <count> players have been killed
(until they are dead)
- playeralive <count>
- Activation happens when only <count> players are alive
- timer <ms> [count]
- Activation happens after each <ms> millisecs period until count
reached
- random <min ms> <max ms> [count]
- Activation happens at random time interval until count reached
- 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 (created-freed) sprites of given type
get into given range (or would out of range be better?)
- 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 for the found sprite to the tagged object
(not activate message)
- Needs to scan through all live sprites :-/
- aicontrol <ai> <tag>
- Used to check whether <ai> has gained control of a tagged object
- Basically checks which AI the tagged object has
- tagkill <tag>
- Used to check whether anything has killed tagged object
* Implement global aim for objects and shell syntax:
- aim <name tag> <sprite type> <tag> [ai]
When this gets activate message, it makes sprites of given type to
follow the object with given tag. If 'ai' is set, objects should
use that instead of the default following AI. Tag "NONE" can be
used (later) to clear the tag from aiming.
This might be done e.g. 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 */
}
* Add [generator|trigger|aim] activation and inactivation to the shell
as they are by default inactive:
- activate <generator|trigger|aim tag>
- inactivate <generator|trigger|aim tag>
With this it's even possible that another player starts later after
certain trigger (time, first player death, whatever)...
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 and aiming them at player...
generator bird-generator bird 400 300 random 200 50
trigger bird-timer bird-generator timer 500 50
aim bird-aim bird p1plane
# ...and finish level in 15 secs...
trigger level-timer level-done timer 15000
# ...once the two zeppelins have been killed
trigger end-trigger bird-aim,bird-timer,level-timer,level-winner
spritekill zeppelin 2
activate end-trigger
# create player
generator player1 biplane 400 50 player 1 p1plane
activate player1
# level failure
trigger fail-trigger level-fail playeralive 0
--------------------------------------
I think this will be fairly straightforward to do with the new object
system, but it will require quite a lot of work...
- Eero
More information about the airstrike
mailing list