Jump to content
  • Advertisement
Sign in to follow this  
Guy Meh

Handling actor (monster) types

This topic is 3716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm thinking of splitting my actors (that is, the monsters) into the actor itself and an actor type. The actor type would hold invariant data such as the actor's maximum health and be used to choose what sprite to use when drawing the actor. Basically, the actor type would have all the stuff that you'd define in the configuration files. I'm just wondering how to handle my collection of actor types and their relationships to the actors. I've thought of having an actor keep a regular pointer to its actor type, but that may make serialization tricky. I don't want to serialize the collection of actor types, whatever it will look like, since I can use the actor type collection between different play sessions and they're defined in my configuration files anyway. Have others encountered something like this?

Share this post


Link to post
Share on other sites
Advertisement
Give each actor type a name (such as "Monster_1_Type"), and have the actors serialize that type name. Create a map that goes from type name to type class, and all your actors will be able to grab a pointer to their type class when they're created or loaded from disk. Of course, you always want to load the actor types first (preferably once when the game loads).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!