Jump to content
  • Advertisement
Sign in to follow this  
m3rk

RTS help

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

When all units move simultaneously. Is it like this: -check units status (maybe it's on a linked list.) -if they are not idle move them to where it is assign -repeat Is it fine or not? Can anyone help me out how to improve this.

Share this post


Link to post
Share on other sites
Advertisement
That's basically what it comes down to, yes: every game cycle, you update your units. You move them a little closer to their destination, or you make them fire a shot, or whatever else they need to be doing. After you've updating everything that needed to be updated, you refresh the screen, and you start with a new game cycle.

There are some high-level optimizations possible, but these depend on the situation, so if that's what you're looking for, you need to be more specific.

Share this post


Link to post
Share on other sites
Ok thanks Captain P.

I have another problem. How can I animate the units perfectly using it?

-Should I insert it here? If I insert it here, every frame it will check the status.
-check units status (maybe it's on a linked list.)
-if they are not idle move them to where it is assign
-repeat

Is there any way to make it fast or that's the only solution?

Share this post


Link to post
Share on other sites
You mean animate the units based on what they are doing at the time? or animate their movement based on their speed? or what?

Share this post


Link to post
Share on other sites
Every unit should have a Draw, Update, Idle, and Kill method. Your update should handle the unit moving, shooting, etc., the draw method will handle animation, the idle method may or may not do anything, and the kill method cleans it up. Then you just call Draw from Update, and you're in business.

Good luck!

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!