RTS help

Started by
3 comments, last by CyberSlag5k 15 years, 3 months ago
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.
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.
Create-ivity - a game development blog Mouseover for more information.
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?
You mean animate the units based on what they are doing at the time? or animate their movement based on their speed? or what?
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!
Without order nothing can exist - without chaos nothing can evolve.

This topic is closed to new replies.

Advertisement