Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Hyperion

Handling many objects

This topic is 6516 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

Hi! While working with NeHe's Particle-Tut, I discovered a nice effect that looks like a Fireball or a Rocket. I want the Player to be able to fire this Fireball. For this purpose I created a class named CFireball. I also have a basic Game-Loop. Now I want to handle more Objects than just one, for example more Fireballs than one or a Fireball and a target. I wonder how to implement this. I thought about an empty pointer, which points to the Objects, but this solution seems to be kind of cheap and you have to give an explicit number of maximum objects you want to handle. Is there a more powerful way to administrate many Objects in the game? Do you know any URL? Thanks, Hyperion Edited by - Hyperion on January 14, 2001 5:09:40 PM

Share this post


Link to post
Share on other sites
Advertisement
If you gave your Fireball class an ''advance'' function that calculated exactly one frame of animation and drawing, then you could make a linked list of Fireballs, calling each''s advance function. That way you would calculate for one fireball, move to the next, then to the next, for each frame, without getting stuck in animation loops that don''t return fast enough.

The loop through your linked list would be in the Game-Loop you mentioned.


If you want to be able to handle a fireball _and_ other sorts of objects you might consider deriving all of your objects from a single base class - that way you could still use a single linked list but have it hold different kinds of objects.

Share this post


Link to post
Share on other sites

  • 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!