Question

I'm going to be launching a large game project. Here's my problem:

The game will require multiple different type of monsters (mobs), each of which have their own specific traits. (ex. different projectiles, immunities to specific abilities, etc)

How do I go about defining each different type of mob? Do I make a new class for each mob that inherits a base class, or do I have one giant class that contains all the possible traits, and template data for each is loaded from a file? What are the advantages and disadvantages of each?

To clarify with a non-gaming example: I have four people, Joe, Bob, Joebob, and Joebobjoe. Do I make a Joe, Bob, Joebob and Joebobjoe class for each of them, because they're all unique, or do I make a Human class that has enough properties to define them separately?

Please let me know if I'm being unclear.

Was it helpful?

Solution

http://gameprogrammingpatterns.com/type-object.html

This could be a good reference to start. It's exactly what you need if you want to abstract all in one class because you will end up with so many classes in your project and it's a good thing to implement some creational pattern too...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top