Fun Infused Games  |   Smooth Operator

  Home   |    Archive   |    About
Posts prior to 8/2/2010 may be missing data. If you need one of those posts, please contact kriswd40@yahoo.com and I will try and recover/find it.

Class Based Enemies
Date 8/19/2009    Tags Game Dev    (0)

In my first game Nasty, all enemies have their own name and there is no good way to group them together. Some of them (for instance the blue ghosts and the green and red ghosts) share some logic, but they are really entirely different entities.

For my next game, I have decided to create different customizable classes of enemies with every enemy belonging to a class. This way I can create a class of enemies (for instance soldiers) that have a specific set of behaviors that can be used for multiple enemies. I can easily create multiple enemies that appear to the user as different enemies but really share the exact same logic. They'll even be able to share the exact same animation/drawing logic but pass in different textures to use.

Here is an example of how that might work (these are completely arbitrary numbers right now FYI):

Crazy Farmer (soldier class)
Speed = 100
Patrol Range = 300
Shot rate = 10
Detection Range = 400
Health = 50

Army Man (soldier class)
Speed = 150
Patrol Range = 600
Shot rate = 50
Detection Range = 1000
Health = 150

The Crazy Farmer and the Army Man will both walk back and forth on the level and use the same animations (with different textures), but the Army Man will patrol a larger area and shoot at the player from further out because of the different values assigned to him. He will also be harder to kill due to more health and a quicker speed.

Reusing code is a very good thing to do. This will significantly reduce the amount of debugging I have to do and increase the number of enemies that my next game can have. I have not settled on how customizable I'd like these enemies to be just yet, but I aim to make them customizable enough that to the end user (gamer), they seem like completely different beasts. /tds/go.php?si


This article has been view 410 times.


Comments

No comments for this article.


Add Comments

Name *
Website
  Name the animal in the picture below:

*
Comment *
Insert Cancel
Things To Click


Tags
Video Games (7)  Trivia or Die (3)  SQL (1)  iOS (3)  Game Dev (11)  Advise (14)  PC (1)  World of Chalk (2)  FIN (20)  Abduction Action! (27)  XBLIG (32)  Abduction Action (1)  Nastier (4)  ASP.net (18)  Absurd (2)  Volchaos (11)  Web (19)  Fin (1)  XNA (40)  Rant (50)  Cool (2)  Visual Studio (1)  Trivia Or Die (1)  Xbox (1)  C# (14)  Sports (11)  Design (2)  Development (13)  Hypership (28)  WP7 (8)  VolChaos (1)  Nasty (34)  Abdction Action! (1)