Advertisement

unit collision avoidance in RTS

Started by August 22, 2002 10:54 PM
1 comment, last by gioni 22 years, 3 months ago
I want to do a RTS and I need a unit avoidance system. The easy way to do it would be to make units each standing on one tile only like in Warcraft, but I would like to make one that is more like that in AoE 1. How can you avoid units if they can have any position and any size on the map? [edited by - gioni on August 22, 2002 11:56:35 PM]
fairly simple actually.

each unit has a specific size, right? well, given the size, when a two or more units come too close to each other, they move around one side of the unit. (move 90 degrees perpendicular to the unit, until you are completely around it''s "circular" area) you will have to however, make a function that if the unit gets trapped, like if two units are too close and he tries to go in between, that he backtracks in a random direction, then procedes.

on second thought, im horrible about explaining things in words, look up "potential functions" on the net
Advertisement
You really need to read Steering Behaviors For Autonomous Characters. Especially the ''unaligned collision avoidance'' part, although it will make more sense if you read through the sections in order.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]

This topic is closed to new replies.

Advertisement