Jump to content
  • Advertisement
Sign in to follow this  
croux

architecture of unit tasking

This topic is 1412 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 am making a strategy game so i need to command players units which can mine,build,construct and craft.

I have 2 classes designed yet:

Map - which keep the tasks in stack (each task type separately)

Unit - which need to do task

I need to handle not only accomplishing and assigning of tasks, but also canceling during progress (for example user decided that he dont want to build there, but the unit is on a half way to construction site already with mats, so the unit need to bring them back ). Can you guys give me any ideas or some simple class diagrams pls ?

Share this post


Link to post
Share on other sites
Advertisement
what exactly is the problem? you could just switch the task from your Unit class to something alternative (e.g. idle) if it shouldn't continue with the current task. Is there much more to it?

Share this post


Link to post
Share on other sites

i usually find it best to keep all orders info with the unit, IE what to build and where. it sounds like your map holds the what and where info (and perhaps by whom?), or am i just reading it wrong?.

 

in your example, orders to build would be replaced with orders to return resources to the storage depot, or to do nothing ( or some other default behavior), if the unit wasn't carrying any resources.

Share this post


Link to post
Share on other sites

Well my current solution is that i am using struct task which have pointers on units. So when i cancel some task i can clearly see if the task is assignment. Now i have to figure out how to make AI to effectively pick and accomplish tasks.

Edited by croux

Share this post


Link to post
Share on other sites


Well my current solution is that i am using struct task which have pointers on units. So when i cancel some task i can clearly see if the task is assignment. Now i have to figure out how to make AI to effectively pick and accomplish tasks.

 

so the player queues up tasks, and the AI assigns appropriate units? and a task struct has all the "orders info": what to build, where to build, unit assigned etc. all that sounds fine.

 

tasks can be processed first come first serve, or on some priority basis (gather before build, etc). you'll probably want to use first come first served, so the player defines the order.

 

for assigning units, you'd probably use a best match search for closest available unit of the correct type.

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!