Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: how to handle this kind of movement?  (Read 1343 times)
trileletri
Community Member
*
Posts: 34


« on: March 06, 2010, 11:20:00 AM »

i managed to implement flocking into my rts game.
i'm quite satisfied with it. however there is one small problem and i'm thinking how to tackle it.

when i give an order to a group of units. one unit manages to reach destination first, and all others flock around it. but they can not reach the destination because it's occupied.

here is a video:
http://img689.imageshack.us/img689/2268/movement.mp4

now, what is the most efficient of handling this? i tried to implement a number of position checks but i'm not satisfied with any of them, i tried to recalculate destinations for each unit by taking occupied positions into account...

please, advise me...
Logged

Toaster
Community Member
*
Posts: 378


WWW
« Reply #1 on: March 06, 2010, 02:41:05 PM »

I would get the radius of the meshes then check to see if they are at the destination point and inside that radius. If that makes sense?

Its the best idea I can think of. Tongue

-Toaster
Logged

Visit my site at: Unknown Abstraction
trileletri
Community Member
*
Posts: 34


« Reply #2 on: March 06, 2010, 04:36:07 PM »

it could do, radios of a circle of all selected meshes, then when near destination (< radius of one mesh) and in circle with radius of all meshes then stop.
right?
Logged

Toaster
Community Member
*
Posts: 378


WWW
« Reply #3 on: March 06, 2010, 05:28:26 PM »

Yep thats the idea in theory it sounds great but I don't know how well it will work and do you have some good links on flocking? I'm interested in doing it soon for my game.

-Toaster
Logged

Visit my site at: Unknown Abstraction
Silver
Community Member
*
Posts: 14


« Reply #4 on: March 06, 2010, 07:08:05 PM »

Why don't you rather implement formation movment or atleast that units try to move in a certain formation. This is almost a mus nowadays in any RTS. So implementing this now would solve you two problems. One is with your grop movment since every unit has a diferent destination wich is calculatet from an original position of a group leader unit. And at the same time you would provide your players with a feture wich they would certainly demand at some time.
Logged
trileletri
Community Member
*
Posts: 34


« Reply #5 on: March 06, 2010, 07:34:38 PM »

yes, assign a group leader and individual distance2leader vector (leader position-other unit position) and then add ditance2vector to clicked destination for each unit.

immediately, there are 2 glitches i can think of:
1. what are criteria for selecting group leader? only by distance? closest to destination is group leader? or should i repath using A* for one unit and then recalculate path for each other unit by adding distance2leader for each node in a found path

2. when i select a small group of units at one end of screen and add-select another unit at different part of screen: using rules above (rules 1.) all kinds of odd behavior can occur (wrong unit leader, wrong destination for unit, distant and wrong destination etc)....
Logged

trileletri
Community Member
*
Posts: 34


« Reply #6 on: March 08, 2010, 12:08:52 AM »

SOLVED Smiley
Logged

Silver
Community Member
*
Posts: 14


« Reply #7 on: March 08, 2010, 06:10:32 PM »

I see that you have already solved the problem, but I stil have a preposition about group managing.
We are all used that if you want to move a group of units you must select whole group by draging a rectangle around them everytime. Or you need to assign an existing group of selected units under some hotkey (CTRL+1 for instance) for quick acces. This is quite easy and powerful aproach but it is limited by number of different groups you can create.
But some time ago I have seen a bit different approach, wich was atfirst a bit anoying becouse I haven't been used to it but have later turned out to be much better.
It is aproach where goups are created and saved automaticly when you select more than one unit atonce. And next time you only need to select just one single unit form that group to select entire group. It alows you to simply manage multiple groups of units withut having each of them assigned to certainh hotkey.
And this kind of aproach has another potentionaly useful feture wich wasn't implemented in that game. And that is a group AI. What do i have in mind? For instace when one unit from a group is being atacked other units could automaticly move toward the atacker and retaliate as a group. So there won't be no more ocasions when your units are being kiled one by one. Also it would make batles to look much more realistic. And since goups re being saved automaticly you don't need to wory about assigning them to hotkeys every time and also there is basicaly no limit of how much different groups do you have.
So this is my proposal. If you'll gona use it or not is just up to you.
Logged
trileletri
Community Member
*
Posts: 34


« Reply #8 on: March 08, 2010, 06:59:15 PM »

I kinda implemented it by feel. In my project square select and giving destination assigns a flock number to each selected unit. It stays until another order is given. It's a good idea but I'll leave to players to choose if they want to click and select whole group or just one unit. Maybe some small switch in GUI could do the choosing trick.

For auto retaliation be cautious, if you give a retreating move and enemy catches up with your units and fire at single unit it could lead to you whole group to turn back and probably die... again another switch for unit behavior is needed, as seen numerous times before... (return fire, hold fire, fire at will...)

keep in mind that players have got used to (CTRL + group number) style of grouping units and playing....
so in the end, it's up to a game designer to choose, and to listen to beta testers...
Logged

Silver
Community Member
*
Posts: 14


« Reply #9 on: March 09, 2010, 03:08:05 PM »

When I was pointing out auto retaliation example it was just an example hot group AI can benefit to the game. Ofcourse you need to know hen this behavior is propriate and when not. You definitly won't like that when you gave your units move order to stop and srat fighting enemies just becouse on unit in groupwas atacked, but you would definitly want this kind of behaviour when your units would be standing stil, or when they would be on patrol.

Also when I was submiting my proposal I wasn't trying to tel you to just use this kinda system and leave old one out. Even in a game wich I have mentioned there was posibility to use both systems at the same time. And with one key pres you have been able to chose wich system you want to use in that instace. Also in options you had an ability to chose wich system you want to be used as default (key not presed).
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks