Fun Infused Games  |   Smooth Operator RSS 

  Home   |    Archive   |    Subscribe   |    Search   |    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


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