Last Good Quote: Son's are the seasoning on our lives. - Someone on Facebook

Saturday, March 1

Spawning Monsters

I've been thinking about monster spawning. For those that might now know, this means to place a new enemy creature on a map. A few thoughts I have.

As I develop the monster spawning will get progressively complex, so this is an iterative approach.

Variables:
MaxMonstersNearBy
Spawn Point - Coordinates of spawn point
Spawn Radius - As a player moves monsters will spawn within this area


  1. Check if there is more than MaxMonstersNearBy, if so exit. MaxMonstersNearBy will be set by the particular segment of the map the player is on.
  2. Check if there any players within viewing distance of the spawn point. If so exit. We don't want monsters to "pop" on the screen, players will wonder into them, or monsters will wonder into players
  3. Spawners will have a maximum number of monsters they can have spawned at any point in time.
  4. Check if there any spawn points outside of viewing distance but within SpawnRadius of the player. For each spawn point proceed.
    1. Choose a random leader, whose level is within 1 level of the player.
    2. Leaders have a number of followers that will spawn with them.
    3. Place the leader and the followers on an empty spot near the spawn point.

AI:
  1. Monsters will have one of the follow modes specified:
    1. Attack - Aggressively chase any player within x distance
    2. Guard - Stay still and attack only when attacked
    3. Wander - Moves randomly in a direction
    4. Follow - Follow a given unit, in the event that unit can not be found, start to wander.
  2. Leaders will set the mode of all followers
  3. Followers with no leader will go into wander mode.
Realistic Movement:
  1. Recall that AI processing (aiThinker) is only called once every few seconds.
  2. AI will choose 5 waypoints and move between those waypoints until the aiThinker is called again.
This is for my game Blades of War.



0 comments:

Post a Comment

Followers