• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Dr_Asik

What does it mean for a group of units to reach a point?

7 posts in this topic

Posted (edited)

In an RTS you can select a group of units and tell them to go to a point on the map. Obviously not every unit can actually go to that point since they occupy space.

One easy but not entirely general way is to define a group formation, interpret the destination as the middle of that formation and send each unit to a position within that formation. Some games work almost entirely like this, e.g. Age of Empires 2.

Forcing units to always have a formation is restrictive though, and sometimes it's impossible to get in the right formation due to obstacles and other units. So we need a fallback strategy. In other words a unit must have a definition of what it means to have "reached" the destination, even though it may not be possible to reach the exact destination point and it may not be possible to occupy a pre-defined position within a formation. Age of Empires 2 doesn't handle this well; units go to the "nearest" legal position even though that may cause them to clip with other units.

I've looked a lot at what Starcraft 2 does when you select a group that's too spread to keep formation (or just click in the middle of the space it occupies). Units seem to all converge towards the destination point, but then some push the others to some extent and some let themselves be pushed and the result is unpredictable, although acceptable in general. It is assumed players can just keep clicking the same point if they want units to try and group more closely. It's really hard to tell what the exact rules are though.

There seems to be a lot of literature about group movement but not much about how the pathfinding actually terminates. Any good references or insight?

Edited by Asik
0

Share this post


Link to post
Share on other sites

Posted (edited)

Never studied this topic, but my first reaction is "it very much depends on what the game author considers good enough".

On second thought, I would say is no agreement about it, in fact, I'd see it as part of the game. Suppose you program roman soldiers against peasants and farmers. I think these two kinds of armies would arrive in totally different fashion. Roman soldiers are highly organized, and would arrive in formation. Peasants and farmers are just a bunch of random guys that never fought in their life, I'd expect them to just arrive near the place where they are supposed to arrive, in some random way. If they would arrive in formation, and the roman soldiers would arrive in disorder, it would totally ruin the atmosphere, I think!

Edited by Alberth
0

Share this post


Link to post
Share on other sites

It means whatever you implement it to mean.

The method I've usually seen is that characters attempt to reach the goal, and they will stop if they are unable to reach the goal after multiple reroute attempts.  This can also help if the character becomes blocked while traveling across the map. If for some reason the character becomes blocked, perhaps someone builds walls around them, then they stop.  If they approach the destination and there is a group of other units in the way, they also stop.  In both cases they may attempt to reroute for a few seconds, but if they repeatedly cannot reach their goal they stop.

If your objects can push each other out of the way, you might want all of them to push each other out of the way until all of them reach the destination.  It can lead to crowding, but can work. You will have the same issues of stopping if the unit becomes blocked and rerouting fails, so it is more work even though it seems similar at first.

I have seen games where formations travel together, and when you choose a destination each unit picks a navigation target relative to where they are standing; a unit standing {x+3, y-4} from the original center should target a point {x+3, y-4} from the selected destination.  However, it still needs similar logic about being blocked, putting it right back to the first solution above.

0

Share this post


Link to post
Share on other sites
That's actually one of the prime situations of Continuum Crowds !
In CC, the space is discretized into a Grid, hence a goal can't be a single point in space afterall.
Mostly, each Group's goal doesn't contain a single, but rather multiple cells.
In Addition, CC defines it's Grid cells with special attributes. One of those is the density at that specific cell. Every person of a group contributes density to the cell it currently occupies as well as to the surrounding cells.
So, people will tend to avoid each other, due to too high densities at specific cells.
0

Share this post


Link to post
Share on other sites

Posted (edited)

That's actually one of the prime situations of Continuum Crowds !
In CC, the space is discretized into a Grid, hence a goal can't be a single point in space afterall.
Mostly, each Group's goal doesn't contain a single, but rather multiple cells.

So instead of defining a destination point, you define a destination zone? That opens up some more questions. Determining in advance the shape of the zone, taking into account static obstacles within it and the number of units going there; deciding which unit goes where inside the zone, preferably as close as possible to the center... I'm not sure it's a good idea to try to compute these things in advance. I think a system where each unit tries to get to the destination, pushing idle units out of the way (SC2-style) will adapt to obstacles dynamically and occupy close-to-optimal space without having to compute it explicitly, however the rules governing who pushes who could be complex. Obviously if every unit has to reach the point before stopping, they'll be shuffling for a very long time in case of large groups. How does the unit decide it's made a good enough effort if it can't exactly reach the point, when does it stop trying?

Edited by Asik
0

Share this post


Link to post
Share on other sites

Another way of doing it is to still determine a destination point (most games are done in some sort of fine XY) but give them a radius at which it is OK to say "close enough". If you are selecting a group to move to the same point, you could, for example, count the number of units in the group and come up with a radius inside which they can assume they have arrived. That would have the side-effect of everyone clustering on the "near" side of the point, however. Using standard flocking algos, though, you could have a moderate attractor to the destination point, but something that could be overridden by the "separation" vector of flocking. That does 2 things: first, you would stop if there is someone between you and the point (or on the point). Second, as more people arrive, they will slightly push each other along until there is a natural equilibrium of folks that are "close to the point but separated from each other".

1

Share this post


Link to post
Share on other sites

@Asik:

Instead of trying to copy behavior of $random game, I'd suggest you start at the other side, what do you want to happen?

Then design an algorithm that achieves that, at least for most practical cases that happen in your game.

 

To me, the problem looks sufficiently complicated that you will never achieve 100% perfect. Unless you write a scientific paper or do a PhD, I think that's not a problem.

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0