Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:41:10+00:00 2026-05-30T09:41:10+00:00

In RTS games, when you move some units, they find path and go to

  • 0

In RTS games, when you move some units, they find path and go to the places that are the closest to the selected place. I dont know how to select those places, I mean the target points for each unit.

For example, when I send 9 troops, I want them to have TARGETS like this:

. - empty, 
T - targets for units, 
O - the place that I've choosen to move them, target for unit too
.....
.TTT.
.TOT.
.TTT.
.....

Pathfinding algorithm is ready, just I need to generate the list (or vector) of target points, one for each unit. I dont want the complete code, but just some advices and ideas… Well I have to mind that not all places are walkable…

Thanx for any replies and sorry for my bad english…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:41:11+00:00Added an answer on May 30, 2026 at 9:41 am

    You could use a BFS from the allocated point. “Fill” the selected tile with a unit if it is a tile that can hold a unit [not an obstacle]. Keep doing it until you “exhausted” the number of units.

    In pseudo-code:

    selectTargetLocation(point,units):
      currUnit <- 0
      queue<- new queue
      visited <- {}
      map<unit,point> <- empty map
      queue.push(point)
      while (queue.empty() == false): 
         current <- queue.takeFirst()
         visited.add(current)
         for each p such that p and current are neighbors: //insert neighbors to queue
              if p is not in visited: 
                    queue.push(p)
         if current is not an obstacle: 
             map.put(unit[currUnit++],current) 
         if (currUnit == units.length) break //break when exhausted all units
      return map
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a lot of similar classes (Units in a RTS in
I'm starting a little RTS game with SDL and here are some questions: I
I have a 2d map in my rts. On the map there are some
I'm working on an RTS style webapp in processingJS, meaning that there is a
I've been thinking about a multi player RTS game. The part that I can't
I am looking for networking designs and tricks specific to games. I know about
I am making RTS game and whole terrain is like grid ( cells with
I'm writing an RTS game, and I want to encapsulate user actions into commands.
I am currently designing an RTS Game in XNA. So far I have a
The idea that the standard Monad class is flawed and that it should actually

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.